Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/misc/unused-parameters-strict.cpp

raw
1 // RUN: %check_clang_tidy %s misc-unused-parameters %t -- \
2 // RUN: -config="{CheckOptions: {StrictMode: true}}" --
3
4 // Warn on empty function bodies in StrictMode.
5 namespace strict_mode {
6 void f(int foo) {}
7 // CHECK-MESSAGES: :[[@LINE-1]]:12: warning: parameter 'foo' is unused [misc-unused-parameters]
8 // CHECK-FIXES: {{^}}void f(int /*foo*/) {}{{$}}
9 class E {
10 int i;
11
12 public:
13 E(int j) {}
14 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'j' is unused
15 // CHECK-FIXES: {{^}} E(int /*j*/) {}{{$}}
16 };
17 class F {
18 int i;
19
20 public:
21 F(int j) : i() {}
22 // CHECK-MESSAGES: :[[@LINE-1]]:9: warning: parameter 'j' is unused
23 // CHECK-FIXES: {{^}} F(int /*j*/) : i() {}{{$}}
24 };
25
26 // Do not warn on naked functions.
27 [[gnu::naked]] int nakedFunction(int a, float b, const char *c) { ; }
28 __attribute__((naked)) void nakedFunction(int a, int b) { ; }
29 }