public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-5348] libstdc++: Fix broken tests for <complex.h>
Date: Sat, 11 Nov 2023 00:44:19 +0000 (GMT)	[thread overview]
Message-ID: <20231111004419.4E9B0382BC02@sourceware.org> (raw)

https://gcc.gnu.org/g:7c02efd45f5e727ab8a1b397bce8817f4ab65954

commit r14-5348-g7c02efd45f5e727ab8a1b397bce8817f4ab65954
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Sep 4 15:23:23 2023 +0100

    libstdc++: Fix broken tests for <complex.h>
    
    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.

Diff:
---
 .../headers/complex.h/{std_c++11.h => std_c++11.cc}        |  4 +++-
 .../headers/complex.h/{std_c++98.h => std_c++98.cc}        | 14 ++++++++------
 .../headers/complex.h/{std_gnu++11.h => std_gnu++11.cc}    |  3 ++-
 3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.h b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.cc
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 f74b13498d7..5cac1218163 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.h
+++ b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++11.cc
@@ -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>
 
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.h b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.cc
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 79facef8d5b..4c9bd6e6a08 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.h
+++ b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_c++98.cc
@@ -15,13 +15,19 @@
 // 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
diff --git a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.h b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.cc
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 20c55a5944e..4a6fc00d390 100644
--- a/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.h
+++ b/libstdc++-v3/testsuite/26_numerics/headers/complex.h/std_gnu++11.cc
@@ -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>

                 reply	other threads:[~2023-11-11  0:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231111004419.4E9B0382BC02@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).