public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-6437] [PR100127] Test for coroutine header in clang-compatible tests
Date: Fri,  3 Mar 2023 05:36:27 +0000 (GMT)	[thread overview]
Message-ID: <20230303053627.5AB533858416@sourceware.org> (raw)

https://gcc.gnu.org/g:1e4122f1159ace52c114c011013adce25172d77b

commit r13-6437-g1e4122f1159ace52c114c011013adce25172d77b
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Fri Mar 3 01:47:00 2023 -0300

    [PR100127] Test for coroutine header in clang-compatible tests
    
    The test is compatible with clang as well as gcc, but ISTM that
    testing for the __clang__ macro is just as potentially error-prone as
    macros that used to be GCC-specific are now defined in compilers that
    aim for GCC compatibility.  Use a __has_include feature test instead.
    
    
    for  gcc/testsuite/ChangeLog
    
            PR c++/100127
            * g++.dg/coroutines/pr100127.C: Test for header rather than
            compiler macro.
            * g++.dg/coroutines/pr100772-a.C: Likewise.
            * g++.dg/coroutines/pr100772-b.C: Likewise.

Diff:
---
 gcc/testsuite/g++.dg/coroutines/pr100127.C   | 3 ++-
 gcc/testsuite/g++.dg/coroutines/pr100772-a.C | 3 ++-
 gcc/testsuite/g++.dg/coroutines/pr100772-b.C | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/testsuite/g++.dg/coroutines/pr100127.C b/gcc/testsuite/g++.dg/coroutines/pr100127.C
index 374cd710077..5879fd0bcc5 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr100127.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr100127.C
@@ -1,4 +1,5 @@
-#ifdef __clang__
+#if !__has_include(<coroutine>) \
+  && __has_include(<experimental/coroutine>) // for __clang__
 #include <experimental/coroutine>
 namespace std {
   using namespace std::experimental;
diff --git a/gcc/testsuite/g++.dg/coroutines/pr100772-a.C b/gcc/testsuite/g++.dg/coroutines/pr100772-a.C
index a325d384fc3..06e705b0c65 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr100772-a.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr100772-a.C
@@ -1,5 +1,6 @@
 //  { dg-additional-options "-fsyntax-only " }
-#ifdef __clang__
+#if !__has_include(<coroutine>) \
+  && __has_include(<experimental/coroutine>) // for __clang__
 #include <experimental/coroutine>
 namespace std {
   using namespace std::experimental;
diff --git a/gcc/testsuite/g++.dg/coroutines/pr100772-b.C b/gcc/testsuite/g++.dg/coroutines/pr100772-b.C
index 6cdf8d1e529..4ef80a99594 100644
--- a/gcc/testsuite/g++.dg/coroutines/pr100772-b.C
+++ b/gcc/testsuite/g++.dg/coroutines/pr100772-b.C
@@ -1,4 +1,5 @@
-#ifdef __clang__
+#if !__has_include(<coroutine>) \
+  && __has_include(<experimental/coroutine>) // for __clang__
 #include <experimental/coroutine>
 namespace std {
   using namespace std::experimental;

                 reply	other threads:[~2023-03-03  5:36 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=20230303053627.5AB533858416@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-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).