Skip to content

Commit 69b3c25

Browse files
committed
Prune out unneeded comments and files
1 parent ce1c02a commit 69b3c25

File tree

2 files changed

+14
-64
lines changed

2 files changed

+14
-64
lines changed
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
#include "test.hpp"
2+
#include <cassert>
23

3-
/*
4-
* This file demonstrates that anonymous namespace variables
5-
* in headers create translation-unit-local copies.
6-
*/
4+
extern void setValues();
5+
extern std::int32_t getX_File1();
6+
extern std::int32_t getNested_File1();
77

8-
void setValues() {
9-
x = 42; // Sets file1.cpp's copy of x
10-
MyNamespace::y = 42; // Sets the shared y
11-
z = 42; // Sets the shared z
12-
Outer::nested = 42; // Sets file1.cpp's copy of nested
13-
}
8+
/* ========== 6. Compliant: anonymous namespace in .cpp file ========== */
9+
10+
namespace { // COMPLIANT: anonymous namespace in source file is fine
11+
std::int32_t localVar = 0;
1412

15-
std::int32_t getX_File1() {
16-
return x; // Returns file1.cpp's copy of x
13+
void localHelper() {
14+
localVar = 100; // Only visible in this TU, as expected
1715
}
16+
} // namespace
1817

19-
std::int32_t getNested_File1() {
20-
return Outer::nested; // Returns file1.cpp's copy of nested
18+
int main() {
19+
localHelper();
20+
return 0;
2121
}

cpp/misra/test/rules/RULE-10-3-1/test2.cpp

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)