Skip to content

Commit 91b613b

Browse files
Format cpp
1 parent ff2eb72 commit 91b613b

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

cpp/common/test/Linkage/test.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,20 @@ class C1 { // inherits external linkage from enclosing namespace
3333
class C2 { // inherits external linkage from class scope
3434
int m1;
3535
static int m2; // inherits external linkage from class scope
36-
void m3() {} // inherits external linkage from class scope
36+
void m3() {} // inherits external linkage from class scope
3737
}; // inherits external linkage from class scope
3838

3939
typedef class {
4040
int m1;
4141
// static int m2 not allowed in anonymous class
4242
void m3() {} // inherits external linkage from class scope
43-
} C3; // inherits external linkage from class scope
43+
} C3; // inherits external linkage from class scope
4444

4545
class {
4646
int m1;
4747
// static int m2 not allowed in unnamed class
4848
void m3() {} // inherits no linkage from class scope
49-
} m4; // anonymous class outside typedef has no linkage
49+
} m4; // anonymous class outside typedef has no linkage
5050
};
5151

5252
typedef class { // inherits external linkage from enclosing namespace
@@ -64,13 +64,13 @@ typedef class { // inherits external linkage from enclosing namespace
6464
int m1;
6565
// static int m2 not allowed in anonymous class
6666
void m3() {} // inherits external linkage from class scope
67-
} C3; // inherits external linkage from enclosing namespace
67+
} C3; // inherits external linkage from enclosing namespace
6868

6969
class {
7070
int m1;
7171
// static int m2 not allowed in unnamed class
7272
void m3() {} // inherits no linkage from class scope
73-
} m4; // anonymous class outside typedef has no linkage
73+
} m4; // anonymous class outside typedef has no linkage
7474
} C2;
7575

7676
template <typename T>
@@ -106,20 +106,20 @@ class C1 { // inherits internal linkage from enclosing namespace
106106
class C2 {
107107
int m1;
108108
static int m2; // inherits internal linkage from class scope
109-
void m3() {} // inherits internal linkage from class scope
109+
void m3() {} // inherits internal linkage from class scope
110110
}; // inherits internal linkage from class scope
111111

112112
typedef struct {
113113
int m1;
114114
// static int m2 not allowed in anonymous class
115115
void m3() {} // inherits internal linkage from class scope
116-
} C3; // inherits internal linkage from class scope
116+
} C3; // inherits internal linkage from class scope
117117

118118
class {
119119
int m1;
120120
// static int m2 not allowed in unnamed class
121121
void m3() {} // inherits no linkage from class scope
122-
} m4; // anonymous class outside typedef has no linkage
122+
} m4; // anonymous class outside typedef has no linkage
123123
};
124124

125125
typedef class { // inherits internal linkage from enclosing namespace
@@ -137,13 +137,13 @@ typedef class { // inherits internal linkage from enclosing namespace
137137
int m1;
138138
// static int m2 not allowed in anonymous class
139139
void m3() {} // inherits internal linkage from class scope
140-
} C3; // inherits internal linkage from enclosing namespace
140+
} C3; // inherits internal linkage from enclosing namespace
141141

142142
class {
143143
int m1;
144144
// static int m2 not allowed in unnamed class
145145
void m3() {} // inherits no linkage from class scope
146-
} m4; // anonymous class outside typedef has no linkage
146+
} m4; // anonymous class outside typedef has no linkage
147147
} C2;
148148

149149
template <typename T>
@@ -176,5 +176,4 @@ void block_scope() {
176176
int m1;
177177
void member() {} // No linkage, block scope
178178
} S2;
179-
180179
}

cpp/misra/test/rules/RULE-0-2-1/test.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ template <bool... Args> extern constexpr bool all_of_v = true; // COMPLIANT
8686

8787
template <bool B1, bool... Args>
8888
extern constexpr bool all_of_v<B1, Args...> =
89-
B1 &&all_of_v<Args...>; // COMPLIANT
89+
B1 && all_of_v<Args...>; // COMPLIANT
9090

9191
void test_template_variable() { all_of_v<true, true, true>; }
9292

@@ -118,4 +118,3 @@ static T another_templ_function(const First &first, const Rest &...rest) {
118118
}
119119

120120
static int templ_fnc2() { return another_templ_function<int>(1, 2, 3, 4, 5); }
121-
Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,24 @@
1-
const int cg1 = 3; // COMPLIANT - unused constant variable defined in header file.
1+
const int cg1 =
2+
3; // COMPLIANT - unused constant variable defined in header file.
3+
constexpr int cg2 =
4+
4; // COMPLIANT - unused constant variable defined in header file.
5+
extern const int cg3; // COMPLIANT - unused constant variable with external
6+
// linkage, defined in header file.
7+
inline const int cg4 = 5; // COMPLIANT - unused constant variable defined in
8+
// header file, with inline specifier.
9+
static const int cg5 = 6; // COMPLIANT - unused constant variable defined in
10+
// header file, with static specifier.
11+
12+
template <typename T>
13+
constexpr int cg6 = 7; // COMPLIANT - unused constant variable defined in header
14+
// file, with template.
15+
16+
namespace cg8ns {
17+
const int cg8 = 8; // COMPLIANT - unused constant variable defined in header
18+
// file, in a namespace.
19+
}
20+
21+
class HeaderClass {
22+
const int m1 = 9; // NON_COMPLIANT -- not namespace scope
23+
static const int m2 = 30234; // NON_COMPLIANT -- not namespace scope
24+
};

0 commit comments

Comments
 (0)