diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/PCH/single-token-macro.c | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/macro-reserved.c | 25 | ||||
-rw-r--r-- | clang/test/Preprocessor/macro-reserved.cpp | 25 | ||||
-rw-r--r-- | clang/test/Sema/thread-specifier.c | 2 |
4 files changed, 50 insertions, 4 deletions
diff --git a/clang/test/PCH/single-token-macro.c b/clang/test/PCH/single-token-macro.c index b077abaa036..aa02f65f78b 100644 --- a/clang/test/PCH/single-token-macro.c +++ b/clang/test/PCH/single-token-macro.c @@ -12,8 +12,6 @@ #ifndef HEADER #define HEADER -#pragma clang diagnostic ignored "-Wreserved-id-macro" - #ifdef __stdcall // __stdcall is defined as __attribute__((__stdcall__)) for targeting mingw32. #undef __stdcall diff --git a/clang/test/Preprocessor/macro-reserved.c b/clang/test/Preprocessor/macro-reserved.c new file mode 100644 index 00000000000..2a0e26f8e3a --- /dev/null +++ b/clang/test/Preprocessor/macro-reserved.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify + +#define for 0 // expected-warning {{keyword is hidden by macro definition}} +#define final 1 +#define __HAVE_X 0 +#define _HAVE_X 0 +#define X__Y + +#undef __cplusplus +#undef _HAVE_X +#undef X__Y + +#pragma clang diagnostic warning "-Wreserved-id-macro" + +#define switch if // expected-warning {{keyword is hidden by macro definition}} +#define final 1 +#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} +#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} +#define X__Y + +#undef __cplusplus // expected-warning {{macro name is a reserved identifier}} +#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}} +#undef X__Y + +int x; diff --git a/clang/test/Preprocessor/macro-reserved.cpp b/clang/test/Preprocessor/macro-reserved.cpp new file mode 100644 index 00000000000..8529ddffa1b --- /dev/null +++ b/clang/test/Preprocessor/macro-reserved.cpp @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -fsyntax-only %s -verify + +#define for 0 // expected-warning {{keyword is hidden by macro definition}} +#define final 1 // expected-warning {{keyword is hidden by macro definition}} +#define __HAVE_X 0 +#define _HAVE_X 0 +#define X__Y + +#undef __cplusplus +#undef _HAVE_X +#undef X__Y + +#pragma clang diagnostic warning "-Wreserved-id-macro" + +#define switch if // expected-warning {{keyword is hidden by macro definition}} +#define final 1 // expected-warning {{keyword is hidden by macro definition}} +#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} +#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} +#define X__Y // expected-warning {{macro name is a reserved identifier}} + +#undef __cplusplus // expected-warning {{macro name is a reserved identifier}} +#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}} +#undef X__Y // expected-warning {{macro name is a reserved identifier}} + +int x; diff --git a/clang/test/Sema/thread-specifier.c b/clang/test/Sema/thread-specifier.c index 71e44c34726..3968ae14cf2 100644 --- a/clang/test/Sema/thread-specifier.c +++ b/clang/test/Sema/thread-specifier.c @@ -5,8 +5,6 @@ // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DCXX11 -D__thread=thread_local -std=c++11 -Wno-deprecated // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -Wno-private-extern -verify -pedantic -x c++ %s -DC11 -D__thread=_Thread_local -std=c++11 -Wno-deprecated -#pragma clang diagnostic ignored "-Wkeyword-macro" - #ifdef __cplusplus // In C++, we define __private_extern__ to extern. #undef __private_extern__ |