On Fri, 17 Feb 2023 09:53:28 +1100
David Gibson
On Thu, Feb 16, 2023 at 07:22:10PM +0100, Stefano Brivio wrote:
The newly introduced die() calls exit(), but cppcheck doesn't see it and warns about possibly invalid arguments used after the check which triggers die(). Add return statements to silence the warnings.
Signed-off-by: Stefano Brivio
Oof, that's super ugly. Any chance that cppcheck will recognize the ((noreturn)) attribute if we added it to die()?
It doesn't. I guess Library::isnoreturn() in lib/library.cpp is fooled by the way we build die with a macro. I couldn't find a corresponding ticket, there's a vaguely related false _negative_ here: https://trac.cppcheck.net/ticket/7933 but I admit I might have missed one from this list: https://trac.cppcheck.net/query?status=!closed&keywords=~valueflow I see a few alternatives: - move exit() after the function body, instead of using 'doexit', I couldn't find a "nice" way to do so but it should be possible - fix the issue in cppcheck - or... would you prefer if I use a cppcheck-suppress token here? -- Stefano