[PATCH] tlsf: use compiler's static_assert implementation

Ahmad Fatoum a.fatoum at barebox.org
Wed Oct 15 01:27:24 PDT 2025


The compiler's statis_assert allows for a much better error message than
the current error message about negatively sized arrays.

Signed-off-by: Ahmad Fatoum <a.fatoum at barebox.org>
---
 common/tlsf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/common/tlsf.c b/common/tlsf.c
index e7f1b8354f02..cb380dcf87c4 100644
--- a/common/tlsf.c
+++ b/common/tlsf.c
@@ -77,10 +77,7 @@ enum tlsf_private
 ** Static assertion mechanism.
 */
 
-#define _tlsf_glue2(x, y) x ## y
-#define _tlsf_glue(x, y) _tlsf_glue2(x, y)
-#define tlsf_static_assert(exp) \
-	typedef char _tlsf_glue(static_assert, __LINE__) [(exp) ? 1 : -1]
+#define tlsf_static_assert static_assert
 
 /* This code has been tested on 32- and 64-bit (LP/LLP) architectures. */
 tlsf_static_assert(sizeof(int) * CHAR_BIT == 32);
-- 
2.47.3




More information about the barebox mailing list