38 lines · plain
1.. title:: clang-tidy - readability-redundant-declaration2 3readability-redundant-declaration4=================================5 6Finds redundant variable and function declarations.7 8.. code-block:: c++9 10 extern int X;11 extern int X;12 13becomes14 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 refactorings21when code has been moved around. Having redundant declarations could in worst22case mean that there are typos in the code that cause bugs.23 24Normally the code can be automatically fixed, :program:`clang-tidy` can remove25the second declaration. However there are 2 cases when you need to fix the code26manually:27 28* When the declarations are in different header files;29* When multiple variables are declared together.30 31Options32-------33 34.. option:: IgnoreMacros35 36 If set to `true`, the check will not give warnings inside macros. Default37 is `true`.38