bolt/deps/llvm-18.1.8/clang-tools-extra/docs/clang-tidy/checks/readability/static-definition-in-anonymous-namespace.rst

22 lines
645 B
ReStructuredText
Raw Normal View History

2025-02-14 19:21:04 +01:00
.. 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 int b = 1; // Warning.
namespace inner {
static int c = 1; // Warning.
}
}
The check will apply a fix by removing the redundant ``static`` qualifier.