This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][gdb] Fix -Wparentheses warnings


On 04/29/2016 04:26 PM, Kyrill Tkachov wrote:
> Hi all,
> 
> I recently moved to using GCC 6.1 and while building a toolchain for arm-none-eabi I got
> 
> some -Werror=parentheses errors while building gdb.
> 
> This patch fixes them. I think this is due to the way ALL_OBJSECTIONS is defined
> 
> (due to using ALL_OBJFILE_OSECTIONS):
> #define ALL_OBJFILE_OSECTIONS(objfile, osect)   \
>   for (osect = objfile->sections; osect < objfile->sections_end; osect++) \
>     if (osect->the_bfd_section == NULL)                                 \
> { \
>         /* Nothing. */                                                 \
> } \
>     else
> 
> 
> so that dangling 'else' probably causes the alarm in GCC.

Bah.  That's written that way exactly to avoid dangling if/else
problems.

I think it'd be reasonable for gcc to not warn when the if/else
came from a macro, as users of the macro can't possibly be confused
in the way the warning intents to help with.  I'd call it a
gcc regression.

> 
> This patch fixes the -Werror errors for me and allows the build to finish successfully.
> 
> 
> Is this ok to commit?

OK.

Thanks,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]