1 | // RUN: %check_clang_tidy %s misc-unused-parameters %t -- -- -Wno-strict-prototypes -xc |
2 | |
3 | // Basic removal |
4 | // ============= |
5 | void a(int i) {;} |
6 | // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'i' is unused [misc-unused-parameters] |
7 | // CHECK-FIXES: {{^}}void a(int i) {;}{{$}} |
8 | |
9 | static void b(); // In C, forward declarations can leave out parameters. |
10 | static void b(int i) {;} |
11 | // CHECK-MESSAGES: :[[@LINE-1]]:19: warning: parameter 'i' is unused [misc-unused-parameters] |
12 | // CHECK-FIXES: {{^}}static void b() {;}{{$}} |
13 | |
14 | // Unchanged cases |
15 | // =============== |
16 | void h(i, c, d) int i; char *c, *d; {} // Don't mess with K&R style |
17 | |
18 | // Do not warn on naked functions. |
19 | __attribute__((naked)) void nakedFunction(int a, int b) { ; } |
20 | |