File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636
3737#include <sys/cdefs.h>
3838
39+ #include <stdbool.h>
40+
3941/*
4042 * Unlike other ANSI header files, <assert.h> may usefully be included
4143 * multiple times, with and without NDEBUG defined.
4648#undef __assert_unreachable
4749
4850#ifdef NDEBUG
49- #define assert (e ) ((void)0)
50- #define _assert (e ) ((void)0)
51+ #define assert (... ) ((void)0)
52+ #define _assert (... ) ((void)0)
5153#if __BSD_VISIBLE
5254#define __assert_unreachable () __unreachable()
5355#endif /* __BSD_VISIBLE */
5456#else
55- #define _assert (e ) assert(e)
56-
57- #define assert (e ) ((e) ? (void)0 : __assert(__func__, __FILE__, \
58- __LINE__, #e))
57+ #define assert (...) ((void)sizeof(((bool(*)(bool))0)(__VA_ARGS__)), \
58+ (__VA_ARGS__) ? (void)0 : \
59+ __assert(__func__, __FILE__, \
60+ __LINE__, #__VA_ARGS__))
61+ #define _assert (...) assert(__VA_ARGS__)
5962#if __BSD_VISIBLE
6063#define __assert_unreachable () assert(0 && "unreachable segment reached")
6164#endif /* __BSD_VISIBLE */
You can’t perform that action at this time.
0 commit comments