You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Handle format string patterns first (these are complex and specific)
229
-
result = std::regex_replace(
230
-
result,
231
-
std::regex(
232
-
R"(%[a-zA-Z0-9]+ in format string \(no\. \d+\) requires '[^']*' but the argument type is '[^']*'\.)"),
233
-
"Format specifier in format string requires different argument type than provided.");
234
-
result = std::regex_replace(
235
-
result,
236
-
std::regex(R"(%[a-zA-Z0-9]+ in format string \(no\. N\) requires '[^']*' but the argument type is '[^']*'\.)"),
237
-
"Format specifier in format string requires different argument type than provided.");
228
+
// Handle format string patterns first (before general single-quoted replacement)
229
+
result = std::regex_replace(result, std::regex(R"(%[a-zA-Z0-9]+)"), "format specifier");
238
230
239
-
// Handle specific pointer casting patterns
240
-
// Handle multi-word types like "unsigned char", "const float", etc.
231
+
// Handle specific casting patterns
241
232
result = std::regex_replace(
242
233
result,
243
234
std::regex(
244
-
R"(Casting between (?:(?:const|unsigned|signed)\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*\s*and(?:(?:const|unsigned|signed)\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*\s*which have)"),
235
+
R"(Casting between (?:(?:const\s+|unsigned\s+|signed\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*+\s*and\s*(?:const\s+|unsigned\s+|signed\s+)*[a-zA-Z_][a-zA-Z0-9_]*\s*\*+) which have)"),
245
236
"Casting between incompatible pointer types which have");
246
237
247
-
// Handle iterator condition patterns - be specific about the pattern
238
+
// Handle specific pointer type patterns (after casting patterns)
248
239
result = std::regex_replace(
249
-
result,
250
-
std::regex(
251
-
R"(Either the condition '[^']*' is redundant or there is possible dereference of an invalid iterator: [^\.]*\.)"),
252
-
"Either the condition is redundant or there is possible dereference of an invalid iterator.");
Copy file name to clipboardExpand all lines: test/testerrorlogger.cpp
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -508,6 +508,7 @@ class TestErrorLogger : public TestFixture {
508
508
"17 Programming error"
509
509
"17 Programming error"
510
510
"0 "
511
+
"17 Programming error"
511
512
"0 ", msg_str);
512
513
513
514
ErrorMessage msg2;
@@ -550,9 +551,11 @@ class TestErrorLogger : public TestFixture {
550
551
"1 0"
551
552
"0 "
552
553
"8 test.cpp"
554
+
"1 0"
553
555
"17 Programming error"
554
556
"17 Programming error"
555
557
"0 "
558
+
"17 Programming error"
556
559
"0 ";
557
560
ErrorMessage msg;
558
561
ASSERT_THROW_INTERNAL_EQUALS(msg.deserialize(str), INTERNAL, "Internal Error: Deserialization of error message failed - invalid CWE ID - not an integer");
@@ -563,12 +566,13 @@ class TestErrorLogger : public TestFixture {
563
566
"5 error"
564
567
"1 0"
565
568
"7 invalid"// hash
566
-
"1 0"
567
569
"0 "
568
570
"8 test.cpp"
571
+
"1 0"
569
572
"17 Programming error"
570
573
"17 Programming error"
571
574
"0 "
575
+
"17 Programming error"
572
576
"0 ";
573
577
ErrorMessage msg;
574
578
ASSERT_THROW_INTERNAL_EQUALS(msg.deserialize(str), INTERNAL, "Internal Error: Deserialization of error message failed - invalid hash - not an integer");
@@ -606,6 +610,7 @@ class TestErrorLogger : public TestFixture {
606
610
"33 Illegal character in \"foo\\001bar\""
607
611
"33 Illegal character in \"foo\\001bar\""
608
612
"0 "
613
+
"29 Illegal character in \"string\""
609
614
"0 ", msg_str);
610
615
611
616
ErrorMessage msg2;
@@ -634,6 +639,7 @@ class TestErrorLogger : public TestFixture {
0 commit comments