public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>, Alex Coplan <alex.coplan@arm.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] c++: Fix up __has_extension (cxx_init_captures)
Date: Tue, 28 Nov 2023 12:08:19 -0500	[thread overview]
Message-ID: <9298a09d-bda2-4a7b-a7e2-b40087fcda39@redhat.com> (raw)
In-Reply-To: <ZWWjN0dxBKkIod2F@tucnak>

On 11/28/23 03:22, Jakub Jelinek wrote:
> On Mon, Nov 27, 2023 at 10:58:04AM +0000, Alex Coplan wrote:
>> Many thanks both for the reviews, this is now pushed (with Jason's
>> above changes implemented) as g:06280a906cb3dc80cf5e07cf3335b758848d488d.
> 
> The new test FAILs everywhere with GXX_TESTSUITE_STDS=98,11,14,17,20,2b
> I'm normally using for testing.
> FAIL: g++.dg/ext/has-feature.C  -std=gnu++11 (test for excess errors)
> Excess errors:
> /home/jakub/src/gcc/gcc/testsuite/g++.dg/ext/has-feature.C:185:2: error: #error
> 
> This is on
> #if __has_extension (cxx_init_captures) != CXX11
> #error
> #endif
> Comparing the values with clang++ on godbolt and with what is actually
> implemented:
> void foo () { auto a = [b = 3]() { return b; }; }
> both clang++ and GCC implement init captures as extension already in C++11
> (and obviously not in C++98 because lambdas aren't implemented there),
> unless -pedantic-errors/-Werror=pedantic, so I think we should change
> the FE to match the test rather than the other way around.
> 
> Tested on x86_64-linux with
> GXX_TESTSUITE_STDS=98,11,14,17,20,23,26 make check-g++ RUNTESTFLAGS="--target_board=unix\{-m32,-m64\} dg.exp='has-feature.C'"
> Ok for trunk?

OK.

> Making __has_extension return __has_feature for -pedantic-errors and not
> for -Werror=pedantic is just weird, 

I think -Werror=pedantic is mostly useless as it doesn't affect pedwarns 
that use other -W options.  Though -pedantic-errors -Wno-error=pedantic 
does seem useful, to error on just the pedwarns that are on by default.

Jason


  parent reply	other threads:[~2023-11-28 17:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-17 14:50 [PATCH v5] c-family: Implement __has_feature and __has_extension [PR60512] Alex Coplan
2023-11-20 22:29 ` Jason Merrill
2023-11-23 17:41   ` Marek Polacek
2023-11-27 10:58     ` Alex Coplan
2023-11-28  8:22       ` [PATCH] c++: Fix up __has_extension (cxx_init_captures) Jakub Jelinek
2023-11-28 16:45         ` Alex Coplan
2023-11-28 17:12           ` Jakub Jelinek
2023-11-28 17:18             ` Jason Merrill
2023-11-28 17:08         ` Jason Merrill [this message]
2023-11-28 16:03 ` [PATCH v5] c-family: Implement __has_feature and __has_extension [PR60512] Thomas Schwinge
2023-11-28 16:53   ` Alex Coplan
2023-11-28 17:08   ` Jason Merrill

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=9298a09d-bda2-4a7b-a7e2-b40087fcda39@redhat.com \
    --to=jason@redhat.com \
    --cc=alex.coplan@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).