Made nxt_assert() statements to be compiled only with debug.

This commit is contained in:
Valentin Bartenev
2018-02-09 19:07:55 +03:00
parent fc496c19ac
commit 24d07cfdd2
3 changed files with 30 additions and 16 deletions

View File

@@ -122,6 +122,15 @@ nxt_log_debug(_log, ...) \
} while (0)
#define nxt_assert(c) \
do { \
if (nxt_slow_path(!(c))) { \
nxt_thread_log_alert("%s:%d assertion failed: %s", \
__FILE__, __LINE__, #c); \
nxt_abort(); \
} \
} while (0)
#else
#define nxt_debug(...)
@@ -129,6 +138,8 @@ nxt_log_debug(_log, ...) \
#define \
nxt_log_debug(...)
#define nxt_assert(c)
#endif
@@ -170,17 +181,4 @@ NXT_EXPORT extern nxt_log_t nxt_main_log;
NXT_EXPORT extern nxt_str_t nxt_log_levels[];
#define nxt_assert(c) \
do { \
if (nxt_fast_path(c)) { \
break; \
\
} else { \
nxt_thread_log_alert("%s:%d assertion failed: %s", \
__FILE__, __LINE__, #c ); \
nxt_abort(); \
} \
} while (0)
#endif /* _NXT_LOG_H_INCLUDED_ */