libstdc++: Require c++98_only effective target for some tests
authorJonathan Wakely <jwakely@redhat.com>
Thu, 2 Jul 2020 20:27:12 +0000 (21:27 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 2 Jul 2020 20:27:12 +0000 (21:27 +0100)
These tests verify that including C++11 headers fails to compile in
C++98 mode. They use { dg-options "-std=gnu++98" } so that they are
explicitly run in C++98 mode. This change also adds a target selector so
that the tests will be skipped even if the dg-options directive is
filtered out or overridden. This is in preparation for a desired future
change where tests do not use -std options, so that they can be tested
with e.g. --target_board=unix\"{-std=gnu++17,-std=gnu++20}\"

In some cases the dg-options and dg-do directives need to be reordered,
so that the -std=gnu++98 option is already added to the options before
the target selector is checked.

libstdc++-v3/ChangeLog:

* testsuite/18_support/headers/cstdalign/std_c++0x_neg.cc: Add
c++98_only target selector.
* testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc:
Likewise.
* testsuite/18_support/headers/cstdint/std_c++0x_neg.cc:
Likewise.
* testsuite/18_support/headers/new/synopsis_cxx98.cc: Likewise.
* testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc:
Likewise.
* testsuite/20_util/headers/type_traits/std_c++0x_neg.cc:
Likewise.
* testsuite/23_containers/headers/array/std_c++0x_neg.cc:
Likewise.
* testsuite/23_containers/headers/tuple/std_c++0x_neg.cc:
Likewise.
* testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc:
Likewise.
* testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc:
Likewise.
* testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc:
Likewise.
* testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc:
Likewise.
* testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc:
Likewise.
* testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc:
Likewise.
* testsuite/26_numerics/headers/random/std_c++0x_neg.cc:
Likewise.
* testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc: Likewise.
* testsuite/28_regex/headers/regex/std_c++0x_neg.cc: Likewise.
* testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc:
Likewise.
* testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc:
Likewise.
* testsuite/30_threads/headers/future/std_c++0x_neg.cc:
Likewise.
* testsuite/30_threads/headers/mutex/std_c++0x_neg.cc: Likewise.
* testsuite/30_threads/headers/thread/std_c++0x_neg.cc:
Likewise.

22 files changed:
libstdc++-v3/testsuite/18_support/headers/cstdalign/std_c++0x_neg.cc
libstdc++-v3/testsuite/18_support/headers/cstdbool/std_c++0x_neg.cc
libstdc++-v3/testsuite/18_support/headers/cstdint/std_c++0x_neg.cc
libstdc++-v3/testsuite/18_support/headers/new/synopsis_cxx98.cc
libstdc++-v3/testsuite/19_diagnostics/headers/system_error/std_c++0x_neg.cc
libstdc++-v3/testsuite/20_util/headers/type_traits/std_c++0x_neg.cc
libstdc++-v3/testsuite/23_containers/headers/array/std_c++0x_neg.cc
libstdc++-v3/testsuite/23_containers/headers/tuple/std_c++0x_neg.cc
libstdc++-v3/testsuite/23_containers/headers/unordered_map/std_c++0x_neg.cc
libstdc++-v3/testsuite/23_containers/headers/unordered_set/std_c++0x_neg.cc
libstdc++-v3/testsuite/26_numerics/headers/ccomplex/std_c++0x_neg.cc
libstdc++-v3/testsuite/26_numerics/headers/cfenv/std_c++0x_neg.cc
libstdc++-v3/testsuite/26_numerics/headers/cmath/c99_classification_macros_c++98.cc
libstdc++-v3/testsuite/26_numerics/headers/ctgmath/std_c++0x_neg.cc
libstdc++-v3/testsuite/26_numerics/headers/random/std_c++0x_neg.cc
libstdc++-v3/testsuite/27_io/headers/cinttypes/std_c++0x_neg.cc
libstdc++-v3/testsuite/28_regex/headers/regex/std_c++0x_neg.cc
libstdc++-v3/testsuite/29_atomics/headers/atomic/std_c++0x_neg.cc
libstdc++-v3/testsuite/30_threads/headers/condition_variable/std_c++0x_neg.cc
libstdc++-v3/testsuite/30_threads/headers/future/std_c++0x_neg.cc
libstdc++-v3/testsuite/30_threads/headers/mutex/std_c++0x_neg.cc
libstdc++-v3/testsuite/30_threads/headers/thread/std_c++0x_neg.cc

index 8fb895a2133db487803ba0b1339bd02dc4d39e3e..ac75d95228bc1702f6db4282bb79af4b70ec1949 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2011-2020 Free Software Foundation, Inc.
 //
index 84ba059b219f922508a3c7a1c669d275cc1485b0..1cfafdbdd548dd7034acfebcbb37a8b56cfaabee 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index f3d91edfd08dc9500092f925dce2e549089f7794..2b1cb1f4788599df1f313bb8a3f773544df93cfb 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 92518df3453c2f333345290a2000fd87bc76b38c..159c5c54defd21e755e178daae32d8792e72f4e8 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-options "-std=gnu++98" }
-// { dg-do compile }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index ae82952a29e10a6ee45e6b2af9efe9da7762d5f4..1d95740c89d0f064e8bd87ddbf60c9e193e26ee3 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 31048a1c85c197e6f10d7dbfbd3f184a708d250b..a43e61335512cd60052ec8ee4d4154f799467ce0 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index a3b436d6a85b919ae9824d4c10fc5e93e686f53c..9a31fb8e2e32d454725068b0fd496f9d07300102 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index f7412f685c1bcf183b53605ee7714a884ec19262..396f3da136641cad48b998e43013284535fe9b0e 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index c0317186d6a8c44455907f73112e228f992f6f52..35a03df8869a139f5bae355c427df5d08e697af2 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 98f25d8d4e6171da3803dada82320bc380df988f..aaac26e6d248f90e7787ff956522d68e4619178d 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index dcf99911b662867ca88211a601815d593a121366..ecfd806116aa9591feea39bb160955cd3214c0c9 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 7dd1e386a589a932e703179921ccc4dfe9096911..127b81226d39419ea4673f83864fce0569b3cc53 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 4dfa418df9d963691c08f8703ba675ba28cf6d7a..ff845ae25b08def81f2b36782a5f7ecd73999f25 100644 (file)
@@ -18,7 +18,7 @@
 // <http://www.gnu.org/licenses/>.
 
 // { dg-options "-std=gnu++98" }
-// { dg-do compile }
+// { dg-do compile { target c++98_only } }
 // { dg-excess-errors "" { target uclibc } }
 
 #include <cmath>
@@ -55,7 +55,7 @@ template <typename _Tp>
     fp_type f1 = 1.0;
     fp_type f2 = 3.0;
     int res = 0;
-    
+
     res = std::fpclassify(f1);
     res = std::isfinite(f2);
     res = std::isinf(f1);
index 6cf99fd15a20587205d80d6c5ba4462ba8ed5da7..42942798e1fe1caa973d9841a8e1bc6a961f1bb3 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 9944ec09f1e3216bb0dea81854b06c8ba022e2ec..6ffe66c74070e530d170035bc5ea0e30dbed8165 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 8ade9030f28fde144eb050e03bc6fedca343c835..e7d78b0498f0d47e8b7d9cc3fdace25f53dc61d2 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 52b9509fb03eb01c4d8b81f8a0d15c8e7fa58cc8..f07e4385dd97ca1efccbdf59223842209d0f7953 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2007-2020 Free Software Foundation, Inc.
 //
index 0fba21b6fde273c69989dba311c48156896c5bac..08b05ddd0ffcd6c9398a39331e3e0cd3f9d84ff5 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2008-2020 Free Software Foundation, Inc.
 //
index 6b47420ab6771ff441ae75a984fde87059a6fd46..0b615988a77a2b4ba9705b02b2dc0166c1aa54f3 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2008-2020 Free Software Foundation, Inc.
 //
index f3e4b23a2360937746b65f70e766779d75dc8554..22463f4bc55dab11594c91fb53d70a104b442086 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2009-2020 Free Software Foundation, Inc.
 //
index 95a738ca6cda7d4ed1729ee4818f61d6f9c6f03c..c179a5887f33029a812feb273c326470e8e4e7cc 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 
 // Copyright (C) 2008-2020 Free Software Foundation, Inc.
 //
index a6e14124143b643ad56838b2722c7286f12b6ce7..dd39c87bea2dbf12422fac00371195d8e21adaf9 100644 (file)
@@ -1,5 +1,5 @@
-// { dg-do compile }
 // { dg-options "-std=gnu++98" }
+// { dg-do compile { target c++98_only } }
 // { dg-require-gthreads "" }
 
 // Copyright (C) 2008-2020 Free Software Foundation, Inc.