[Bug c/80369] New: Warnings from preprocessor generated code not shown

adam.trhon at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Apr 8 14:57:00 GMT 2017


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

            Bug ID: 80369
           Summary: Warnings from preprocessor generated code not shown
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: adam.trhon at gmail dot com
  Target Milestone: ---

Created attachment 41162
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41162&action=edit
Minimal example

The example in main.c (attached) contains a preprocessor macro that should
generate tautological-compare warning (with -Wall). But the warning is not
generated unless preprocessing and compilation are done in separate steps.

When compiled as:

    gcc -Wall main.c

the warning about tautological compare is *not shown*. But when compiled as:

    gcc -Wall -no-integrated-cpp main.c

or as:

    gcc -Wall -E main.c -o main.i
    gcc -Wall --preprocessed main.i

then this warning is printed:

main.c: In function ‘main’:
main.c:31:11: warning: self-comparison always evaluates to false
[-Wtautological-compare]
  FOO
           ^ 

The issue was observed with:
gcc 6.2 for ARM built by OpenEmbedded
gcc 6.3 for x86_64 from Arch Linux
gcc 7.0 for x86_64 built from upstram git (commit ae4f1e0ee12)


More information about the Gcc-bugs mailing list