This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 64176214a0 assert: add compile_assert macro
64176214a0 is described below
commit 64176214a0e8bafb2bbda091a6865cf757c2a7f7
Author: guoshichao <[email protected]>
AuthorDate: Tue Oct 10 19:49:49 2023 +0800
assert: add compile_assert macro
Signed-off-by: guoshichao <[email protected]>
---
include/assert.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/assert.h b/include/assert.h
index f80b657840..c2b8a0fab5 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -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