Skip to content

Commit

Permalink
Just use NDEBUG flag to decide if LF_ASSERT is expanded or not
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj committed Dec 27, 2023
1 parent f7a72b0 commit 6b35131
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,3 @@ define(LF_PACKAGE_DIRECTORY)
define(LF_FILE_SEPARATOR)
define(WORKERS_NEEDED_FOR_FEDERATE)
define(LF_ENCLAVES)
define(LF_NOASSERT)
6 changes: 3 additions & 3 deletions include/core/utils/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,9 +269,9 @@ void lf_register_print_function(print_message_function_t* function, int log_leve
/**
* Assertion handling. LF_ASSERT can be used as a short hand for verifying
* a condition and calling `lf_print_error_and_exit` if it is not true.
* By definng `LF_NOASSERT` this check is not performed.
* This is optimized away if the NDEBUG flag is defined.
*/
#if defined(LF_NOASSERT)
#if defined(NDEBUG)
#define LF_ASSERT(condition, format, ...) (condition)
#else
#define LF_ASSERT(condition, format, ...) \
Expand All @@ -280,5 +280,5 @@ void lf_register_print_function(print_message_function_t* function, int log_leve
lf_print_error_and_exit(format, ##__VA_ARGS__); \
} \
} while(0)
#endif // LF_NOASSERT
#endif // NDEBUG
#endif /* UTIL_H */

0 comments on commit 6b35131

Please sign in to comment.