From: Chris Lattner Date: Sun, 19 Apr 2009 20:15:59 +0000 (+0000) Subject: merge pragma poison tests into one file with -verify mode. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bf6044561cd167569be534142ee8fd393db88414;p=clang merge pragma poison tests into one file with -verify mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69538 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Preprocessor/_Pragma-poison.c b/test/Preprocessor/_Pragma-poison.c deleted file mode 100644 index 742f88532e..0000000000 --- a/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/test/Preprocessor/macro_paste_bad.c b/test/Preprocessor/macro_paste_bad.c index 3aafd84071..f70c3b3ba2 100644 --- a/test/Preprocessor/macro_paste_bad.c +++ b/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/test/Preprocessor/poison.c b/test/Preprocessor/poison.c index 9759ae473f..d91feb7ff2 100644 --- a/test/Preprocessor/poison.c +++ b/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/test/Preprocessor/poison_expansion.c b/test/Preprocessor/poison_expansion.c deleted file mode 100644 index 45676c8e6c..0000000000 --- a/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');