Skip to content

Commit

Permalink
assert: add compile_assert macro
Browse files Browse the repository at this point in the history
Signed-off-by: guoshichao <[email protected]>
  • Loading branch information
extinguish authored and xiaoxiang781216 committed Aug 19, 2024
1 parent e88e3cd commit 6417621
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
# endif
#endif

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

/* 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
* e.g. in a structure initializer (or where-ever else comma expressions
Expand Down

0 comments on commit 6417621

Please sign in to comment.