[PATCH] cdefs: allow __attribute__ on tcc
Eric Wong
normalperson@yhbt.net
Thu Oct 30 20:11:51 GMT 2025
According to the tcc (tiny C compiler) Changelog, tcc supports
__attribute__ since 0.9.3. Looking at history of tcc at
<https://repo.or.cz/tinycc.git>, __attribute__ support was added
in commit 14658993425878be300aae2e879560698e0c6c4c on 2002-01-03,
which also looks like the release of 0.9.3. While I'm unable to
find release tags for tcc before 0.9.18 (2003-04-14), the next
release (0.9.28) will include __attribute__((cleanup(func)) which
I rely on.
Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
This change also applies to glibc (where I encounted the problem),
but glibc is a bigger source tree and I'm HW constrained, so I'd
appreciate this change also being applied to glibc.
Thanks. I have copyright assignments on file with the FSF.
ChangeLog | 5 +++++
lib/cdefs.h | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index b7f0310e00..35500be2ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2025-10-30 Eric Wong <normalperson@yhbt.net>
+
+ cdefs: allow __attribute__ on tcc
+ * lib/cdefs.h: Do not ignore __attribute__ on tcc.
+
2025-10-30 Bruno Haible <bruno@clisp.org>
fprintftime: Avoid size_t overflow for very large outputs.
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 2682c092f0..3bfb428511 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -280,7 +280,7 @@
/* GCC and clang have various useful declarations that can be made with
the '__attribute__' syntax. All of the ways we use this do fine if
they are omitted for compilers that don't understand it. */
-#if !(defined __GNUC__ || defined __clang__)
+#if !(defined __GNUC__ || defined __clang__ || defined __TINYC__)
# define __attribute__(xyz) /* Ignore */
#endif
More information about the Libc-alpha
mailing list