This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug other/70968] New: Missed case for -Wmisleading-indentation


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

            Bug ID: 70968
           Summary: Missed case for -Wmisleading-indentation
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: segher at gcc dot gnu.org
  Target Milestone: ---

Compiling the following with current trunk:

===
void g(int);

void f1(int x)
{
        if (x) {
                g(x--);
        } while (x);
}

void f2(int x)
{
        if (x)
                g(x--);
        while (x);
}

void f3(int x)
{
        if (x) g(x--); while (x);
}
===

(-Wall -W -O2) only warns for f3.  f1 has quite misleading indentation.

A warning for "while (x);" wouldn't hurt either probably, if there is
no whitespace before the semicolon anyway, like in f3.

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