aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-07 18:18:09 +0000
committerChris Lattner <sabre@nondot.org>2009-04-07 18:18:09 +0000
commit3eb2fc820e4629bfc63f526e848b34a1f1e9eef0 (patch)
tree900a501b900eafb8a14cce5383d38672fa40ea36
parentc2ee10d79f70036af652a395ac1f8273f3d04e12 (diff)
add a warning for this crazy case, as suggested by Eli.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68524 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--tools/clang-cc/clang-cc.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index 5a5ffc32af..d257c432fc 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -972,7 +972,13 @@ static void DefineBuiltinMacro(std::vector<char> &Buf, const char *Macro,
// Per GCC -D semantics, the macro ends at \n if it exists.
const char *End = strpbrk(Equal, "\n\r");
- if (End == 0) End = Equal+strlen(Equal);
+ if (End) {
+ fprintf(stderr, "warning: macro '%s' contains embeded newline, text "
+ "after the newline is ignored.\n",
+ std::string(Macro, Equal).c_str());
+ } else {
+ End = Equal+strlen(Equal);
+ }
Buf.insert(Buf.end(), Equal+1, End);
} else {