tlsf: use compiler's static_assert implementation
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.
Signed-off-by Ahmad Fatoum <[email protected]>
--- common/tlsf.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
common/tlsf.c +1 -4
@@ -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
Sascha Hauer
AppliedQuoted 4 lines · Ahmad Fatoum
The compiler's
statis_assertallows for a much better error message than the current error message about negatively sized arrays.
Applied, thanks!
[1/1] tlsf: use compiler's static_assert implementation
https://git.pengutronix.de/cgit/barebox/commit/?id=0565f4928ba4 (link may not be stable)
Best regards,
Signature · 1 line
Sascha Hauer <[email protected]>