]> gcc.gnu.org Git - gcc.git/commitdiff
[PR100127] Test for coroutine header in clang-compatible tests
authorAlexandre Oliva <oliva@adacore.com>
Fri, 3 Mar 2023 04:47:00 +0000 (01:47 -0300)
committerAlexandre Oliva <oliva@gnu.org>
Fri, 3 Mar 2023 05:32:00 +0000 (02:32 -0300)
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.

gcc/testsuite/g++.dg/coroutines/pr100127.C
gcc/testsuite/g++.dg/coroutines/pr100772-a.C
gcc/testsuite/g++.dg/coroutines/pr100772-b.C

index 374cd710077afcbe9ae9de62e106c028d6d99dd0..5879fd0bcc5955672bc15f981feee707c0e0b599 100644 (file)
@@ -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;
index a325d384fc390c2d213ddce3450a05d33536ded4..06e705b0c65a05e4af4da259f23b099de46f9d1a 100644 (file)
@@ -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;
index 6cdf8d1e529e5c7b22c4d157f1955ab06bf9eab3..4ef80a9959490cd4a0e29a64829e331232889f3e 100644 (file)
@@ -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;
This page took 0.063132 seconds and 5 git commands to generate.