Skip to contentSkip to conversation

tlsf: use compiler's static_assert implementation

PATCH Applied Ahmad Fatoum 2 participants 2 messages Oct 15, 2025 – Oct 20, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tlsf: use compiler's static_assert implementation

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

---
 common/tlsf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
common/tlsf.c +1 -4
index e7f1b8354f02..cb380dcf87c4 100644
@@ -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);
Signature · 1 line
2.47.3