Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/token.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ static const std::unordered_set<std::string> stdTypes = { "bool"
, "int"
, "long"
, "short"
, "size_t"
, "void"
, "wchar_t"
, "signed"
Expand Down
17 changes: 0 additions & 17 deletions test/testtoken.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,6 @@ class TestToken : public TestFixture {
standard_types.emplace_back("long");
standard_types.emplace_back("float");
standard_types.emplace_back("double");
standard_types.emplace_back("size_t");

for (auto test_op = standard_types.cbegin(); test_op != standard_types.cend(); ++test_op) {
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
Expand Down Expand Up @@ -1484,13 +1483,6 @@ class TestToken : public TestFixture {
tok.str("char"); // not treated as keyword in TokenList::isKeyword()
assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
}
{
TokenList list_c{settingsDefault, Standards::Language::C};
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
Token tok(list_c, std::move(tokensFrontBack));
tok.str("size_t"); // not treated as keyword in TokenList::isKeyword()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no assertion so this whole block of code seems redundant now. but would it be a good idea to keep the assertion and ensure that std is false instead?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size_t will be simplified, so testing the token's properties has no purpose. I'll remove the code blocks.

assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
}
}

void update_property_info_etype_cpp() const
Expand All @@ -1502,21 +1494,12 @@ class TestToken : public TestFixture {
tok.str("bool"); // not treated as keyword in TokenList::isKeyword()
assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
}
{
TokenList list_cpp{settingsDefault, Standards::Language::CPP};
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
Token tok(list_cpp, std::move(tokensFrontBack));
tok.str("size_t");
assert_tok(&tok, Token::Type::eType, /*l=*/ false, /*std=*/ true);
}
}

void update_property_info_replace() const // #13743
{
auto tokensFrontBack = std::make_shared<TokensFrontBack>();
Token tok(list, std::move(tokensFrontBack));
tok.str("size_t");
assert_tok(&tok, Token::Type::eType, false, true);
tok.str("long");
assert_tok(&tok, Token::Type::eType, false, true);
}
Expand Down
2 changes: 2 additions & 0 deletions test/testtokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7845,6 +7845,8 @@ class TestTokenizer : public TestFixture {
"}\n"));

ignore_errout();

ASSERT_EQUALS(";", tokenizeAndStringify("typedef std::size_t size_t;\n")); // #14809
}


Expand Down
2 changes: 1 addition & 1 deletion test/testvarid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2840,7 +2840,7 @@ class TestVarID : public TestFixture {
void varid_using() {
// #3648
const char code[] = "using std::size_t;";
const char expected[] = "1: using unsigned long ;\n";
const char expected[] = "1: ;\n";
ASSERT_EQUALS(expected, tokenize(code));
}

Expand Down
Loading