From 4ee82b0e35b598179834c13f66ba12011bf327b9 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Sat, 25 May 2024 22:42:01 +0200 Subject: [PATCH] Fix --- cfg/qt.cfg | 1 + lib/tokenize.cpp | 2 +- test/testsimplifytokens.cpp | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cfg/qt.cfg b/cfg/qt.cfg index 8d599ed5d3d..4a662fa91a9 100644 --- a/cfg/qt.cfg +++ b/cfg/qt.cfg @@ -5363,6 +5363,7 @@ + diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index b95f72322fc..b20ccee88c9 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8749,7 +8749,7 @@ void Tokenizer::findGarbageCode() const } if (isCPP() && tok->str() == "namespace" && tok->tokAt(-1)) { if (!Token::Match(tok->tokAt(-1), ";|{|}|using|inline")) { - if (tok->linkAt(-1) && tok->linkAt(-1) && tok->linkAt(-1)->tokAt(-1) && tok->linkAt(-1)->tokAt(-1)->isUpperCaseName()) + if (tok->linkAt(-1) && tok->linkAt(-1)->tokAt(-1) && tok->linkAt(-1)->tokAt(-1)->isUpperCaseName()) unknownMacroError(tok->linkAt(-1)->tokAt(-1)); else syntaxError(tok); diff --git a/test/testsimplifytokens.cpp b/test/testsimplifytokens.cpp index 01753599f38..533b01d585a 100644 --- a/test/testsimplifytokens.cpp +++ b/test/testsimplifytokens.cpp @@ -586,8 +586,6 @@ class TestSimplifyTokens : public TestFixture { { const char code[] = "void f(int namespace) { }"; - const char expected[] = "void f ( int namespace ) { }"; - ASSERT_THROW_INTERNAL(tok(code), SYNTAX); } }