diff options
-rw-r--r-- | clang/test/Preprocessor/_Pragma-poison.c | 8 | ||||
-rw-r--r-- | clang/test/Preprocessor/macro_paste_bad.c | 2 | ||||
-rw-r--r-- | clang/test/Preprocessor/poison.c | 20 | ||||
-rw-r--r-- | clang/test/Preprocessor/poison_expansion.c | 9 |
4 files changed, 18 insertions, 21 deletions
diff --git a/clang/test/Preprocessor/_Pragma-poison.c b/clang/test/Preprocessor/_Pragma-poison.c deleted file mode 100644 index 742f88532ee..00000000000 --- a/clang/test/Preprocessor/_Pragma-poison.c +++ /dev/null @@ -1,8 +0,0 @@ -// RUN: clang-cc -Eonly %s 2>&1 | grep error | wc -l | grep 1 && -// RUN: clang-cc -Eonly %s 2>&1 | grep 7:4 | wc -l | grep 1 - -#define BAR _Pragma ("GCC poison XYZW") XYZW /*NO ERROR*/ -XYZW // NO ERROR -BAR - XYZW // ERROR - diff --git a/clang/test/Preprocessor/macro_paste_bad.c b/clang/test/Preprocessor/macro_paste_bad.c index 3aafd84071e..f70c3b3ba2e 100644 --- a/clang/test/Preprocessor/macro_paste_bad.c +++ b/clang/test/Preprocessor/macro_paste_bad.c @@ -4,7 +4,6 @@ XYZ // GCC PR 20077 -// RUN: clang-cc -Eonly %s -verify #define a a ## ## // expected-error {{'##' cannot appear at end of macro expansion}} #define b() b ## ## // expected-error {{'##' cannot appear at end of macro expansion}} @@ -19,4 +18,3 @@ XYZ #define i ## // expected-error {{'##' cannot appear at start of macro expansion}} #define j() ## // expected-error {{'##' cannot appear at start of macro expansion}} - diff --git a/clang/test/Preprocessor/poison.c b/clang/test/Preprocessor/poison.c index 9759ae473fe..d91feb7ff2d 100644 --- a/clang/test/Preprocessor/poison.c +++ b/clang/test/Preprocessor/poison.c @@ -1,4 +1,20 @@ -// RUN: clang-cc %s -E 2>&1 | grep error +// RUN: clang-cc %s -Eonly -verify #pragma GCC poison rindex -rindex(some_string, 'h'); +rindex(some_string, 'h'); // expected-error {{attempt to use a poisoned identifier}} + +#define BAR _Pragma ("GCC poison XYZW") XYZW /*NO ERROR*/ + XYZW // ok +BAR + XYZW // expected-error {{attempt to use a poisoned identifier}} + +// Pragma poison shouldn't warn from macro expansions defined before the token +// is poisoned. + +#define strrchr rindex2 +#pragma GCC poison rindex2 + +// Can poison multiple times. +#pragma GCC poison rindex2 + +strrchr(some_string, 'h'); // ok. diff --git a/clang/test/Preprocessor/poison_expansion.c b/clang/test/Preprocessor/poison_expansion.c deleted file mode 100644 index 45676c8e6cb..00000000000 --- a/clang/test/Preprocessor/poison_expansion.c +++ /dev/null @@ -1,9 +0,0 @@ -// RUN: clang-cc %s -E 2>&1 | not grep error - -#define strrchr rindex -#pragma GCC poison rindex - -// Can poison multiple times. -#pragma GCC poison rindex - -strrchr(some_string, 'h'); |