[PATCH v1 25/35] Assume support for the 'unused' attribute on labels

Alejandro Colomar alx@kernel.org
Sun Nov 9 21:53:50 GMT 2025


We already assume that GCC is at least GCC 5,
and we also assume that Clang is at least Clang 4.

It seems to me that Clang added support for this attribute in labels in
Clang 2.9:

llvm.git 9f48354b7127 (2010-09-28; "Don't warn for an unused label if it has 'unused' attribute. Fixes rdar://8483139.")

	$ git describe --contains 9f48354b7127
	llvmorg-2.9.0-rc1~9894

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 include/libc-symbols.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 1f59b69ecf..d8c77eb741 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -815,15 +815,9 @@ for linking")
     GCC -Wunused-parameter.  */
 # define _GL_UNUSED __attribute__ ((__unused__))
 
-/* gcc supports the "unused" attribute on possibly unused labels, and
-   g++ has since version 4.5.  Note to support C++ as well as C,
+/* Note to support C++ as well as C,
    _GL_UNUSED_LABEL should be used with a trailing ;  */
-#if !defined __cplusplus || __GNUC__ > 4 \
-    || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
 # define _GL_UNUSED_LABEL _GL_UNUSED
-#else
-# define _GL_UNUSED_LABEL
-#endif
 
 # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
 
-- 
2.51.0



More information about the Libc-alpha mailing list