On 3/13/22 19:43, Zhao Wei Liew wrote:
On Sat, 12 Mar 2022 at 06:15, Jason Merrill <ja...@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