cppcheck 2.22.0 generates functionStatic for the following code:
#define CASE(index, method) \ case index: return CASE_##method((method)) #define CASE_method1(method) method() class Object { private: int m_num; public: Object() : m_num(0) {} void call(int index) { switch (index) { CASE(1, method1); } } private: void method1() { m_num = 1; } }; int main() { Object().call(1); return 0; }
test\main.cpp:11:7: style: The member function 'Object::call' can be static. [functionStatic] void call(int index) ^
Without parentheses around method, warning is not generated:
#define CASE(index, method) \ case index: return CASE_##method(method)
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15058
Log in to post a comment.
cppcheck 2.22.0 generates functionStatic for the following code:
Without parentheses around method, warning is not generated:
Thanks for reporting, ticket is here: https://trac.cppcheck.net/ticket/15058