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

2017-04-08 Thread adam.trhon at gmail dot com
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)

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

2017-04-08 Thread adam.trhon at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80369

--- Comment #2 from Adam Trhoň  ---
Could you please provide a further explanation? Why the warning in my example
should not be shown?

My background: We are setting up icecream (but it could be any other tool as
ccache or distcc) with OpenEmbedded. The build fails on ltrace, but only when
icecream is active (as it splits preprocessing and compilation). The ltrace
project has -Wall -Werror in the command and 

assert(val != val);

in the code to abort in some case. Of course this should be fixed in the code,
but the gcc behavior seems confusing here.

I will also submit this to icecream (as, without further investigaion, it looks
like a problem on their side), but first I would like a comment from comunity
around gcc.