@@ -3738,20 +3738,20 @@ static bool isNotEqual(std::pair<const Token*, const Token*> x, std::pair<const
37383738 start2 = skipCVRefs (start2, y.second );
37393739 return !(start1 == x.second && start2 == y.second );
37403740}
3741- static bool isNotEqual (std::pair<const Token*, const Token*> x, const std::string& y)
3741+ static bool isNotEqual (std::pair<const Token*, const Token*> x, const std::string& y, bool cpp )
37423742{
37433743 TokenList tokenList (nullptr );
37443744 std::istringstream istr (y);
3745- tokenList.createTokens (istr);
3745+ tokenList.createTokens (istr, cpp ? Settings::Language::CPP : Settings::Language::C );
37463746 return isNotEqual (x, std::make_pair (tokenList.front (), tokenList.back ()));
37473747}
3748- static bool isNotEqual (std::pair<const Token*, const Token*> x, const ValueType* y)
3748+ static bool isNotEqual (std::pair<const Token*, const Token*> x, const ValueType* y, bool cpp )
37493749{
37503750 if (y == nullptr )
37513751 return false ;
37523752 if (y->originalTypeName .empty ())
37533753 return false ;
3754- return isNotEqual (x, y->originalTypeName );
3754+ return isNotEqual (x, y->originalTypeName , cpp );
37553755}
37563756
37573757static bool isDifferentType (const Token* src, const Token* dst)
@@ -3766,9 +3766,9 @@ static bool isDifferentType(const Token* src, const Token* dst)
37663766 std::pair<const Token*, const Token*> parentdecl = Token::typeDecl (dst);
37673767 if (isNotEqual (decl, parentdecl))
37683768 return true ;
3769- if (isNotEqual (decl, dst->valueType ()))
3769+ if (isNotEqual (decl, dst->valueType (), dst-> isCpp () ))
37703770 return true ;
3771- if (isNotEqual (parentdecl, src->valueType ()))
3771+ if (isNotEqual (parentdecl, src->valueType (), src-> isCpp () ))
37723772 return true ;
37733773 }
37743774 return false ;
@@ -7592,7 +7592,7 @@ static void valueFlowLibraryFunction(Token *tok, const std::string &returnValue,
75927592 if (returnValue.find (" arg" ) != std::string::npos && argValues.empty ())
75937593 return ;
75947594 productParams (settings, argValues, [&](const std::unordered_map<nonneg int , ValueFlow::Value>& arg) {
7595- ValueFlow::Value value = evaluateLibraryFunction (arg, returnValue, settings);
7595+ ValueFlow::Value value = evaluateLibraryFunction (arg, returnValue, settings, tok-> isCpp () );
75967596 if (value.isUninitValue ())
75977597 return ;
75987598 ValueFlow::Value::ValueKind kind = ValueFlow::Value::ValueKind::Known;
@@ -9086,11 +9086,11 @@ static bool getMinMaxValues(const ValueType *vt, const Platform &platform, MathL
90869086 return true ;
90879087}
90889088
9089- static bool getMinMaxValues (const std::string &typestr, const Settings *settings, MathLib::bigint &minvalue, MathLib::bigint &maxvalue)
9089+ static bool getMinMaxValues (const std::string &typestr, const Settings *settings, bool cpp, MathLib::bigint &minvalue, MathLib::bigint &maxvalue)
90909090{
90919091 TokenList typeTokens (settings);
90929092 std::istringstream istr (typestr+" ;" );
9093- if (!typeTokens.createTokens (istr))
9093+ if (!typeTokens.createTokens (istr, cpp ? Settings::Language::CPP : Settings::Language::C ))
90949094 return false ;
90959095 typeTokens.simplifyPlatformTypes ();
90969096 typeTokens.simplifyStdType ();
@@ -9210,7 +9210,7 @@ static void valueFlowUnknownFunctionReturn(TokenList &tokenlist, const Settings
92109210 // Get min/max values for return type
92119211 const std::string &typestr = settings->library .returnValueType (tok->previous ());
92129212 MathLib::bigint minvalue, maxvalue;
9213- if (!getMinMaxValues (typestr, settings, minvalue, maxvalue))
9213+ if (!getMinMaxValues (typestr, settings, tok-> isCpp (), minvalue, maxvalue))
92149214 continue ;
92159215
92169216 for (MathLib::bigint value : unknownValues) {
0 commit comments