public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Zhao Wei Liew <zhaoweiliew@gmail.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH v7] c++: Add diagnostic when operator= is used as truth cond [PR25689]
Date: Thu, 24 Mar 2022 18:12:51 -0400	[thread overview]
Message-ID: <32aab126-bd7a-08ce-431e-0f00325c7760@redhat.com> (raw)
In-Reply-To: <CALHvHFVRz1pc4zT7DnOs+ZkyhxmmttmnJ+rWQYaiBWhzbR37tw@mail.gmail.com>

On 3/13/22 19:43, Zhao Wei Liew wrote:
> On Sat, 12 Mar 2022 at 06:15, Jason Merrill <jason@redhat.com> wrote:
>> It looks good, but unfortunately regresses some other warning tests,
>> such as Wnonnull5.C.  Please remember to run the regression tests before
>> sending a patch (https://gcc.gnu.org/contribute.html#testing).
>>
>> This seems to be a complicated problem with suppress_warning, which
>> means your call to suppress_warning effectively silences all later
>> warnings, not just -Wparentheses.
>>
>> You should be able to work around this issue by only calling
>> suppress_warning in the specific case we're interested in, i.e. when
>> warn_parentheses is enabled and "call" is a MODIFY_EXPR.
> 
> My apologies. I've fixed the issue as you suggested and run the regression tests
> to ensure no test regressions. The new patch (v9) is attached.

Looks good.  One thing:

> +	/* Ideally, we'd warn for empty classes using trivial operator= (below),
> +	   but we don't do so yet as it is a non-trivial COMPOUND_EXPR. */
> +	// if (a1 = a2); 

It would be better to uncomment this line and give it an xfailed 
warning, i.e.

/* { dg-warning "suggest parentheses" "" { xfail *-*-* } } */

I've made this change and added the patch to my queue to commit when GCC 
13 stage 1 opens, probably next month.

Thanks!

Jason


      reply	other threads:[~2022-03-24 22:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-16  7:16 Zhao Wei Liew
2022-02-16 16:59 ` Jason Merrill
2022-02-18  0:32   ` Zhao Wei Liew
2022-02-18  3:30     ` Zhao Wei Liew
2022-03-11 22:15       ` Jason Merrill
2022-03-13 23:43         ` Zhao Wei Liew
2022-03-24 22:12           ` Jason Merrill [this message]

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=32aab126-bd7a-08ce-431e-0f00325c7760@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=zhaoweiliew@gmail.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).