summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/docs/clang-tidy/checks/readability-static-definition-in-anonymous-namespace.rst
blob: c1803d4b13052ba760afdd589d35ece299ad3a11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.. title:: clang-tidy - readability-static-definition-in-anonymous-namespace

readability-static-definition-in-anonymous-namespace
====================================================

Finds static function and variable definitions in anonymous namespace.

In this case, ``static`` is redundant, because anonymous namespace limits the
visibility of definitions to a single translation unit.

.. code-block:: c++

  namespace {
    static int a = 1; // Warning.
    static const b = 1; // Warning.
  }

The check will apply a fix by removing the redundant ``static`` qualifier.
OpenPOWER on IntegriCloud