https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70922

--- Comment #8 from Pedro Alves <palves at redhat dot com> ---
- There's exactly the same number of ifs and elses in the macro.
- The indentation of the else matches that of the if.
- There's actually no "else" at all at the macro call site, making the warning
look odd.

So, IMO, we want to warn about this:

#define ALL_OBJFILE_OSECTIONS(objfile, osect)   \
  for (osect = sections; osect < sections_end; osect++) \
    if (osect->the_bfd_section != 0)                                    \

and this:

#define ALL_OBJFILE_OSECTIONS(objfile, osect)   \
  for (osect = sections; osect < sections_end; osect++) \
    if (osect->the_bfd_section != 0)                                    \
      if (whatever != 0)                                        \

Because this would do the wrong thing:

  if (condition)
    ALL_OBJFILE_OSECTIONS (o, osect)
  else
    return 0;


But not this:

#define ALL_OBJFILE_OSECTIONS(objfile, osect)   \
  for (osect = sections; osect < sections_end; osect++) \
    if (osect->the_bfd_section != 0)                                    \
      {                                                                 \
        /* Nothing.  */                                                 \
      }                                                                 \
    else

Reply via email to