Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/checkstring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,11 @@ void CheckString::strPlusCharError(const Token *tok)
static bool isMacroUsage(const Token* tok)
{
if (const Token* parent = tok->astParent()) {
while (parent && (parent->isCast() || parent->str() == "&&"))
while (parent && (parent->isCast() || parent->str() == "&&")) {
if (parent->isExpandedMacro())
return true;
parent = parent->astParent();
}
if (!parent)
return false;
if (parent->isExpandedMacro())
Expand Down
6 changes: 6 additions & 0 deletions test/teststring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,12 @@ class TestString : public TestFixture {
" MACRO(false && \"abc\");\n"
"}\n");
ASSERT_EQUALS("", errout_str());

check("#define strequ(s1,s2) ((void *)s1 && (void *)s2 && strcmp(s1, s2) == 0)\n" // #13093
"void f(const char* p) {\n"
" if (strequ(p, \"ALL\")) {}\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void deadStrcmp() {
Expand Down