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 8fb895a..ac75d95 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 84ba059..1cfafdb 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 f3d91ed..2b1cb1f 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 92518df..159c5c5 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 ae82952..1d95740 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 31048a1..a43e613 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 a3b436d..9a31fb8 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 f7412f6..396f3da 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 c031718..35a03df 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 98f25d8..aaac26e 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 dcf9991..ecfd806 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 7dd1e38..127b812 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 4dfa418..ff845ae 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 6cf99fd..4294279 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 9944ec0..6ffe66c 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 8ade903..e7d78b0 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 52b9509..f07e438 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 0fba21b..08b05dd 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 6b47420..0b61598 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 f3e4b23..22463f4 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 95a738c..c179a58 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 a6e1412..dd39c87 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.