Skip to content

Commit

Permalink
assert: check COMPILE_TIME_ASSERT before define
Browse files Browse the repository at this point in the history
check COMPILE_TIME_ASSERT before define

Signed-off-by: chao an <anchao@lixiang.com>
  • Loading branch information
anchao committed Aug 19, 2024
1 parent 6417621 commit cb3b267
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,9 @@
# endif
#endif

#define COMPILE_TIME_ASSERT(x) static_assert(x, "compile time assert failed")
#ifndef COMPILE_TIME_ASSERT
# define COMPILE_TIME_ASSERT(x) static_assert(x, "compile time assert failed")
#endif

/* Force a compilation error if condition is true, but also produce a
* result (of value 0 and type int), so the expression can be used
Expand Down

0 comments on commit cb3b267

Please sign in to comment.