Skip to content

Commit cf19372

Browse files
PKEuSdanmar
authored andcommitted
Refactorization: Removed unnecessary \n and spaces in strings
Merged from LCppC.
1 parent 25678a9 commit cf19372

35 files changed

Lines changed: 1284 additions & 1381 deletions

cli/cmdlineparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ void CmdLineParser::printHelp()
11711171
" --report-progress Report progress messages while checking a file.\n"
11721172
#ifdef HAVE_RULES
11731173
" --rule=<rule> Match regular expression.\n"
1174-
" --rule-file=<file> Use given rule file. For more information, see: \n"
1174+
" --rule-file=<file> Use given rule file. For more information, see:\n"
11751175
" http://sourceforge.net/projects/cppcheck/files/Articles/\n"
11761176
#endif
11771177
" --std=<id> Set standard.\n"

test/test64bit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class Test64BitPortability : public TestFixture {
248248

249249
// #7451: Lambdas
250250
check("const int* test(std::vector<int> outputs, const std::string& text) {\n"
251-
" auto it = std::find_if(outputs.begin(), outputs.end(), \n"
251+
" auto it = std::find_if(outputs.begin(), outputs.end(),\n"
252252
" [&](int ele) { return \"test\" == text; });\n"
253253
" return nullptr;\n"
254254
"}");

test/testassert.cpp

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,15 @@ class TestAssert : public TestFixture {
6363
" if (b) { a = 1+2 };\n"
6464
" return a;\n"
6565
"}\n"
66-
"assert(foo() == 3); \n"
67-
);
66+
"assert(foo() == 3);");
6867
ASSERT_EQUALS("", errout.str());
6968

7069
check(
7170
"int foo(int a) {\n"
7271
" int b=a+1;\n"
7372
" return b;\n"
7473
"}\n"
75-
"assert(foo(1) == 2); \n"
76-
);
74+
"assert(foo(1) == 2);");
7775
ASSERT_EQUALS("", errout.str());
7876
}
7977

@@ -84,8 +82,7 @@ class TestAssert : public TestFixture {
8482
" a = 1+2;\n"
8583
" return a;\n"
8684
"}\n"
87-
"assert(foo() == 3); \n"
88-
);
85+
"assert(foo() == 3);");
8986
ASSERT_EQUALS("[test.cpp:6]: (warning) Assert statement calls a function which may have desired side effects: 'foo'.\n", errout.str());
9087

9188
// Ticket #4937 "false positive: Assert calls a function which may have desired side effects"
@@ -97,7 +94,7 @@ class TestAssert : public TestFixture {
9794
"};\n"
9895
"void foo() {\n"
9996
" assert( !SquarePack::isRank1Or8(push2) );\n"
100-
"}\n");
97+
"}");
10198
ASSERT_EQUALS("", errout.str());
10299

103100
check("struct SquarePack {\n"
@@ -108,7 +105,7 @@ class TestAssert : public TestFixture {
108105
"};\n"
109106
"void foo() {\n"
110107
" assert( !SquarePack::isRank1Or8(push2) );\n"
111-
"}\n");
108+
"}");
112109
ASSERT_EQUALS("[test.cpp:8]: (warning) Assert statement calls a function which may have desired side effects: 'isRank1Or8'.\n", errout.str());
113110

114111
check("struct SquarePack {\n"
@@ -119,7 +116,7 @@ class TestAssert : public TestFixture {
119116
"};\n"
120117
"void foo() {\n"
121118
" assert( !SquarePack::isRank1Or8(push2) );\n"
122-
"}\n");
119+
"}");
123120
ASSERT_EQUALS("[test.cpp:8]: (warning) Assert statement calls a function which may have desired side effects: 'isRank1Or8'.\n", errout.str());
124121

125122
check("struct SquarePack {\n"
@@ -130,7 +127,7 @@ class TestAssert : public TestFixture {
130127
"};\n"
131128
"void foo() {\n"
132129
" assert( !SquarePack::isRank1Or8(push2) );\n"
133-
"}\n");
130+
"}");
134131
ASSERT_EQUALS("", errout.str());
135132
}
136133

@@ -172,60 +169,54 @@ class TestAssert : public TestFixture {
172169
" int a; a = 0;\n"
173170
" assert(a = 2);\n"
174171
" return a;\n"
175-
"}\n"
176-
);
172+
"}");
177173
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
178174

179175
check("void f(int a) {\n"
180176
" assert(a == 2);\n"
181177
" return a;\n"
182-
"}\n"
183-
);
178+
"}");
184179
ASSERT_EQUALS("", errout.str());
185180

186181
check("void f(int a, int b) {\n"
187182
" assert(a == 2 && (b = 1));\n"
188183
" return a;\n"
189-
"}\n"
190-
);
184+
"}");
191185
ASSERT_EQUALS("[test.cpp:2]: (warning) Assert statement modifies 'b'.\n", errout.str());
192186

193187
check("void f() {\n"
194188
" int a; a = 0;\n"
195189
" assert(a += 2);\n"
196190
" return a;\n"
197-
"}\n"
198-
);
191+
"}");
199192
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
200193

201194
check("void f() {\n"
202195
" int a; a = 0;\n"
203196
" assert(a *= 2);\n"
204197
" return a;\n"
205-
"}\n"
206-
);
198+
"}");
207199
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
208200

209201
check("void f() {\n"
210202
" int a; a = 0;\n"
211203
" assert(a -= 2);\n"
212204
" return a;\n"
213-
"}\n"
214-
);
205+
"}");
215206
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
216207

217208
check("void f() {\n"
218209
" int a = 0;\n"
219210
" assert(a--);\n"
220211
" return a;\n"
221-
"}\n");
212+
"}");
222213
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
223214

224215
check("void f() {\n"
225216
" int a = 0;\n"
226217
" assert(--a);\n"
227218
" return a;\n"
228-
"}\n");
219+
"}");
229220
ASSERT_EQUALS("[test.cpp:3]: (warning) Assert statement modifies 'a'.\n", errout.str());
230221

231222
check("void f() {\n"
@@ -234,7 +225,7 @@ class TestAssert : public TestFixture {
234225
" auto const expected = someOtherValue;\n"
235226
" return tmp == expected;\n"
236227
" }));\n"
237-
"}\n");
228+
"}");
238229
ASSERT_EQUALS("", errout.str());
239230
}
240231

0 commit comments

Comments
 (0)