diff options
author | Alexandre Oliva <oliva@adacore.com> | 2023-03-03 01:47:00 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2023-03-03 02:32:00 -0300 |
commit | 1e4122f1159ace52c114c011013adce25172d77b (patch) | |
tree | 1c39d2d30ad0799d28dbc0d1376117fac57075d6 /gcc | |
parent | ddf7411e2069c33f56541eab35c37558199f3c41 (diff) | |
download | gcc-1e4122f1159ace52c114c011013adce25172d77b.zip gcc-1e4122f1159ace52c114c011013adce25172d77b.tar.gz gcc-1e4122f1159ace52c114c011013adce25172d77b.tar.bz2 |
[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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/coroutines/pr100127.C | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/coroutines/pr100772-a.C | 3 | ||||
-rw-r--r-- | 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 374cd71..5879fd0 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 a325d38..06e705b 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 6cdf8d1..4ef80a9 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; |