summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/Inputs/unused-expr-system-header.h
diff options
context:
space:
mode:
authorMatt Beaumont-Gay <matthewbg@google.com>2012-01-06 22:43:58 +0000
committerMatt Beaumont-Gay <matthewbg@google.com>2012-01-06 22:43:58 +0000
commit7a57adab8359c623618d375d8dbb8c473f101b1b (patch)
tree40a785bb31b5ed12ec3d4f5a93e24f71ad49f758 /clang/test/Sema/Inputs/unused-expr-system-header.h
parent7ff610b62d64a3308605dbeda933b541b62a3ddc (diff)
downloadbcm5719-llvm-7a57adab8359c623618d375d8dbb8c473f101b1b.tar.gz
bcm5719-llvm-7a57adab8359c623618d375d8dbb8c473f101b1b.zip
Suppress -Wunused-value within macros from system headers.
Along the way, move a helper function from SemaChecking.cpp to a more accessible home in SourceManager. llvm-svn: 147692
Diffstat (limited to 'clang/test/Sema/Inputs/unused-expr-system-header.h')
-rw-r--r--clang/test/Sema/Inputs/unused-expr-system-header.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Sema/Inputs/unused-expr-system-header.h b/clang/test/Sema/Inputs/unused-expr-system-header.h
new file mode 100644
index 00000000000..72b2d95de44
--- /dev/null
+++ b/clang/test/Sema/Inputs/unused-expr-system-header.h
@@ -0,0 +1,23 @@
+// "System header" for testing that -Wunused-value is properly suppressed in
+// certain cases.
+
+#define POSSIBLY_BAD_MACRO(x) \
+ { int i = x; \
+ i; }
+
+#define STATEMENT_EXPR_MACRO(x) \
+ (__extension__ \
+ ({int i = x; \
+ i;}))
+
+#define COMMA_MACRO_1(x, y) \
+ {x, y;}
+
+#define COMMA_MACRO_2(x, y) \
+ if (x) { 1 == 2, y; }
+
+#define COMMA_MACRO_3(x, y) \
+ (x, y)
+
+#define COMMA_MACRO_4(x, y) \
+ ( 1 == 2, y )
OpenPOWER on IntegriCloud