1 // RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused-but-set-variable -verify %s
8 int y
; // expected-warning{{variable 'y' set but not used}}
11 int z
__attribute__((unused
));
14 struct S s
; // expected-warning{{variable 's' set but not used}}
18 // Don't warn for an extern variable.
22 // Following gcc, this should not warn.
26 int j
= 0; // expected-warning{{variable 'j' set but not used}}
27 for (int i
= 0; i
< 1000; i
++)
30 // Following gcc, warn for a volatile variable.
31 volatile int b
; // expected-warning{{variable 'b' set but not used}}
34 // volatile variable k is used, no warning.
36 for (int i
= 0; i
< 1000; i
++)
39 // typedef of volatile type, no warning.
40 typedef volatile int volint
;
51 int y
; // expected-warning{{variable 'y' set but not used}}
61 // Don't warn, even if it's only used in a non-ODR context.
67 void for_cleanup(int *x
) {
72 // Don't warn if the __cleanup__ attribute is used.
73 __attribute__((__cleanup__(for_cleanup
))) int x
;
78 int x1
= 0; // expected-warning{{variable 'x1' set but not used}}
80 int x2
= 0; // expected-warning{{variable 'x2' set but not used}}
82 int x3
= 0; // expected-warning{{variable 'x3' set but not used}}
84 int x4
= 0; // expected-warning{{variable 'x4' set but not used}}
87 static int counter
= 0; // expected-warning{{variable 'counter' set but not used}}
92 typedef volatile int volint
;