From: Ahmad Fatoum <a.fatoum@barebox.org>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@barebox.org>
Subject: [PATCH] tlsf: use compiler's static_assert implementation
Date: Wed, 15 Oct 2025 10:27:24 +0200 [thread overview]
Message-ID: <20251015082724.4094242-1-a.fatoum@barebox.org> (raw)
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
next reply other threads:[~2025-10-15 8:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 8:27 Ahmad Fatoum [this message]
2025-10-20 11:02 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251015082724.4094242-1-a.fatoum@barebox.org \
--to=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox