From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2140) id 41EF43858C5E; Wed, 22 Feb 2023 17:23:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41EF43858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677086635; bh=PDSuZkYCPfnJnq5Nh3pGK/S0FflSnbYuueOPg9UH/8c=; h=From:To:Subject:Date:From; b=t//RUK4EW1lqx1uuDyhBcz+KhN/1gaabU+xUtWetWUv9RGBWUdY1EoOoHsw66dnYd IT5nEPaN8nXKLrwvYlCL2x4EAVBHXYjg57mRxLQXMwriBA+INDirK7DwZQzRVLjpDT vaC0aZgo3q7q4dpeaIWVH9e9ZKejDbiyFil5Wyx8= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Alexandre Oliva To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/aoliva/heads/testme)] [PR100127] Test for coroutine header in clang-compatible tests X-Act-Checkin: gcc X-Git-Author: Alexandre Oliva X-Git-Refname: refs/users/aoliva/heads/testme X-Git-Oldrev: f62e89fd7a4b182eb554e05d17ad558426d399b1 X-Git-Newrev: b1da436e929a6219c1bb4962463e5c6877cd36af Message-Id: <20230222172355.41EF43858C5E@sourceware.org> Date: Wed, 22 Feb 2023 17:23:55 +0000 (GMT) List-Id: https://gcc.gnu.org/g:b1da436e929a6219c1bb4962463e5c6877cd36af commit b1da436e929a6219c1bb4962463e5c6877cd36af Author: Alexandre Oliva Date: Thu Feb 16 06:52: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. 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() \ + && __has_include() // for __clang__ #include 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() \ + && __has_include() // for __clang__ #include 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() \ + && __has_include() // for __clang__ #include namespace std { using namespace std::experimental;