[LLVMbugs] [Bug 21537] New: Clang warnings are inconsistent between compiling from C source to object code and preprocessed C source to object code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 11 14:38:07 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21537

            Bug ID: 21537
           Summary: Clang warnings are inconsistent between compiling from
                    C source to object code and preprocessed C source to
                    object code
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathan.hamilton at imgtec.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13322
  --> http://llvm.org/bugs/attachment.cgi?id=13322&action=edit
C test code having a tautological comparison as the result of a preprocessor
macro expansion.

Clang appears to handle some symbols differently with respect to warnings
depending on if the code is the result of a preprocessor macro expansion or
not.

This causes an inconsistency between pre-processing and compiling a source file
in one step to preprocessing then compiling as two stages.

For example, using the attached test program building (with clang 3.5.0 on
x86_64) with the following command line:

clang -Werror tautological-compare-in-macro.c -o /dev/null -c

succeeds with no warnings/errors. However running:

clang -Werror tautological-compare-in-macro.c -o
tautological-compare-in-macro.p -E
clang -Werror -x c tautological-compare-in-macro.p -o /dev/null -c

causes it to emit a warning (-Wtautological-compare, which causes this to fail
due to -Werror)

This is rather annoying when large projects add -Werror to their build systems.
This example was specifically seen (and significantly simplified from) a file
in Android.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20141111/7f84664e/attachment.html>


More information about the llvm-bugs mailing list