]> granicus.if.org Git - clang/commitdiff
Keep the parentheses in #pragma message (partial revert of r179771).
authorAndy Gibbs <andyg1001@hotmail.co.uk>
Fri, 19 Apr 2013 17:13:17 +0000 (17:13 +0000)
committerAndy Gibbs <andyg1001@hotmail.co.uk>
Fri, 19 Apr 2013 17:13:17 +0000 (17:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179862 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Frontend/PrintPreprocessedOutput.cpp
test/Lexer/pragma-message2.c
test/Lexer/pragma-operators.cpp

index 6d7a1db7379e913acac7851f4df845a8d37c2bb4..3cef68df32c61a79c541366adec42455843ad41e 100644 (file)
@@ -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();
 }
 
index 4b4078243b2ba44a78f87d8d0008c95c7f4bdc6f..224ccfbbf8fc452f58520a31711c519dda68df27 100644 (file)
@@ -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"
index 7402f9f8c4bb0d90688f3ef274cd777b41597062..6a5a498a151ff0a653f13c2e775e2f68ef3a45d7 100644 (file)
@@ -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;