On Tue, Nov 25, 2025 at 10:21:45AM +0100, Rainer Orth wrote:
> The g++.dg/DRs/dr2581-?.C tests FAIL on several targets in two ways:
> 
> * Both tests FAIL on a couple of targets in the same way:
> 
> FAIL: g++.dg/DRs/dr2581-1.C  -std=c++11  (test for warnings, line 25)
> FAIL: g++.dg/DRs/dr2581-1.C  -std=c++17  (test for warnings, line 25)
> FAIL: g++.dg/DRs/dr2581-1.C  -std=c++20  (test for warnings, line 25)
> FAIL: g++.dg/DRs/dr2581-1.C  -std=c++23  (test for warnings, line 25)
> FAIL: g++.dg/DRs/dr2581-1.C  -std=c++26  (test for warnings, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++11  (test for errors, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++14  (test for errors, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++17  (test for errors, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++20  (test for errors, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++23  (test for errors, line 25)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++26  (test for errors, line 25)
> 
>   i.e. the __STDC_ISO_10646__ warning is missing.  This happens on
>   Solaris, FreeBSD, Darwin, and several embedded targets.  While
>   __STDC_ISO_10646__ already exists in C99, it's optional there and
>   seems to be only defined on Linux/glibc.  Thus this patch xfail's this
>   check on non-Linux.
> 
> * Besides, on Solaris only there are more failures for -std=c++11 to
>   c++26, like
> 
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++11  (test for warnings, line 24)
> FAIL: g++.dg/DRs/dr2581-2.C  -std=c++11 (test for excess errors)
> 
> Excess errors:
> g++.dg/DRs/dr2581-2.C:24:9: error: '__STDC_VERSION__' redefined
> 
>   This happens because g++ always predefines __STDC_VERSION__ on
>   Solaris, so this patch expects an error instead of a warning here.
> 
> Tested on i386-pc-solaris2.11, sparc-sun-solaris2.11,
> x86_64-apple-darwin25.1.0, and x86_64-pc-linux-gnu.
> 
> Ok for trunk.

LGTM, thanks.

> 2025-11-20  Rainer Orth  <[email protected]>
> 
>       gcc/testsuite:
>       * g++.dg/DRs/dr2581-1.C (__STDC_ISO_10646__): xfail on non-Linux.
>       * g++.dg/DRs/dr2581-2.C: Likewise.
>         (__STDC_VERSION__): Expect error instead of warning on Solaris.
> 

> # HG changeset patch
> # Parent  5dcb3264e1607dbb06bddbd11f6a56260ec97f7e
> testsuite: XFAIL g++.dg/DRs/dr2581-1.C etc. on non-Linux
> 
> diff --git a/gcc/testsuite/g++.dg/DRs/dr2581-1.C 
> b/gcc/testsuite/g++.dg/DRs/dr2581-1.C
> --- a/gcc/testsuite/g++.dg/DRs/dr2581-1.C
> +++ b/gcc/testsuite/g++.dg/DRs/dr2581-1.C
> @@ -22,7 +22,7 @@
>  #undef __STDC__                              // { dg-warning "undefining 
> '__STDC__'" }
>  #undef __STDC_MB_MIGHT_NEQ_WC__              // { dg-warning "undefining 
> '__STDC_MB_MIGHT_NEQ_WC__'" "" { target c++11 } }
>  #undef __STDC_VERSION__                      // { dg-warning "undefining 
> '__STDC_VERSION__'" "" { target c++11 } }
> -#undef __STDC_ISO_10646__            // { dg-warning "undefining 
> '__STDC_ISO_10646__'" }
> +#undef __STDC_ISO_10646__            // { dg-warning "undefining 
> '__STDC_ISO_10646__'" "" { xfail { ! *-*-linux* } } }
>  #undef __STDCPP_THREADS__            // { dg-warning "undefining 
> '__STDCPP_THREADS__'" "" { target c++11 } }
>  #undef __STDCPP_STRICT_POINTER_SAFETY__      // { dg-warning "undefining 
> '__STDCPP_STRICT_POINTER_SAFETY__'" "" { target { c++11 && c++20_down } } }
>  #undef __cpp_aggregate_bases         // { dg-warning "undefining 
> '__cpp_aggregate_bases'" "" { target c++20 } }
> diff --git a/gcc/testsuite/g++.dg/DRs/dr2581-2.C 
> b/gcc/testsuite/g++.dg/DRs/dr2581-2.C
> --- a/gcc/testsuite/g++.dg/DRs/dr2581-2.C
> +++ b/gcc/testsuite/g++.dg/DRs/dr2581-2.C
> @@ -21,8 +21,9 @@
>  #define __TIME__                             // { dg-error "'__TIME__' 
> redefined" }
>  #define __STDC__                             // { dg-error "'__STDC__' 
> redefined" }
>  #define __STDC_MB_MIGHT_NEQ_WC__             // { dg-warning 
> "'__STDC_MB_MIGHT_NEQ_WC__' defined" "" { target c++11 } }
> -#define __STDC_VERSION__                     // { dg-warning 
> "'__STDC_VERSION__' defined" "" { target c++11 } }
> -#define __STDC_ISO_10646__                   // { dg-error 
> "'__STDC_ISO_10646__' redefined" }
> +#define __STDC_VERSION__                     // { dg-warning 
> "'__STDC_VERSION__' defined" "" { target { c++11 && { ! *-*-solaris2* } } } }
> +                                             // { dg-error 
> "'__STDC_VERSION__' redefined" "" { target *-*-solaris2* } .-1 }
> +#define __STDC_ISO_10646__                   // { dg-error 
> "'__STDC_ISO_10646__' redefined" "" { xfail { ! *-*-linux* } } }
>  #define __STDCPP_THREADS__                   // { dg-message 
> "'__STDCPP_THREADS__' (?:re)?defined" "" { target c++11 } }
>  #define __STDCPP_STRICT_POINTER_SAFETY__     // { dg-warning 
> "'__STDCPP_STRICT_POINTER_SAFETY__' defined" "" { target { c++11 && 
> c++20_down } } }
>  #define __cpp_aggregate_bases 201603L                // { dg-error 
> "'__cpp_aggregate_bases' redefined" "" { target c++20 } }


        Jakub

Reply via email to