From a9db06c641862761014c8b5a0f93285a4c901b89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Mon, 25 May 2015 18:06:20 +0200 Subject: [PATCH] longCast: Only warn when original name is 'long'. avoids some FPs when typedef types are used. --- lib/checktype.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/checktype.cpp b/lib/checktype.cpp index 3e5515097..1fde04836 100644 --- a/lib/checktype.cpp +++ b/lib/checktype.cpp @@ -315,7 +315,7 @@ void CheckType::checkLongCast() for (const Token *tok = _tokenizer->tokens(); tok; tok = tok->next()) { if (!Token::Match(tok, "%var% =")) continue; - if (!tok->variable() || !tok->variable()->isConst() || tok->variable()->typeStartToken()->str() != "long") + if (!tok->variable() || !tok->variable()->isConst() || tok->variable()->typeStartToken()->originalName() != "long") continue; if (Token::Match(tok->next()->astOperand2(), "*|<<") && astIsIntResult(tok->next()->astOperand2())) longCastAssignError(tok); @@ -331,7 +331,7 @@ void CheckType::checkLongCast() const Token * def = scope->classDef; bool islong = false; while (Token::Match(def, "%type%|::")) { - if (def->str() == "long") { + if (def->originalName() == "long") { islong = true; break; }