parent
02b836baad
commit
18ee859737
|
@ -2246,7 +2246,7 @@ T* getTokenArgumentFunctionImpl(T* tok, int& argn)
|
|||
parent = parent->astParent();
|
||||
|
||||
// passing variable to subfunction?
|
||||
if (Token::Match(parent, "[*[(,{]"))
|
||||
if (Token::Match(parent, "[*[(,{]") || Token::Match(parent, "%oror%|&&"))
|
||||
;
|
||||
else if (Token::simpleMatch(parent, ":")) {
|
||||
while (Token::Match(parent, "[?:]"))
|
||||
|
|
|
@ -255,9 +255,13 @@ void CheckString::strPlusCharError(const Token *tok)
|
|||
static bool isMacroUsage(const Token* tok)
|
||||
{
|
||||
if (const Token* parent = tok->astParent()) {
|
||||
while (parent && parent->isCast())
|
||||
parent = parent->astParent();
|
||||
if (!parent)
|
||||
return false;
|
||||
if (parent->isExpandedMacro())
|
||||
return true;
|
||||
if (parent->isUnaryOp("!")) {
|
||||
if (parent->isUnaryOp("!") || parent->isComparisonOp()) {
|
||||
int argn{};
|
||||
const Token* ftok = getTokenArgumentFunction(parent, argn);
|
||||
if (ftok && !ftok->function())
|
||||
|
|
|
@ -799,6 +799,12 @@ private:
|
|||
" return false;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("void f(const int* p, const int* q) {\n"
|
||||
" assert((p != NULL && q != NULL) || !\"abc\");\n"
|
||||
" ASSERT((void*)(\"def\") == 0);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void deadStrcmp() {
|
||||
|
|
Loading…
Reference in New Issue