File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -372,6 +372,8 @@ void CheckCondition::comparison()
372372 std::swap (expr1,expr2);
373373 if (!expr2->isNumber ())
374374 continue ;
375+ if (!compareTokenFlags (expr1, expr2, /* macro*/ true ))
376+ continue ;
375377 const MathLib::bigint num2 = MathLib::toBigNumber (expr2->str ());
376378 if (num2 < 0 )
377379 continue ;
Original file line number Diff line number Diff line change @@ -495,6 +495,14 @@ class TestCondition : public TestFixture {
495495 " [test.cpp:2]: (style) Expression '(X & 0x100) == 0x200' is always false.\n "
496496 " [test.cpp:3]: (style) Expression '(X & 0x100) == 0x200' is always false.\n " ,
497497 errout_str ());
498+
499+ checkP (" #define MACRO1 (0x0010)\n " // #13222
500+ " #define MACRO2 (0x0020)\n "
501+ " #define MACRO_ALL (MACRO1 | MACRO2)\n "
502+ " void f() {\n "
503+ " if (MACRO_ALL == 0) {}\n "
504+ " }\n " );
505+ ASSERT_EQUALS (" " , errout_str ());
498506 }
499507
500508#define checkPureFunction (code ) checkPureFunction_(code, __FILE__, __LINE__)
You can’t perform that action at this time.
0 commit comments