forked from OSchip/llvm-project
basic support for -Wunknown-pragmas, more coming.
llvm-svn: 69547
This commit is contained in:
parent
8281bdeb4d
commit
21656f22db
|
@ -204,6 +204,9 @@ def err__Pragma_malformed : Error<
|
|||
"_Pragma takes a parenthesized string literal">;
|
||||
def err_pragma_comment_malformed : Error<
|
||||
"pragma comment requires parenthesized identifier and optional string">;
|
||||
def warn_pragma_ignored : Warning<"unknown pragma ignored">,
|
||||
InGroup<UnknownPragmas>, DefaultIgnore;
|
||||
|
||||
def err_pragma_comment_unknown_kind : Error<"unknown kind of pragma comment">;
|
||||
def err_defined_macro_name : Error<"'defined' cannot be used as a macro name">;
|
||||
def err_paste_at_start : Error<
|
||||
|
|
|
@ -70,7 +70,10 @@ void PragmaNamespace::HandlePragma(Preprocessor &PP, Token &Tok) {
|
|||
|
||||
// Get the handler for this token. If there is no handler, ignore the pragma.
|
||||
PragmaHandler *Handler = FindHandler(Tok.getIdentifierInfo(), false);
|
||||
if (Handler == 0) return;
|
||||
if (Handler == 0) {
|
||||
PP.Diag(Tok, diag::warn_pragma_ignored);
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, pass it down.
|
||||
Handler->HandlePragma(PP, Tok);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// RUN: clang-cc -E %s | grep '#pragma foo bar'
|
||||
// RUN: clang-cc -E %s | grep '#pragma foo bar' &&
|
||||
// RUN: clang-cc -fsyntax-only -Wunknown-pragmas %s
|
||||
|
||||
// GCC doesn't expand macro args for unrecognized pragmas.
|
||||
#define bar xX
|
||||
#pragma foo bar
|
||||
#pragma foo bar // expected-warning {{unknown pragma ignored}}
|
||||
|
||||
|
|
Loading…
Reference in New Issue