Skip to content

Commit 05b7173

Browse files
Update check64bit.cpp
1 parent 21163e8 commit 05b7173

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

lib/check64bit.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ namespace {
4040
Check64BitPortability instance;
4141
}
4242

43+
static bool isFunctionPointer(const Token* tok)
44+
{
45+
if (!tok || !tok->variable())
46+
return false;
47+
return Token::Match(tok->variable()->nameToken(), "%name% ) (");
48+
}
49+
4350
void Check64BitPortability::pointerassignment()
4451
{
4552
if (!mSettings->severity.isEnabled(Severity::portability))
@@ -103,7 +110,8 @@ void Check64BitPortability::pointerassignment()
103110
!tok->astOperand2()->isNumber() &&
104111
rhstype->pointer == 0U &&
105112
rhstype->originalTypeName.empty() &&
106-
rhstype->type == ValueType::Type::INT)
113+
rhstype->type == ValueType::Type::INT &&
114+
!isFunctionPointer(tok->astOperand1()))
107115
assignmentIntegerToAddressError(tok);
108116

109117
// Assign pointer to integer..

0 commit comments

Comments
 (0)