summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/macro_fn.c
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2012-11-14 02:18:46 +0000
committerEli Friedman <eli.friedman@gmail.com>2012-11-14 02:18:46 +0000
commit14d3c79b451f09b580328f36f768df859d9c846a (patch)
tree18572c897008e616acecee69ca10f6ef55e9b7d5 /clang/test/Preprocessor/macro_fn.c
parent095deba5336bfaf275f4837a5f229e58f9a927c0 (diff)
downloadbcm5719-llvm-14d3c79b451f09b580328f36f768df859d9c846a.tar.gz
bcm5719-llvm-14d3c79b451f09b580328f36f768df859d9c846a.zip
Suppress elided variadic macro argument extension diagnostic for macros using
the related comma pasting extension. In certain cases, we used to get two diagnostics for what is essentially one extension. This change suppresses the first diagnostic in certain cases where we know we're going to print the second diagnostic. The diagnostic is redundant, and it can't be suppressed in the definition of the macro because it points at the use of the macro, so we want to avoid printing it if possible. The implementation works by detecting constructs which look like comma pasting at the time of the definition of the macro; this information is then used when the macro is used. (We can't actually detect whether we're using the comma pasting extension until the macro is actually used, but we can detecting constructs which will be comma pasting if the varargs argument is elided.) <rdar://problem/12292192> llvm-svn: 167907
Diffstat (limited to 'clang/test/Preprocessor/macro_fn.c')
-rw-r--r--clang/test/Preprocessor/macro_fn.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/macro_fn.c b/clang/test/Preprocessor/macro_fn.c
index f93d52c7eda..8ac9ed9a248 100644
--- a/clang/test/Preprocessor/macro_fn.c
+++ b/clang/test/Preprocessor/macro_fn.c
@@ -44,3 +44,9 @@ one_dot() /* empty first argument, elided ...: expected-warning {{must specify
#define E() (i == 0)
#if E
#endif
+
+
+/* <rdar://problem/12292192> */
+#define NSAssert(condition, desc, ...) /* expected-warning {{variadic macros are a C99 feature}} */ \
+ SomeComplicatedStuff((desc), ##__VA_ARGS__) /* expected-warning {{token pasting of ',' and __VA_ARGS__ is a GNU extension}} */
+NSAssert(somecond, somedesc)
OpenPOWER on IntegriCloud