[gcc r14-12620] libstdc++: Don't test for __unused on Glibc targets
Jonathan Wakely
redi@gcc.gnu.org
Thu May 21 12:04:30 GMT 2026
https://gcc.gnu.org/g:0d7fe8a45df5435d91a9cd6e2c7a6010d3fed35c
commit r14-12620-g0d7fe8a45df5435d91a9cd6e2c7a6010d3fed35c
Author: Xi Ruoyao <xry111@xry111.site>
Date: Thu Feb 12 18:46:05 2026 +0000
libstdc++: Don't test for __unused on Glibc targets
x86_64 glibc has started to use it since the 2.43 release, but is
expected to fix it before the 2.44 release.
Link: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b9579342c68b#patch67
libstdc++-v3/ChangeLog:
* testsuite/17_intro/badnames.cc (__unused): Do not define.
* testsuite/17_intro/names.cc [glibc == 2.43] (__unused): Undef.
Co-authored-by: Jonathan Wakely <jwakely@redhat.com>
(cherry picked from commit 1a0b276f69f535244cf8d0983db2ebbc537de536)
Diff:
---
libstdc++-v3/testsuite/17_intro/badnames.cc | 2 +-
libstdc++-v3/testsuite/17_intro/names.cc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/testsuite/17_intro/badnames.cc b/libstdc++-v3/testsuite/17_intro/badnames.cc
index ec76d8e74c0b..df2e8d8ff461 100644
--- a/libstdc++-v3/testsuite/17_intro/badnames.cc
+++ b/libstdc++-v3/testsuite/17_intro/badnames.cc
@@ -67,7 +67,7 @@
// BSD adds:
#define __used __used is a BADNAME
-#define __unused __unused is a BADNAME
+ // __unused (glibc uses this so can't test here)
// __inline (glibc uses this so can't test here)
// _Complex (glibc uses this so can't test here)
#define __istype __istype is a BADNAME
diff --git a/libstdc++-v3/testsuite/17_intro/names.cc b/libstdc++-v3/testsuite/17_intro/names.cc
index 5b4ad97c724f..b6b833c6255c 100644
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -291,7 +291,7 @@
#if defined (__linux__) || defined (__gnu_hurd__)
#if __has_include(<features.h>)
#include <features.h>
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 19
+#if __GLIBC__ == 2 && (__GLIBC_MINOR__ < 19 || __GLIBC_MINOR__ == 43)
// Glibc defines this prior to 2.19
#undef __unused
#endif
More information about the Libstdc++-cvs
mailing list