https://llvm.org/bugs/show_bug.cgi?id=31324
Bug ID: 31324 Summary: Defines from command line override defines from pch: Product: clang Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Frontend Assignee: unassignedclangb...@nondot.org Reporter: nicolaswe...@gmx.de CC: llvm-bugs@lists.llvm.org Classification: Unclassified $ cat foo.h #define __STDC_HOSTED__ "hi" $ cat foo.c const char* s = __STDC_HOSTED__; $ bin/clang -cc1 -emit-pch -o foo.h.pch foo.h foo.h:1:9: warning: '__STDC_HOSTED__' macro redefined #define __STDC_HOSTED__ "hi" ^ <built-in>:307:9: note: previous definition is here #define __STDC_HOSTED__ 1 ^ 1 warning generated. $ bin/clang -cc1 -D__STDC_HOSTED__=4 -include-pch foo.h.pch -emit-obj -o foo.o foo.c <built-in>:1:9: warning: '__STDC_HOSTED__' macro redefined #define __STDC_HOSTED__ 4 ^ /Users/thakis/src/llvm-build/foo.h:1:9: note: previous definition is here #define __STDC_HOSTED__ "hi" ^ foo.c:1:13: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' const char* s = __STDC_HOSTED__; ^ ~~~~~~~~~~~~~~~ 2 warnings generated. But: $ bin/clang -cc1 -D__STDC_HOSTED__=4 -include foo.h -emit-obj -o foo.o foo.c In file included from <built-in>:311: <command line>:1:9: warning: '__STDC_HOSTED__' macro redefined #define __STDC_HOSTED__ 4 ^ <built-in>:307:9: note: previous definition is here #define __STDC_HOSTED__ 1 ^ In file included from <built-in>:1: ./foo.h:1:9: warning: '__STDC_HOSTED__' macro redefined #define __STDC_HOSTED__ "hi" ^ <command line>:1:9: note: previous definition is here #define __STDC_HOSTED__ 4 ^ 2 warnings generated. (Noticed by Richard Smith in https://reviews.llvm.org/D27545) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs