From 3eb2fc820e4629bfc63f526e848b34a1f1e9eef0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 7 Apr 2009 18:18:09 +0000 Subject: [PATCH] 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 --- tools/clang-cc/clang-cc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 { -- 2.40.0