From e88b4dcf0628bb345d40aef1c7e3611d06f75f8e Mon Sep 17 00:00:00 2001 From: Alexander Mai Date: Wed, 3 May 2017 16:57:42 +0200 Subject: [PATCH] Add another check to Tokenizer::validateC(): C++ casts --- lib/tokenize.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 87d6e33ce..fee94d6fd 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8053,6 +8053,9 @@ void Tokenizer::validateC() const if (!isC()) return; for (const Token *tok = tokens(); tok; tok = tok->next()) { + // That might trigger false positives, but it's much faster to have this truncated pattern + if (Token::simpleMatch(tok, "const_cast|dynamic_cast|reinterpret_cast|static_cast <")) + syntaxErrorC(tok, "C++ cast <..."); // Template function.. if (Token::Match(tok, "%name% < %name% > (")) { const Token *tok2 = tok->tokAt(5);