public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marek Polacek <polacek@redhat.com>, Jonathan Wakely <jwakely@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] c++: Implement -Wdangling-reference [PR106393]
Date: Tue, 25 Oct 2022 11:39:31 -0400	[thread overview]
Message-ID: <94b6bf22-bf2c-f6c0-3ac6-ca2c89bfde2e@redhat.com> (raw)
In-Reply-To: <Y1fhLvbj9Vhu6wDF@redhat.com>

On 10/25/22 09:14, Marek Polacek wrote:
> On Tue, Oct 25, 2022 at 12:34:50PM +0100, Jonathan Wakely wrote:
>> On Mon, 24 Oct 2022 at 18:30, Jason Merrill wrote:
>>>
>>> On 10/21/22 19:28, Marek Polacek wrote:
>>>> When testing a previous version of the patch, there were many FAILs in
>>>> libstdc++'s 22_locale/; all of them because the warning triggered on
>>>>
>>>>     const test_type& obj = std::use_facet<test_type>(std::locale());
>>>>
>>>> but this code looks valid -- std::use_facet doesn't return a reference
>>>> to its parameter.  Therefore I added code to suppress the warning when
>>>> the call is std::use_facet.  Now 22_locale/* pass even with the warning
>>>> on.  We could exclude more std:: functions like this if desirable.
>>>
>>> Instead of adding special cases in the compiler, let's disable the
>>> warning around the definition of use_facet (and adjust the compiler as
>>> needed so that avoids the warning).
>>
>> I assume you mean using #pragma here. If we disable it around the
>> definition of use_facet, will that disable it for callers of
>> use_facet, or only within the definition of use_facet itself?
> 
> Right, a #pragma will not help, it would only disable the warning
> within the definition of use_facet itself.

That's why I mentioned adjusting the compiler, i.e. check 
warning_enabled_at (DECL_SOURCE_LOCATION (fn)

Jason


  reply	other threads:[~2022-10-25 15:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 23:28 Marek Polacek
2022-10-24 17:30 ` Jason Merrill
2022-10-25 11:34   ` Jonathan Wakely
2022-10-25 13:14     ` Marek Polacek
2022-10-25 15:39       ` Jason Merrill [this message]
2022-10-25 16:35         ` Marek Polacek
2022-10-25 15:21   ` [PATCH v2] " Marek Polacek
2022-10-25 15:53     ` Jason Merrill
2022-10-26 16:10       ` [PATCH v3] " Marek Polacek
2022-10-26 16:42         ` Jason Merrill
2022-10-26 18:26           ` [PATCH v4] " Marek Polacek
2022-10-26 18:42             ` Jason Merrill
2022-10-25 11:50 ` [PATCH] " Jonathan Wakely
2022-10-25 15:24   ` Marek Polacek

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=94b6bf22-bf2c-f6c0-3ac6-ca2c89bfde2e@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --cc=polacek@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).