• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. title:: clang-tidy - cppcoreguidelines-macro-usage
2
3cppcoreguidelines-macro-usage
4=============================
5
6Finds macro usage that is considered problematic because better language
7constructs exist for the task.
8
9The relevant sections in the C++ Core Guidelines are
10`Enum.1 <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#enum1-prefer-enumerations-over-macros>`_,
11`ES.30 <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es30-dont-use-macros-for-program-text-manipulation>`_,
12`ES.31 <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es31-dont-use-macros-for-constants-or-functions>`_ and
13`ES.33 <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es33-if-you-must-use-macros-give-them-unique-names>`_.
14
15Options
16-------
17
18.. option:: AllowedRegexp
19
20    A regular expression to filter allowed macros. For example
21    `DEBUG*|LIBTORRENT*|TORRENT*|UNI*` could be applied to filter `libtorrent`.
22    Default value is `^DEBUG_*`.
23
24.. option:: CheckCapsOnly
25
26    Boolean flag to warn on all macros except those with CAPS_ONLY names.
27    This option is intended to ease introduction of this check into older
28    code bases. Default value is `false`.
29
30.. option:: IgnoreCommandLineMacros
31
32    Boolean flag to toggle ignoring command-line-defined macros.
33    Default value is `true`.
34