r179771 - Dropped the parentheses for #pragma message and its kin in the -E output generator.
Andy Gibbs
andyg1001 at hotmail.co.uk
Thu Apr 18 09:49:37 PDT 2013
Author: andyg
Date: Thu Apr 18 11:49:37 2013
New Revision: 179771
URL: http://llvm.org/viewvc/llvm-project?rev=179771&view=rev
Log:
Dropped the parentheses for #pragma message and its kin in the -E output generator.
This was a suggestion by Jordan Rose since the documented format for these pragmas is without the parentheses. At the same time, I've increased test coverage too for the preprocessed output.
Added:
cfe/trunk/test/Lexer/pragma-message2.c
Modified:
cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
cfe/trunk/test/Lexer/pragma-operators.cpp
Modified: cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp?rev=179771&r1=179770&r2=179771&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp (original)
+++ cfe/trunk/lib/Frontend/PrintPreprocessedOutput.cpp Thu Apr 18 11:49:37 2013
@@ -419,13 +419,13 @@ void PrintPPOutputPPCallbacks::PragmaMes
OS << Namespace << ' ';
switch (Kind) {
case PMK_Message:
- OS << "message(\"";
+ OS << "message \"";
break;
case PMK_Warning:
- OS << "warning(\"";
+ OS << "warning \"";
break;
case PMK_Error:
- OS << "error(\"";
+ OS << "error \"";
break;
}
@@ -440,8 +440,6 @@ void PrintPPOutputPPCallbacks::PragmaMes
<< (char)('0'+ ((Char >> 0) & 7));
}
OS << '"';
-
- OS << ')';
setEmittedDirectiveOnThisLine();
}
Added: cfe/trunk/test/Lexer/pragma-message2.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/pragma-message2.c?rev=179771&view=auto
==============================================================================
--- cfe/trunk/test/Lexer/pragma-message2.c (added)
+++ cfe/trunk/test/Lexer/pragma-message2.c Thu Apr 18 11:49:37 2013
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -E -Werror -verify %s 2>&1 | FileCheck %s
+
+#pragma message "\\test" // expected-warning {{\test}}
+// CHECK: #pragma message "\134test"
+
+#pragma message("\\test") // expected-warning {{\test}}
+// CHECK: #pragma message "\134test"
+
+#pragma GCC warning "\"" "te" "st" "\"" // expected-warning {{"test"}}
+// CHECK: #pragma GCC warning "\042test\042"
+
+#pragma GCC warning("\"" "te" "st" "\"") // expected-warning {{"test"}}
+// CHECK: #pragma GCC warning "\042test\042"
+
+#pragma GCC error "" "[ ]" "" // expected-error {{[ ]}}
+// CHECK: #pragma GCC error "[\011]"
+
+#pragma GCC error("" "[ ]" "") // expected-error {{[ ]}}
+// CHECK: #pragma GCC error "[\011]"
Modified: cfe/trunk/test/Lexer/pragma-operators.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/pragma-operators.cpp?rev=179771&r1=179770&r2=179771&view=diff
==============================================================================
--- cfe/trunk/test/Lexer/pragma-operators.cpp (original)
+++ cfe/trunk/test/Lexer/pragma-operators.cpp Thu Apr 18 11:49:37 2013
@@ -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;
More information about the cfe-commits
mailing list