]> granicus.if.org Git - clang/commitdiff
add a warning for this crazy case, as suggested by Eli.
authorChris Lattner <sabre@nondot.org>
Tue, 7 Apr 2009 18:18:09 +0000 (18:18 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 7 Apr 2009 18:18:09 +0000 (18:18 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68524 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-cc/clang-cc.cpp

index 5a5ffc32af9963ae92961ffde5d22cd67785242c..d257c432fc6d0e3224ccca9746a26a2349efb65a 100644 (file)
@@ -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 {