xref: /llvm-project/clang/test/Sema/warn-unused-but-set-parameters.c (revision 2af845a6519c9cde5c8f58db5554f8b1084ce1ed)
1 // RUN: %clang_cc1 -fblocks -fsyntax-only -Wunused-but-set-parameter -verify %s
2 
f0(int x,int y,int z)3 int f0(int x,
4        int y, // expected-warning{{parameter 'y' set but not used}}
5        int z __attribute__((unused))) {
6   y = 0;
7   return x;
8 }
9 
f1(void)10 void f1(void) {
11   (void)^(int x,
12           int y, // expected-warning{{parameter 'y' set but not used}}
13           int z __attribute__((unused))) {
14     y = 0;
15     return x;
16   };
17 }
18 
19 struct S {
20   int i;
21 };
22 
f3(struct S s)23 void f3(struct S s) { // expected-warning{{parameter 's' set but not used}}
24   struct S t;
25   s = t;
26 }
27 
f4(int j)28 void f4(int j) { // expected-warning{{parameter 'j' set but not used}}
29     j++;
30 }
31 
f5(int k)32 void f5(int k) { // expected-warning{{parameter 'k' set but not used}}
33     --k;
34 }
35