summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wunused-var-7.c
blob: 74196436db886f03ca4b7bf3eb2e61d279d42a16 (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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* PR c++/44062 */
/* { dg-do compile } */
/* { dg-options "-Wunused" } */

void
foo (void)
{
  int a, b, c, d, e, f, g;
  a = 1;
  b = 2;
  c = 3;
  d = 4;
  e = 5;
  f = 6;
  g = 7;
  a;			/* { dg-warning "no effect" } */
  b, 1;			/* { dg-warning "no effect" } */
  (void) c;
  (void) d, 1;		/* { dg-warning "no effect" } */
  e, f, 1;		/* { dg-warning "no effect" } */
  (void) g, f, 1;	/* { dg-warning "no effect" } */
}

void
bar (void)
{
  int a;
  int b;
  int c;		/* { dg-warning "set but not used" } */
  a = 1;
  b = 2;
  c = 3;
  c = ({ a++, b; });
}

void
baz (void)
{
  int a;
  int b;
  int c;
  int d;
  a = 1;
  b = 2;
  c = 3;
  d = 4;
  d, ( a++, b ), c;	/* { dg-warning "no effect" } */
}