Skip to content

Commit 3d5fba4

Browse files
authored
[CI] Enable misc-use-anonymous-namespace diagnostic in clang-tidy (#166)
1 parent 72e4ea1 commit 3d5fba4

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

.clang-tidy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Checks: >
1818
-misc-no-recursion,
1919
-misc-non-private-member-variables-in-classes,
2020
-misc-unused-parameters,
21-
-misc-use-anonymous-namespace,
2221
-modernize-avoid-c-arrays,
2322
-modernize-loop-convert,
2423
-modernize-use-nodiscard,

1stsamples/stl/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#include <thread>
44
#include <vector>
55

6-
static void Task(const std::string& msg) { std::cout << "thread number: " + msg << '\n'; }
6+
namespace {
7+
void Task(const std::string& msg) { std::cout << "thread number: " + msg << '\n'; }
8+
} // namespace
79

810
int main() {
911
const auto num_max_threads = std::thread::hardware_concurrency();

1stsamples/tbb/main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
#include <iostream>
44

5-
static int FibFunc(int n) {
5+
namespace {
6+
int FibFunc(int n) {
67
if (n < 2) {
78
return n;
89
}
@@ -14,5 +15,6 @@ static int FibFunc(int n) {
1415
g.wait();
1516
return x + y;
1617
}
18+
} // namespace
1719

1820
int main() { return FibFunc(10) - 55; }

tasks/stl/example/src/ops_stl.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ bool nesterov_a_test_task_stl::TestSTLTaskSequential::post_processing_impl() {
3939
return true;
4040
}
4141

42-
static std::mutex my_mutex;
42+
namespace {
43+
std::mutex my_mutex;
4344

44-
static void AtomOps(std::vector<int> vec, const std::string &ops, std::promise<int> &&pr) {
45+
void AtomOps(std::vector<int> vec, const std::string &ops, std::promise<int> &&pr) {
4546
auto sz = vec.size();
4647
int reduction_elem = 0;
4748
if (ops == "+") {
@@ -57,6 +58,7 @@ static void AtomOps(std::vector<int> vec, const std::string &ops, std::promise<i
5758
}
5859
pr.set_value(reduction_elem);
5960
}
61+
} // namespace
6062

6163
bool nesterov_a_test_task_stl::TestSTLTaskParallel::pre_processing_impl() {
6264
// Init vectors

0 commit comments

Comments
 (0)