Skip to content

Commit c23afb3

Browse files
committed
Enabled assertions support for bsdmodule.
1 parent 61b2c7a commit c23afb3

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

config-bsdmodule.h.in

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
/* Define if 'int64_t' is typedefed to 'long long' in bsdmodule. */
2424
#undef HAVE_INT64_IS_LONG_LONG_BSDMODULE
2525

26+
/* Define to enable assertion checking. Failed assertions will print a message
27+
and optionally stop the router. */
28+
#undef HAVE_KERNEL_ASSERT
29+
2630
/* Define if NETISR scheduling should be used. */
2731
#undef BSD_NETISRSCHED
2832

@@ -33,7 +37,19 @@
3337
#include <sys/types.h>
3438

3539
/* Define assert macro. */
36-
#define assert(x) /* nada */
40+
# ifdef __cplusplus
41+
extern "C" {
42+
# endif
43+
void click_assert_failed(const char *file, int line, const char *problem_text);
44+
# ifdef __cplusplus
45+
}
46+
# endif
47+
48+
#ifdef HAVE_KERNEL_ASSERT
49+
# define assert(x) ((x) ? (void)0 : click_assert_failed(__FILE__, __LINE__, #x))
50+
#else
51+
# define assert(x) /* nada */
52+
#endif
3753

3854
/* Define likely and unlikely macros. */
3955
#define likely(x) __builtin_expect(!!(x), 1)

0 commit comments

Comments
 (0)