forked from OSchip/llvm-project
Emit final macro diagnostics in system headers
Final macro diagnostics should log from system headers. As planned, final macros are hard-mode. They always log diagnostics.
This commit is contained in:
parent
75ecd1f38c
commit
3e7ad1f2b2
|
@ -564,7 +564,7 @@ def note_pp_macro_annotation :
|
|||
def warn_pragma_final_macro :
|
||||
ExtWarn<"macro %0 has been marked as final and should not be "
|
||||
"%select{undefined|redefined}1">,
|
||||
InGroup<FinalMacro>;
|
||||
InGroup<FinalMacro>, ShowInSystemHeader;
|
||||
|
||||
// - #pragma execution_character_set(...)
|
||||
def warn_pragma_exec_charset_expected :
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
// expected-warning@+1{{macro 'SYSTEM_MACRO' has been marked as final and should not be undefined}}
|
||||
#undef SYSTEM_MACRO
|
||||
// expected-warning@+1{{macro 'SYSTEM_MACRO' has been marked as final and should not be redefined}}
|
||||
#define SYSTEM_MACRO WoahMoar
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -Wfinal-macro %s -fsyntax-only -verify
|
||||
// RUN: %clang_cc1 -Wfinal-macro %s -fsyntax-only -isystem %S/Inputs -verify
|
||||
|
||||
// Test warning production
|
||||
#define Foo 1
|
||||
|
@ -43,3 +43,8 @@
|
|||
// no diagnostics triggered by these pragmas.
|
||||
#pragma clang deprecated(Foo)
|
||||
#pragma clang restrict_expansion(Foo)
|
||||
|
||||
#define SYSTEM_MACRO Woah
|
||||
// expected-note@+1 2{{macro marked 'final' here}}
|
||||
#pragma clang final(SYSTEM_MACRO)
|
||||
#include <final-macro-system.h>
|
||||
|
|
Loading…
Reference in New Issue