14 #ifndef ECU_ASSERTER_H_
15 #define ECU_ASSERTER_H_
35 #if defined(ECU_DOXYGEN)
82 #define ECU_STATIC_ASSERT(check_, msg_)
85 #if defined(__cplusplus) && (__cplusplus >= 201103L)
87 #define ECU_STATIC_ASSERT(check_, msg_) \
88 static_assert((check_), msg_)
89 #elif !defined(__cplusplus) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && (__STDC_VERSION__ < 202311L)
91 #define ECU_STATIC_ASSERT(check_, msg_) \
92 _Static_assert((check_), msg_)
93 #elif !defined(__cplusplus) && defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
95 #define ECU_STATIC_ASSERT(check_, msg_) \
96 static_assert((check_), msg_)
100 #define ECU_STATIC_ASSERT(check_, msg_) \
101 extern const char ecu_static_assert_fired_[(check_) ? 1 : -1]
109 #if defined(ECU_DOXYGEN)
137 #define ECU_ASSERT(check_)
161 #define ECU_ASSERT_DEFINE_FILE(name_)
164 #if !defined(ECU_DISABLE_ASSERTS)
167 #define ECU_ASSERT(check_) \
168 ((check_) ? ((void)0) : ecu_assert_handler(&ecu_file_name_[0], __LINE__))
172 #define ECU_ASSERT_DEFINE_FILE(name_) \
173 static const char ecu_file_name_[] ECU_ATTRIBUTE_UNUSED = name_;
176 #define ECU_ASSERT(check_) \
180 #define ECU_ASSERT_DEFINE_FILE(name_)
ECU_ATTRIBUTE_NORETURN void ecu_assert_handler(const char *file, int line)
User-defined system response under an assert condition. Called by ECU_ASSERT() when an assertion fire...
#define ECU_ATTRIBUTE_NORETURN
Critical attribute. Attached to a function declaration to inform the compiler the routine never retur...
Definition: attributes.h:33