1.. title:: clang-tidy - readability-inconsistent-declaration-parameter-name 2 3readability-inconsistent-declaration-parameter-name 4=================================================== 5 6Find function declarations which differ in parameter names. 7 8Example: 9 10.. code-block:: c++ 11 12 // in foo.hpp: 13 void foo(int a, int b, int c); 14 15 // in foo.cpp: 16 void foo(int d, int e, int f); // warning 17 18This check should help to enforce consistency in large projects, where it often 19happens that a definition of function is refactored, changing the parameter 20names, but its declaration in header file is not updated. With this check, we 21can easily find and correct such inconsistencies, keeping declaration and 22definition always in sync. 23 24Unnamed parameters are allowed and are not taken into account when comparing 25function declarations, for example: 26 27.. code-block:: c++ 28 29 void foo(int a); 30 void foo(int); // no warning 31 32One name is also allowed to be a case-insensitive prefix/suffix of the other: 33 34.. code-block:: c++ 35 36 void foo(int count); 37 void foo(int count_input) { // no warning 38 int count = adjustCount(count_input); 39 } 40 41To help with refactoring, in some cases fix-it hints are generated to align 42parameter names to a single naming convention. This works with the assumption 43that the function definition is the most up-to-date version, as it directly 44references parameter names in its body. Example: 45 46.. code-block:: c++ 47 48 void foo(int a); // warning and fix-it hint (replace "a" to "b") 49 int foo(int b) { return b + 2; } // definition with use of "b" 50 51In the case of multiple redeclarations or function template specializations, 52a warning is issued for every redeclaration or specialization inconsistent with 53the definition or the first declaration seen in a translation unit. 54 55.. option:: IgnoreMacros 56 57 If this option is set to `true` (default is `true`), the check will not warn 58 about names declared inside macros. 59 60.. option:: Strict 61 62 If this option is set to `true` (default is `false`), then names must match 63 exactly (or be absent). 64