[PATCH] libstdc++: testsuite: don't test for __unused
Jonathan Wakely
jwakely.gcc@gmail.com
Sun Jan 25 19:41:18 GMT 2026
On Sun, 25 Jan 2026 at 19:28, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
>
>
> On Sun, 25 Jan 2026, 16:06 Xi Ruoyao, <xry111@xry111.site> wrote:
>>
>> x86_64 glibc has started to use it since the 2.43 release.
>
>
> The correct fix is to #undef it for glibc then. That way it's still defined (and tested) for other targets.
Like this:
--- a/libstdc++-v3/testsuite/17_intro/names.cc
+++ b/libstdc++-v3/testsuite/17_intro/names.cc
@@ -303,8 +303,8 @@
#if defined (__linux__) || defined (__gnu_hurd__)
#if __has_include(<features.h>)
#include <features.h>
-#if __GLIBC__ == 2 && __GLIBC_MINOR__ < 19
-// Glibc defines this prior to 2.19
+#if __GLIBC__ == 2 && (__GLIBC_MINOR__ < 19 || __GLIBC_MINOR__ >= 43)
+// Glibc defines this prior to 2.19 and since 2.43
#undef __unused
#endif
#endif
The change to badnames.cc is OK though.
>
>
>
>>
>> Link: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=b9579342c68b#patch67
>> ---
>> 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 ff590fcdf4d..de4d94faf14 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 106acfa641b..2249735baae 100644
>> --- a/libstdc++-v3/testsuite/17_intro/names.cc
>> +++ b/libstdc++-v3/testsuite/17_intro/names.cc
>> @@ -150,7 +150,7 @@
>> # define __lockable cannot be used as an identifier
>> # define __null_sentinel cannot be used as an identifier
>> # define __packed cannot be used as an identifier
>> -# define __unused cannot be used as an identifier
>> + // __unused (glibc uses this so can't test here)
>> # define __used cannot be used as an identifier
>>
>> #ifndef __APPLE__
>> --
>> 2.52.0
>>
More information about the Gcc-patches
mailing list