aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c')
-rw-r--r--gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c b/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
new file mode 100644
index 000000000..0726f0439
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
@@ -0,0 +1,29 @@
+/* { dg-options "-Wparentheses -ftrack-macro-expansion=0" } */
+
+extern void f2 (int);
+
+void bar (int x, int y, int z)
+{
+#define T(op) f2 (x op y ? : 1)
+#define T2(op) f2 (x op y ? 2 : 1)
+
+ T(<); /* { dg-warning "omitted middle operand" } */
+ T(>); /* { dg-warning "omitted middle operand" } */
+ T(<=); /* { dg-warning "omitted middle operand" } */
+ T(>=); /* { dg-warning "omitted middle operand" } */
+ T(==); /* { dg-warning "omitted middle operand" } */
+ T(!=); /* { dg-warning "omitted middle operand" } */
+ T(||); /* { dg-warning "omitted middle operand" } */
+ T(&&); /* { dg-warning "omitted middle operand" } */
+ f2 (!x ? : 1); /* { dg-warning "omitted middle operand" } */
+ T2(<); /* { dg-bogus "omitted middle operand" } */
+ T2(>); /* { dg-bogus "omitted middle operand" } */
+ T2(==); /* { dg-bogus "omitted middle operand" } */
+ T2(||); /* { dg-bogus "omitted middle operand" } */
+ T2(&&); /* { dg-bogus "omitted middle operand" } */
+ T(+); /* { dg-bogus "omitted middle operand" } */
+ T(-); /* { dg-bogus "omitted middle operand" } */
+ T(*); /* { dg-bogus "omitted middle operand" } */
+ T(/); /* { dg-bogus "omitted middle operand" } */
+ T(^); /* { dg-bogus "omitted middle operand" } */
+}