From a412e3e1f16982585a4b58ca05ddbb1e3b2206b4 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 29 Jun 2020 15:33:25 -0500 Subject: [PATCH] Mark syntax error functions as noreturn --- lib/symboldatabase.cpp | 1 - lib/tokenize.h | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 601a82f38..07af526d9 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -3560,7 +3560,6 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s typeTok = typeTok->next(); if (Token::Match(typeTok, ",|)")) { // #8333 symbolDatabase->mTokenizer->syntaxError(typeTok); - return; } // skip over qualification while (Token::Match(typeTok, "%type% ::")) diff --git a/lib/tokenize.h b/lib/tokenize.h index da236ecf4..950efb296 100644 --- a/lib/tokenize.h +++ b/lib/tokenize.h @@ -607,16 +607,16 @@ private: public: /** Syntax error */ - void syntaxError(const Token *tok, const std::string &code = "") const; + [[noreturn]] void syntaxError(const Token *tok, const std::string &code = "") const; /** Syntax error. Unmatched character. */ - void unmatchedToken(const Token *tok) const; + [[noreturn]] void unmatchedToken(const Token *tok) const; /** Syntax error. C++ code in C file. */ - void syntaxErrorC(const Token *tok, const std::string &what) const; + [[noreturn]] void syntaxErrorC(const Token *tok, const std::string &what) const; /** Warn about unknown macro(s), configuration is recommended */ - void unknownMacroError(const Token *tok1) const; + [[noreturn]] void unknownMacroError(const Token *tok1) const; private: