]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix broken tests for <complex.h>
authorJonathan Wakely <jwakely@redhat.com>
Mon, 4 Sep 2023 14:23:23 +0000 (15:23 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 11 Nov 2023 00:41:09 +0000 (00:41 +0000)
When I added these tests I gave them .h file extensions, so they've
never been run.

They need to use the no_pch option, so that they only test the
<complex.h> header and don't get <complex> via <bits/stdc++.h>.

libstdc++-v3/ChangeLog:

* testsuite/26_numerics/headers/complex.h/std_c++11.h: Moved to...
* testsuite/26_numerics/headers/complex.h/std_c++11.cc: ...here.
* testsuite/26_numerics/headers/complex.h/std_c++98.h: Moved to...
* testsuite/26_numerics/headers/complex.h/std_c++98.cc: ...here.
Check macro first and then #undef.
* testsuite/26_numerics/headers/complex.h/std_gnu++11.h: Moved to...
* testsuite/26_numerics/headers/complex.h/std_gnu++11.cc: ...here.

libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.cc [moved from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.h with 91% similarity]
libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.cc [moved from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.h with 87% similarity]
libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.cc [moved from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.h with 95% similarity]

similarity index 91%
rename from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.h
rename to libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.cc
index f74b13498d7ae3df579d1033e7cc355aa775c4d6..5cac121816302921c71dd971a989bf29ce977f48 100644 (file)
@@ -15,7 +15,9 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=c++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options strict_std }
+// { dg-add-options no_pch }
 
 #include <complex.h>
 
similarity index 87%
rename from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.h
rename to libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.cc
index 79facef8d5bd2e6465e38ee033ac3c8e2bc227f1..4c9bd6e6a08b5804d28a79006e47f7c15de2da45 100644 (file)
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=c++98" }
+// { dg-do compile { target c++98_only } }
+// { dg-add-options strict_std }
+// { dg-add-options no_pch }
 
 #include <complex.h>
 
-// Should be equivalent to C99 <complex>, not C++ <complex>
+// Should be equivalent to C99 <complex.h>, not C++ <complex>
+#ifndef complex
+# error "'complex' is not defined as a macro by <complex.h> for -std=c++98"
+#endif
 namespace std
 {
+#undef complex
   struct complex;
 }
 
@@ -49,7 +55,3 @@ namespace test
   using ::creal;
 }
 #endif
-
-#ifndef complex
-# error "'complex' is not defined as a macro by <complex.h> for -std=c++98"
-#endif
similarity index 95%
rename from libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.h
rename to libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.cc
index 20c55a5944e5f4693471b5a528778b01d0512ff6..4a6fc00d39095caea9addb207c112d9ceb10473c 100644 (file)
@@ -15,7 +15,8 @@
 // with this library; see the file COPYING3.  If not see
 // <http://www.gnu.org/licenses/>.
 
-// { dg-options "-std=gnu++11" }
+// { dg-do compile { target c++11 } }
+// { dg-add-options no_pch }
 
 #include <complex.h>