From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/Preprocessor/pragma_poison.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 clang/test/Preprocessor/pragma_poison.c (limited to 'clang/test/Preprocessor/pragma_poison.c') diff --git a/clang/test/Preprocessor/pragma_poison.c b/clang/test/Preprocessor/pragma_poison.c new file mode 100644 index 0000000..5b39183 --- /dev/null +++ b/clang/test/Preprocessor/pragma_poison.c @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 %s -Eonly -verify + +#pragma GCC poison rindex +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. -- cgit v1.2.3