[cfe-commits] r164279 - in /cfe/trunk: lib/Lex/PPExpressions.cpp test/Preprocessor/cxx_true.cpp
Eli Friedman
eli.friedman at gmail.com
Wed Sep 19 19:38:39 PDT 2012
Author: efriedma
Date: Wed Sep 19 21:38:38 2012
New Revision: 164279
URL: http://llvm.org/viewvc/llvm-project?rev=164279&view=rev
Log:
The keywords "true" and "false" shouldn't warn under -Wundef.
Modified:
cfe/trunk/lib/Lex/PPExpressions.cpp
cfe/trunk/test/Preprocessor/cxx_true.cpp
Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=164279&r1=164278&r2=164279&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Wed Sep 19 21:38:38 2012
@@ -178,7 +178,9 @@
// preprocessor keywords and it wasn't macro expanded, it turns
// into a simple 0, unless it is the C++ keyword "true", in which case it
// turns into "1".
- if (ValueLive)
+ if (ValueLive &&
+ II->getTokenID() != tok::kw_true &&
+ II->getTokenID() != tok::kw_false)
PP.Diag(PeekTok, diag::warn_pp_undef_identifier) << II;
Result.Val = II->getTokenID() == tok::kw_true;
Result.Val.setIsUnsigned(false); // "0" is signed intmax_t 0.
Modified: cfe/trunk/test/Preprocessor/cxx_true.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/cxx_true.cpp?rev=164279&r1=164278&r2=164279&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/cxx_true.cpp (original)
+++ cfe/trunk/test/Preprocessor/cxx_true.cpp Wed Sep 19 21:38:38 2012
@@ -1,6 +1,7 @@
/* RUN: %clang_cc1 -E %s -x c++ | grep block_1
RUN: %clang_cc1 -E %s -x c++ | not grep block_2
RUN: %clang_cc1 -E %s -x c | not grep block
+ RUN: %clang_cc1 -E %s -x c++ -verify -Wundef
*/
#if true
More information about the cfe-commits
mailing list