Skip to content

Commit

Permalink
Dropped the parentheses for #pragma message and its kin in the -E out…
Browse files Browse the repository at this point in the history
…put 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179771 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
andyg1001 committed Apr 18, 2013
1 parent 4d6bc18 commit 688f2a1
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 3 additions & 5 deletions lib/Frontend/PrintPreprocessedOutput.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,13 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc,
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;
}

Expand All @@ -440,8 +440,6 @@ void PrintPPOutputPPCallbacks::PragmaMessage(SourceLocation Loc,
<< (char)('0'+ ((Char >> 0) & 7));
}
OS << '"';

OS << ')';
setEmittedDirectiveOnThisLine();
}

Expand Down
19 changes: 19 additions & 0 deletions test/Lexer/pragma-message2.c
Original file line number Diff line number Diff line change
@@ -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]"
2 changes: 1 addition & 1 deletion test/Lexer/pragma-operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 688f2a1

Please sign in to comment.