* [PATCH] tlsf: use compiler's static_assert implementation
@ 2025-10-15 8:27 Ahmad Fatoum
2025-10-20 11:02 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2025-10-15 8:27 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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@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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tlsf: use compiler's static_assert implementation
2025-10-15 8:27 [PATCH] tlsf: use compiler's static_assert implementation Ahmad Fatoum
@ 2025-10-20 11:02 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2025-10-20 11:02 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 15 Oct 2025 10:27:24 +0200, Ahmad Fatoum wrote:
> The compiler's statis_assert allows 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,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-20 12:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-15 8:27 [PATCH] tlsf: use compiler's static_assert implementation Ahmad Fatoum
2025-10-20 11:02 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox