1.. title:: clang-tidy - readability-redundant-declaration 2 3readability-redundant-declaration 4================================= 5 6Finds redundant variable and function declarations. 7 8.. code-block:: c++ 9 10 extern int X; 11 extern int X; 12 13becomes 14 15.. code-block:: c++ 16 17 extern int X; 18 19Such redundant declarations can be removed without changing program behavior. 20They can for instance be unintentional left overs from previous refactorings 21when code has been moved around. Having redundant declarations could in worst 22case mean that there are typos in the code that cause bugs. 23 24Normally the code can be automatically fixed, :program:`clang-tidy` can remove 25the second declaration. However there are 2 cases when you need to fix the code 26manually: 27 28* When the declarations are in different header files; 29* When multiple variables are declared together. 30 31Options 32------- 33 34.. option:: IgnoreMacros 35 36 If set to `true`, the check will not give warnings inside macros. Default 37 is `true`. 38