[cfe-dev] Compilation warning when compiling preprocessed file, but not when compiling original file?

Mikael Holmén via cfe-dev cfe-dev at lists.llvm.org
Wed Nov 7 23:39:22 PST 2018


Hi,

I get this with a clang built from trunk, but also old clang versions 
behave like this.

If I compile foo.c like this I get no warnings at all:

  clang -Wall -o foo.o -c foo.c

But if I first preprocess it

  clang -Wall -o foo.pp.c -c foo.c -E

and then compile the preprocessed output:

  clang -Wall -o foo.o -c foo.pp.c

then clang warns:

foo.c:7:12: warning: equality comparison with extraneous parentheses 
[-Wparentheses-equality]
   if (((i) == (j)))
        ~~~~^~~~~~
foo.c:7:12: note: remove extraneous parentheses around the comparison to 
silence this warning
   if (((i) == (j)))
       ~    ^     ~
foo.c:7:12: note: use '=' to turn this equality comparison into an 
assignment
   if (((i) == (j)))
            ^~
            =
1 warning generated.

---

Is this how it's supposed to be? Is it perhaps even a feature?

It's not something I suffer from in any way, I just noticed it yesterday 
and thought it was odd since I thought compiling the original file or 
the preprocessed output would behave the same way.

Regards,
Mikael
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.c
Type: text/x-csrc
Size: 108 bytes
Desc: foo.c
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181108/7d138a1c/attachment.c>


More information about the cfe-dev mailing list