Skip to content

Commit 52be380

Browse files
committed
Fixed fix for cppcheck-opensource#7042 - support hexadecimal digits
1 parent 7112725 commit 52be380

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/preprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ std::string Preprocessor::removeComments(const std::string &str, const std::stri
662662
}
663663

664664
// C++14 digit separators
665-
if (ch == '\'' && std::isdigit(previous))
665+
if (ch == '\'' && std::isxdigit(previous))
666666
; // Just skip it.
667667

668668
// String or char constants..

test/testpreprocessor.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,10 @@ class TestPreprocessor : public TestFixture {
338338
}
339339

340340
void readCode5() {
341-
const char code[] = "int i = 0x1000'00;";
342-
ASSERT_EQUALS("int i = 0x100000;", preprocessorRead(code));
341+
ASSERT_EQUALS("int i = 0x100000;", preprocessorRead("int i = 0x1000'00;"));
342+
ASSERT_EQUALS("", errout.str());
343+
344+
ASSERT_EQUALS("int i = 0x0F0FFFFF;", preprocessorRead("int i = 0x0F0F'FFFF;"));
343345
ASSERT_EQUALS("", errout.str());
344346
}
345347

0 commit comments

Comments
 (0)