From: Andy Gibbs Date: Fri, 19 Apr 2013 17:13:17 +0000 (+0000) Subject: Keep the parentheses in #pragma message (partial revert of r179771). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5ae4dd6bf2310fbf4b192137aecd21248a08449;p=clang Keep the parentheses in #pragma message (partial revert of r179771). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179862 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 6d7a1db737..3cef68df32 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -419,7 +419,7 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, OS << Namespace << ' '; switch (Kind) { case PMK_Message: - OS << "message \""; + OS << "message(\""; break; case PMK_Warning: OS << "warning \""; @@ -440,6 +440,8 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc, << (char)('0'+ ((Char >> 0) & 7)); } OS << '"'; + if (Kind == PMK_Message) + OS << ')'; setEmittedDirectiveOnThisLine(); } diff --git a/test/Lexer/pragma-message2.c b/test/Lexer/pragma-message2.c index 4b4078243b..224ccfbbf8 100644 --- a/test/Lexer/pragma-message2.c +++ b/test/Lexer/pragma-message2.c @@ -1,10 +1,10 @@ // RUN: %clang_cc1 -E -Werror -verify %s 2>&1 | FileCheck %s #pragma message "\\test" // expected-warning {{\test}} -// CHECK: #pragma message "\134test" +// CHECK: #pragma message("\134test") #pragma message("\\test") // expected-warning {{\test}} -// CHECK: #pragma message "\134test" +// CHECK: #pragma message("\134test") #pragma GCC warning "\"" "te" "st" "\"" // expected-warning {{"test"}} // CHECK: #pragma GCC warning "\042test\042" diff --git a/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp index 7402f9f8c4..6a5a498a15 100644 --- a/test/Lexer/pragma-operators.cpp +++ b/test/Lexer/pragma-operators.cpp @@ -32,6 +32,6 @@ B(foo) // CHECK: #pragma comment(lib, "libfoo") // CHECK: #pragma clang diagnostic ignored "-Wunused" // CHECK: #pragma clang diagnostic error "-Wunused" -// CHECK: #pragma message "\042Hello\042, world!" +// CHECK: #pragma message("\042Hello\042, world!") // CHECK: 0; int n = pragma_L pragma_u8 pragma_u pragma_U pragma_R pragma_UR pragma_hello 0;