public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <idsandoe@googlemail.com>
To: Alexandre Oliva <oliva@adacore.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	"ro@cebitec.uni-bielefeld.de" <ro@CeBiTec.Uni-Bielefeld.DE>,
	Mike Stump <mikestump@comcast.net>,
	Jason Merrill <jason@redhat.com>, Nathan Sidwell <nathan@acm.org>
Subject: Re: [PR100127] Test for coroutine header in clang-compatible tests
Date: Fri, 17 Feb 2023 13:17:33 +0000	[thread overview]
Message-ID: <A7440DB8-3461-496F-937E-B5C79F9EAB4C@googlemail.com> (raw)
In-Reply-To: <ora61cu71u.fsf@lxoliva.fsfla.org>

Hi,

> On 17 Feb 2023, at 06:42, Alexandre Oliva via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> 
> 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.

It remains useful to be able to check tests on both compilers.

As a matter of interest, do you know of any other compiler claiming “__clang__” (I have
treated that as safe so far).

>  Use a __has_include feature test instead.

I think we need to do

#if __has_include(<coroutine>)
…
#elif __has_include(<experimental/coroutine>)
…

because newer clang has the include in the standard place.
Iain

> 
> Regstrapped on x86_64-linux-gnu.
> Tested on arm-vxworks7 (gcc-12) and arm-eabi (trunk).  Ok to install?
> 
> for  gcc/testsuite/ChangeLog
> 
> 	PR c++/100127
> 	* g++.dg/coroutines/pr100127.C: Test for header rather than
> 	compiler macro.
> ---
> gcc/testsuite/g++.dg/coroutines/pr100127.C   |    2 +-
> gcc/testsuite/g++.dg/coroutines/pr100772-a.C |    2 +-
> gcc/testsuite/g++.dg/coroutines/pr100772-b.C |    2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/gcc/testsuite/g++.dg/coroutines/pr100127.C b/gcc/testsuite/g++.dg/coroutines/pr100127.C
> index 374cd710077af..1eaa72ff0acdd 100644
> --- a/gcc/testsuite/g++.dg/coroutines/pr100127.C
> +++ b/gcc/testsuite/g++.dg/coroutines/pr100127.C
> @@ -1,4 +1,4 @@
> -#ifdef __clang__
> +#if __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 a325d384fc390..724c377c82e5b 100644
> --- a/gcc/testsuite/g++.dg/coroutines/pr100772-a.C
> +++ b/gcc/testsuite/g++.dg/coroutines/pr100772-a.C
> @@ -1,5 +1,5 @@
> //  { dg-additional-options "-fsyntax-only " }
> -#ifdef __clang__
> +#if __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 6cdf8d1e529e5..4cf31e5f9e0c2 100644
> --- a/gcc/testsuite/g++.dg/coroutines/pr100772-b.C
> +++ b/gcc/testsuite/g++.dg/coroutines/pr100772-b.C
> @@ -1,4 +1,4 @@
> -#ifdef __clang__
> +#if __has_include(<experimental/coroutine>) // for __clang__
> #include <experimental/coroutine>
> namespace std {
>   using namespace std::experimental;
> 
> -- 
> Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
>   Free Software Activist                       GNU Toolchain Engineer
> Disinformation flourishes because many people care deeply about injustice
> but very few check the facts.  Ask me about <https://stallmansupport.org>


  reply	other threads:[~2023-02-17 13:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17  6:42 Alexandre Oliva
2023-02-17 13:17 ` Iain Sandoe [this message]
2023-02-22 20:04   ` Alexandre Oliva
2023-02-27 18:44     ` Mike Stump

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=A7440DB8-3461-496F-937E-B5C79F9EAB4C@googlemail.com \
    --to=idsandoe@googlemail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=nathan@acm.org \
    --cc=oliva@adacore.com \
    --cc=ro@CeBiTec.Uni-Bielefeld.DE \
    /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).