summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/warn-ommitted-condop.c
blob: de92b8f2cdc9622f316162e70f0df9634f0c1a4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/* { dg-options "-Wparentheses" } */

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" } */
}