forked from OSchip/llvm-project
Per discussion on cfe-dev, remove '#error' and '#warning' from diagnostic text.
llvm-svn: 149566
This commit is contained in:
parent
ccded6e447
commit
7f4bd16b53
|
@ -148,8 +148,13 @@ def err_invalid_pth_file : Error<
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Preprocessor Diagnostics
|
// Preprocessor Diagnostics
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
def pp_hash_warning : Warning<"#warning%0">,
|
|
||||||
|
let CategoryName = "User Defined Issues" in {
|
||||||
|
def pp_hash_warning : Warning<"%0">,
|
||||||
InGroup<PoundWarning>, DefaultWarnShowInSystemHeader;
|
InGroup<PoundWarning>, DefaultWarnShowInSystemHeader;
|
||||||
|
def err_pp_hash_error : Error<"%0">;
|
||||||
|
}
|
||||||
|
|
||||||
def pp_include_next_in_primary : Warning<
|
def pp_include_next_in_primary : Warning<
|
||||||
"#include_next in primary source file">;
|
"#include_next in primary source file">;
|
||||||
def pp_include_macros_out_of_predefines : Error<
|
def pp_include_macros_out_of_predefines : Error<
|
||||||
|
@ -223,7 +228,6 @@ def warn_cxx98_compat_empty_fnmacro_arg : Warning<
|
||||||
InGroup<CXX98CompatPedantic>, DefaultIgnore;
|
InGroup<CXX98CompatPedantic>, DefaultIgnore;
|
||||||
|
|
||||||
def err_pp_invalid_directive : Error<"invalid preprocessing directive">;
|
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_file_not_found : Error<"'%0' file not found">, DefaultFatal;
|
||||||
def err_pp_error_opening_file : Error<
|
def err_pp_error_opening_file : Error<
|
||||||
"error opening file '%0': %1">, DefaultFatal;
|
"error opening file '%0': %1">, DefaultFatal;
|
||||||
|
|
|
@ -1007,10 +1007,18 @@ void Preprocessor::HandleUserDiagnosticDirective(Token &Tok,
|
||||||
// collapse multiple consequtive white space between tokens, but this isn't
|
// collapse multiple consequtive white space between tokens, but this isn't
|
||||||
// specified by the standard.
|
// specified by the standard.
|
||||||
std::string Message = CurLexer->ReadToEndOfLine();
|
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)
|
if (isWarning)
|
||||||
Diag(Tok, diag::pp_hash_warning) << Message;
|
Diag(Tok, diag::pp_hash_warning) << Msg;
|
||||||
else
|
else
|
||||||
Diag(Tok, diag::err_pp_hash_error) << Message;
|
Diag(Tok, diag::err_pp_hash_error) << Msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// HandleIdentSCCSDirective - Handle a #ident/#sccs directive.
|
/// HandleIdentSCCSDirective - Handle a #ident/#sccs directive.
|
||||||
|
|
|
@ -9,7 +9,7 @@ A(1,2)
|
||||||
_Pragma("mark")
|
_Pragma("mark")
|
||||||
|
|
||||||
// RUN: grep "//#warning eek" %t
|
// RUN: grep "//#warning eek" %t
|
||||||
/* expected-warning {{#warning eek}} */ #warning eek
|
/* expected-warning {{eek}} */ #warning eek
|
||||||
|
|
||||||
// RUN: grep "//#pragma mark mark" %t
|
// RUN: grep "//#pragma mark mark" %t
|
||||||
#pragma mark mark
|
#pragma mark mark
|
||||||
|
|
|
@ -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 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
|
// 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__)
|
#if defined(__SSE4_1__)
|
||||||
#error SSE4_1 used
|
#error SSE4_1 used
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
|
|
||||||
// This test case tests that we can handle both fatal errors and errors without categories.
|
// 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
|
// CHECK: Number of diagnostics: 2
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// RUN: %clang_cc1 -isystem %S %s -fsyntax-only -verify
|
// RUN: %clang_cc1 -isystem %S %s -fsyntax-only -verify
|
||||||
|
|
||||||
#include <warn-in-system-header.h>
|
#include <warn-in-system-header.h>
|
||||||
// expected-warning {{#warning}}
|
// expected-warning {{the cake is a lie}}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
|
// 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:92:2: 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:93:2: error: DEF'
|
||||||
|
|
||||||
#line 'a' // expected-error {{#line directive requires a positive integer argument}}
|
#line 'a' // expected-error {{#line directive requires a positive integer argument}}
|
||||||
#line 0 // expected-error {{#line directive requires a positive integer argument}}
|
#line 0 // expected-error {{#line directive requires a positive integer argument}}
|
||||||
|
|
Loading…
Reference in New Issue