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
2 changes: 2 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8765,6 +8765,8 @@ void Tokenizer::findGarbageCode() const
syntaxError(tok, prev == tok->previous() ? (prev->str() + " " + tok->str()) : (prev->str() + " .. " + tok->str()));
}
}
else if (tok->isStandardType() && tok->next() && tok->str() == tok->strAt(1) && tok->str() != "long")
syntaxError(tok);
}

// invalid struct declaration
Expand Down
4 changes: 2 additions & 2 deletions test/cli/other_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ def test_addon_misc(tmpdir):
f.write("""
extern void f()
{
char char* [] = {"a" "b"}
const char* c[] = {"a" "b"};
}
""")

Expand All @@ -800,7 +800,7 @@ def test_addon_misc(tmpdir):
assert lines == [
'Checking {} ...'.format(test_file)
]
assert stderr == '{}:4:26: style: String concatenation in array initialization, missing comma? [misc-stringConcatInArrayInit]\n'.format(test_file)
assert stderr == '{}:4:28: style: String concatenation in array initialization, missing comma? [misc-stringConcatInArrayInit]\n'.format(test_file)


def test_invalid_addon_json(tmpdir):
Expand Down
4 changes: 4 additions & 0 deletions test/testgarbage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class TestGarbage : public TestFixture {
TEST_CASE(garbageCode228);
TEST_CASE(garbageCode229);
TEST_CASE(garbageCode230);
TEST_CASE(garbageCode231);

TEST_CASE(garbageCodeFuzzerClientMode1); // test cases created with the fuzzer client, mode 1

Expand Down Expand Up @@ -1775,6 +1776,9 @@ class TestGarbage : public TestFixture {
void garbageCode230() { // #14432
ASSERT_THROW_INTERNAL(checkCode("e U U,i"), SYNTAX);
}
void garbageCode231() {
ASSERT_THROW_INTERNAL(checkCode("char char* [] = {\"a\" \"b\"}"), SYNTAX);
}


void syntaxErrorFirstToken() {
Expand Down
Loading