1.. title:: clang-tidy - misc-unused-parameters
2
3misc-unused-parameters
4======================
5
6Finds unused function parameters. Unused parameters may signify a bug in the
7code (e.g. when a different parameter is used instead). The suggested fixes
8either comment parameter name out or remove the parameter completely, if all
9callers of the function are in the same translation unit and can be updated.
10
11The check is similar to the ``-Wunused-parameter`` compiler diagnostic and can be
12used to prepare a codebase to enabling of that diagnostic. By default the check
13is more permissive (see :option:`StrictMode`).
14
15.. code-block:: c++
16
17  void a(int i) { /*some code that doesn't use `i`*/ }
18
19  // becomes
20
21  void a(int  /*i*/) { /*some code that doesn't use `i`*/ }
22
23.. code-block:: c++
24
25  static void staticFunctionA(int i);
26  static void staticFunctionA(int i) { /*some code that doesn't use `i`*/ }
27
28  // becomes
29
30  static void staticFunctionA()
31  static void staticFunctionA() { /*some code that doesn't use `i`*/ }
32
33Options
34-------
35
36.. option:: StrictMode
37
38   When `false` (default value), the check will ignore trivially unused parameters,
39   i.e. when the corresponding function has an empty body (and in case of
40   constructors - no constructor initializers). When the function body is empty,
41   an unused parameter is unlikely to be unnoticed by a human reader, and
42   there's basically no place for a bug to hide.
43