This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70922] -Wparentheses warning should not complain about if-else from macro expansion
- From: "palves at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 May 2016 18:58:48 +0000
- Subject: [Bug c++/70922] -Wparentheses warning should not complain about if-else from macro expansion
- Auto-submitted: auto-generated
- References: <bug-70922-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70922
--- Comment #16 from Pedro Alves <palves at redhat dot com> ---
(In reply to Manuel LÃpez-IbÃÃez from comment #15)
> But I can see that one may wrongly write:
>
> void bar(int x)
> {
> if (x)
> MACRO_WITH_ELSE(x)
> if(!x)
> return;
> }
>
> and not be aware that the macro changes the meaning of the following 'if'.
This could also be sorted out with indentation level tracking -- the if binds
to the else in the macro, but it is not indented as one would expect if it was
meant to.