From f12c88d287c1eae49c09b5a34709e7431023415a Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 19 Aug 2024 22:49:30 +0800 Subject: [PATCH] assert: check COMPILE_TIME_ASSERT before define check COMPILE_TIME_ASSERT before define Signed-off-by: chao an --- include/assert.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/assert.h b/include/assert.h index c2b8a0fab500c..2b13206cfbda5 100644 --- a/include/assert.h +++ b/include/assert.h @@ -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