libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Wunused-var-5.c
blobcc5bbf51ab0fb1997f90e32f6a7570cf72300eea
1 /* PR c/99588 */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -Wunused-but-set-variable" } */
5 void bar (int, ...);
6 void f1 (void) { static _Atomic int x = 0; bar (0, x); }
7 void f2 (void) { static _Atomic int x = 0; bar (0, x += 1); }
8 void f3 (void) { static _Atomic int x = 0; bar (x); }
9 void f4 (void) { static _Atomic int x = 0; bar (x += 1); }
10 void f5 (void) { static _Atomic int x = 0; bar (x = 1); }
11 void f6 (void) { static _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */
12 void f7 (void) { static _Atomic int x = 0; x += 3; }
13 void f8 (void) { _Atomic int x = 0; bar (0, x); }
14 void f9 (void) { _Atomic int x = 0; bar (0, x += 1); }
15 void f10 (void) { _Atomic int x = 0; bar (x); }
16 void f11 (void) { _Atomic int x = 0; bar (x += 1); }
17 void f12 (void) { _Atomic int x = 0; bar (x = 1); }
18 void f13 (void) { _Atomic int x = 0; x = 1; } /* { dg-warning "variable 'x' set but not used" } */
19 void f14 (void) { _Atomic int x = 0; x += 3; }
20 void f15 (void) { _Atomic int x = 0; int y = 3; x += y; }
21 void f16 (void) { _Atomic int x = 0; int y = 3; bar (x += y); }
22 void f17 (void) { _Atomic int x = 0; int y = 3; x = y; } /* { dg-warning "variable 'x' set but not used" } */
23 void f18 (void) { _Atomic int x = 0; int y = 3; bar (x = y); }