From: Chris Lattner Date: Tue, 7 Apr 2009 18:18:09 +0000 (+0000) Subject: add a warning for this crazy case, as suggested by Eli. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3eb2fc820e4629bfc63f526e848b34a1f1e9eef0;p=clang 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 --- 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 &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 {