[cfe-commits] r149566 - in /cfe/trunk: include/clang/Basic/DiagnosticLexKinds.td lib/Lex/PPDirectives.cpp test/Frontend/rewrite-macros.c test/Index/retain-target-options.c test/Misc/serialized-diags-no-category.c test/Misc/warn-in-system-header.c test/Preprocessor/line-directive.c
Ted Kremenek
kremenek at apple.com
Wed Feb 1 16:16:14 PST 2012
Author: kremenek
Date: Wed Feb 1 18:16:13 2012
New Revision: 149566
URL: http://llvm.org/viewvc/llvm-project?rev=149566&view=rev
Log:
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
Modified:
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/Frontend/rewrite-macros.c
cfe/trunk/test/Index/retain-target-options.c
cfe/trunk/test/Misc/serialized-diags-no-category.c
cfe/trunk/test/Misc/warn-in-system-header.c
cfe/trunk/test/Preprocessor/line-directive.c
Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Wed Feb 1 18:16:13 2012
@@ -148,8 +148,13 @@
//===----------------------------------------------------------------------===//
// Preprocessor Diagnostics
//===----------------------------------------------------------------------===//
-def pp_hash_warning : Warning<"#warning%0">,
+
+let CategoryName = "User Defined Issues" in {
+def pp_hash_warning : Warning<"%0">,
InGroup<PoundWarning>, DefaultWarnShowInSystemHeader;
+def err_pp_hash_error : Error<"%0">;
+}
+
def pp_include_next_in_primary : Warning<
"#include_next in primary source file">;
def pp_include_macros_out_of_predefines : Error<
@@ -223,7 +228,6 @@
InGroup<CXX98CompatPedantic>, DefaultIgnore;
def err_pp_invalid_directive : Error<"invalid preprocessing directive">;
-def err_pp_hash_error : Error<"#error%0">;
def err_pp_file_not_found : Error<"'%0' file not found">, DefaultFatal;
def err_pp_error_opening_file : Error<
"error opening file '%0': %1">, DefaultFatal;
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Wed Feb 1 18:16:13 2012
@@ -1007,10 +1007,18 @@
// collapse multiple consequtive white space between tokens, but this isn't
// specified by the standard.
std::string Message = CurLexer->ReadToEndOfLine();
+
+ // Find the first non-whitespace character, so that we can make the
+ // diagnostic more succinct.
+ StringRef Msg(Message);
+ size_t i = Msg.find_first_not_of(' ');
+ if (i < Msg.size())
+ Msg = Msg.substr(i);
+
if (isWarning)
- Diag(Tok, diag::pp_hash_warning) << Message;
+ Diag(Tok, diag::pp_hash_warning) << Msg;
else
- Diag(Tok, diag::err_pp_hash_error) << Message;
+ Diag(Tok, diag::err_pp_hash_error) << Msg;
}
/// HandleIdentSCCSDirective - Handle a #ident/#sccs directive.
Modified: cfe/trunk/test/Frontend/rewrite-macros.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/rewrite-macros.c?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/test/Frontend/rewrite-macros.c (original)
+++ cfe/trunk/test/Frontend/rewrite-macros.c Wed Feb 1 18:16:13 2012
@@ -9,7 +9,7 @@
_Pragma("mark")
// RUN: grep "//#warning eek" %t
-/* expected-warning {{#warning eek}} */ #warning eek
+/* expected-warning {{eek}} */ #warning eek
// RUN: grep "//#pragma mark mark" %t
#pragma mark mark
Modified: cfe/trunk/test/Index/retain-target-options.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/retain-target-options.c?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/test/Index/retain-target-options.c (original)
+++ cfe/trunk/test/Index/retain-target-options.c Wed Feb 1 18:16:13 2012
@@ -2,7 +2,7 @@
// RUN: c-index-test -test-load-source-reparse 1 all -target x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s
// RUN: c-index-test -test-load-source-reparse 5 all -target x86_64-apple-darwin10.0.0 -msse4.1 %s 2>&1 | FileCheck %s
-// CHECK: error: #error SSE4_1 used
+// CHECK: error: SSE4_1 used
#if defined(__SSE4_1__)
#error SSE4_1 used
#endif
Modified: cfe/trunk/test/Misc/serialized-diags-no-category.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/serialized-diags-no-category.c?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/test/Misc/serialized-diags-no-category.c (original)
+++ cfe/trunk/test/Misc/serialized-diags-no-category.c Wed Feb 1 18:16:13 2012
@@ -7,6 +7,6 @@
// This test case tests that we can handle both fatal errors and errors without categories.
-// CHECK: {{.*[/\\]}}serialized-diags-no-category.c:1:2: error: #error foo []
+// CHECK: {{.*[/\\]}}serialized-diags-no-category.c:1:2: error: foo []
// CHECK: Number of diagnostics: 2
Modified: cfe/trunk/test/Misc/warn-in-system-header.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/warn-in-system-header.c?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/test/Misc/warn-in-system-header.c (original)
+++ cfe/trunk/test/Misc/warn-in-system-header.c Wed Feb 1 18:16:13 2012
@@ -1,4 +1,4 @@
// RUN: %clang_cc1 -isystem %S %s -fsyntax-only -verify
#include <warn-in-system-header.h>
-// expected-warning {{#warning}}
+// expected-warning {{the cake is a lie}}
Modified: cfe/trunk/test/Preprocessor/line-directive.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/line-directive.c?rev=149566&r1=149565&r2=149566&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/line-directive.c (original)
+++ cfe/trunk/test/Preprocessor/line-directive.c Wed Feb 1 18:16:13 2012
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
-// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: #error ABC'
-// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: #error DEF'
+// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:92:2: error: ABC'
+// RUN: %clang_cc1 -E %s 2>&1 | grep 'blonk.c:93:2: error: DEF'
#line 'a' // expected-error {{#line directive requires a positive integer argument}}
#line 0 // expected-error {{#line directive requires a positive integer argument}}
More information about the cfe-commits
mailing list