Skip to content

Commit 5859d52

Browse files
committed
change string of token inserted for unnamed bit-fields
1 parent c648c5f commit 5859d52

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

lib/tokenize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10037,7 +10037,7 @@ void Tokenizer::simplifyBitfields()
1003710037
} else if (Token::Match(typeTok, "%type% : %num%|%bool% ;") &&
1003810038
typeTok->str() != "default") {
1003910039
const std::size_t id = anonymousBitfieldCounter++;
10040-
const std::string name = "__cppcheck_anon_bit_field_" + std::to_string(id) + "__";
10040+
const std::string name = "anonymous@" + std::to_string(id);
1004110041
Token *newTok = typeTok->insertToken(name);
1004210042
newTok->isAnonymousBitfield(true);
1004310043
if (newTok->tokAt(2)->isBoolean())

test/testtokenize.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4724,7 +4724,7 @@ class TestTokenizer : public TestFixture {
47244724
ASSERT_EQUALS("struct RGB { unsigned int r ; unsigned int g ; unsigned int b ; } ;", tokenizeAndStringify(code1));
47254725

47264726
const char code2[] = "struct A { int a : 3; int : 3; int c : 3; };";
4727-
ASSERT_EQUALS("struct A { int a ; int __cppcheck_anon_bit_field_0__ ; int c ; } ;", tokenizeAndStringify(code2));
4727+
ASSERT_EQUALS("struct A { int a ; int anonymous@0 ; int c ; } ;", tokenizeAndStringify(code2));
47284728

47294729
const char code3[] = "struct A { virtual void f() {} int f1 : 1; };";
47304730
ASSERT_EQUALS("struct A { virtual void f ( ) { } int f1 ; } ;", tokenizeAndStringify(code3));
@@ -4738,7 +4738,7 @@ class TestTokenizer : public TestFixture {
47384738
ASSERT_EQUALS("struct A { bool b ; bool c ; } ;", tokenizeAndStringify(code2));
47394739

47404740
const char code3[] = "struct A { bool : true; };";
4741-
ASSERT_EQUALS("struct A { bool __cppcheck_anon_bit_field_0__ ; } ;", tokenizeAndStringify(code3));
4741+
ASSERT_EQUALS("struct A { bool anonymous@0 ; } ;", tokenizeAndStringify(code3));
47424742
}
47434743

47444744
void bitfields7() { // ticket #1987
@@ -4789,7 +4789,7 @@ class TestTokenizer : public TestFixture {
47894789

47904790
void bitfields12() { // ticket #3485 (segmentation fault)
47914791
const char code[] = "{a:1;};\n";
4792-
ASSERT_EQUALS("{ a __cppcheck_anon_bit_field_0__ ; } ;", tokenizeAndStringify(code));
4792+
ASSERT_EQUALS("{ a anonymous@0 ; } ;", tokenizeAndStringify(code));
47934793
}
47944794

47954795
void bitfields13() { // ticket #3502 (segmentation fault)
@@ -4829,9 +4829,9 @@ class TestTokenizer : public TestFixture {
48294829
"};\n";
48304830
const char expected[] = "struct S {\n"
48314831
"volatile uint32_t a ;\n"
4832-
"volatile uint32_t __cppcheck_anon_bit_field_0__ ;\n"
4832+
"volatile uint32_t anonymous@0 ;\n"
48334833
"volatile uint32_t b ;\n"
4834-
"volatile uint32_t __cppcheck_anon_bit_field_1__ ;\n"
4834+
"volatile uint32_t anonymous@1 ;\n"
48354835
"} ;";
48364836
ASSERT_EQUALS(expected, tokenizeAndStringify(code));
48374837

@@ -4841,7 +4841,7 @@ class TestTokenizer : public TestFixture {
48414841
"};\n";
48424842
const char expected2[] = "struct S {\n"
48434843
"const volatile uint32_t a ;\n"
4844-
"const volatile uint32_t __cppcheck_anon_bit_field_0__ ;\n"
4844+
"const volatile uint32_t anonymous@0 ;\n"
48454845
"} ;";
48464846
ASSERT_EQUALS(expected2, tokenizeAndStringify(code2));
48474847
}

0 commit comments

Comments
 (0)