[cfe-commits] r68524 - /cfe/trunk/tools/clang-cc/clang-cc.cpp

Chris Lattner sabre at nondot.org
Tue Apr 7 11:18:09 PDT 2009


Author: lattner
Date: Tue Apr  7 13:18:09 2009
New Revision: 68524

URL: http://llvm.org/viewvc/llvm-project?rev=68524&view=rev
Log:
add a warning for this crazy case, as suggested by Eli.

Modified:
    cfe/trunk/tools/clang-cc/clang-cc.cpp

Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=68524&r1=68523&r2=68524&view=diff

==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Tue Apr  7 13:18:09 2009
@@ -972,7 +972,13 @@
     
     // 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 {





More information about the cfe-commits mailing list