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 preprocessor/71637] New: -Wmisleading-indentation only triggered when using integrated cpp


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

            Bug ID: 71637
           Summary: -Wmisleading-indentation only triggered when using
                    integrated cpp
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: megahallon at gmail dot com
  Target Milestone: ---

The following program:

---
#define m(x) ({ int y; if (x) y=0; else y=1; y; })

int main()
{
  int x =
    m(0);
  return x;
}

---

compiled with:

gcc -ftrack-macro-expansion=0 -Wmisleading-indentation test.c

Gives a warning:

test.c:6:5: warning: this âelseâ clause does not guard...
[-Wmisleading-indentation]
     m(0);
     ^

Which is possibly as expected given no macro expansion tracking, however when
trying to check the output with -save-temps (or using -no-integrated-cpp) the
warning is not issued making it difficult to understand what is going on.

This is extra confusing when using ccache (or similar system working on
preprocessed files) and -Werror as a ccache build will work, while not using
ccache will fail. By the way, ccache is also the reason to use
-ftrack-macro-expansion=0, see bug 60014.

gcc version 6.1.1 20160620 (Debian 6.1.1-7)

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