I'm using cppcheck through the platformio ide and it fails on this part of my code
template <class... Args> Iterator emplace(Args&&... args) { Node* node = new(std::nothrow) Node(std::forward<Args>(args) ...); ... }
"[high:error] Cyclic reverse analysis. [cppcheckError]"
I actually don't know what the message means. The code is running fine though.
PS Thanks to cppcheck I did find another (?) bug!
It is a bug in Cppcheck so nothing you can fix in your code.
If you want you can create a short example code that reproduce the problem then we can try to fix it.
is it possible to suppress the error?
I'll create an example when Im back at my PC
template <class... Args> bool emplace(Args&&... args) { Node* node = new (std::nothrow) Node(std::forward<Args>(args) ...); if (node) { if (!_first) { _first = _last = node; } else { node->prev = _last; _last->next = node; _last = node; } return true } return false; }
https://cppcheck.sourceforge.io/demo/ results in Cppcheck 2.8 [test.cpp:3]: (error) Cyclic reverse analysis. Done!
template <class... Args> bool emplace(Args&&... args) { Node* node = nullptr; node = new (std::nothrow) Node(std::forward<Args>(args) ...); if (node) { if (!_first) { _first = _last = node; } else { node->prev = _last; _last->next = node; _last = node; } return true } return false; }
"[test.cpp:5]: (style) Condition 'node' is always false"
template <class... Args> bool emplace(Args&&... args) { Node* node = nullptr; node = new (std::nothrow) Node(std::forward<Args>(args) ...); if (node != nullptr) { if (!_first) { _first = _last = node; } else { node->prev = _last; _last->next = node; _last = node; } return true } return false; }
This passes without errors
Ticket created here: https://trac.cppcheck.net/ticket/11103
Log in to post a comment.
I'm using cppcheck through the platformio ide and it fails on this part of my code
"[high:error] Cyclic reverse analysis. [cppcheckError]"
I actually don't know what the message means. The code is running fine though.
PS Thanks to cppcheck I did find another (?) bug!
It is a bug in Cppcheck so nothing you can fix in your code.
If you want you can create a short example code that reproduce the problem then we can try to fix it.
is it possible to suppress the error?
I'll create an example when Im back at my PC
Last edit: Bert 2022-05-27
https://cppcheck.sourceforge.io/demo/ results in
Cppcheck 2.8
[test.cpp:3]: (error) Cyclic reverse analysis.
Done!
Last edit: Bert 2022-05-27
"[test.cpp:5]: (style) Condition 'node' is always false"
This passes without errors
Ticket created here: https://trac.cppcheck.net/ticket/11103