First, thank you for making cppcheck :)
Following snippet produces "unused private function" [unusedPrivateFunction] style warning, despite the use of [[maybe_unused]] attribute which one could expect to be recognized by cppcheck based on this post: https://sourceforge.net/p/cppcheck/news/2021/04/c17-support-in-cppcheck/
class Foo { private: [[maybe_unused]] int Return42() { return 42; } }; void f() { [[maybe_unused]] Foo foo; }
I tested with cppcheck 2.9 and was able to reproduce in online demo tool.
Thanks for reporting, fixed by https://github.com/danmar/cppcheck/pull/4579
Log in to post a comment.
First, thank you for making cppcheck :)
Following snippet produces "unused private function" [unusedPrivateFunction] style warning, despite the use of [[maybe_unused]] attribute which one could expect to be recognized by cppcheck based on this post: https://sourceforge.net/p/cppcheck/news/2021/04/c17-support-in-cppcheck/
I tested with cppcheck 2.9 and was able to reproduce in online demo tool.
Last edit: Artem Amirkhanov 2022-11-10
Thanks for reporting, fixed by https://github.com/danmar/cppcheck/pull/4579