cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

mitigated `Unchecked return value` Coverity warnings

Open firewave opened this issue 1 year ago • 6 comments

firewave avatar Feb 12 '24 23:02 firewave

@pfultz2 please have a look.

firewave avatar Feb 12 '24 23:02 firewave

These are not a false positives. The analysis looks at the code and if it sees that the return value is used in most cases it flags it as unintentional and a potential issue. If we would enable the clang-tidy warning about introducing [[nodiscard]] that would probably come up as well.

firewave avatar Feb 13 '24 16:02 firewave

These are not a false positives. The analysis looks at the code and if it sees that the return value is used in most cases it flags it as unintentional and a potential issue.

well.. from my point of view that ARE false positives. If we ignore the return values by intention then they are false positives. If they are true positives (we unintentionally ignore the result) then you shouldn't add void casts.

I don't classify a finding as false positive or true positive depending on what heuristics the tool use. The heuristic coverity uses is not insane at all. I do feel it could probably detect some genuine bugs also.

danmar avatar Feb 26 '24 11:02 danmar

I will still wait for feedback from @pfultz2 as I have no idea if this was intentional or not.

firewave avatar Feb 26 '24 13:02 firewave

I will still wait for feedback from @pfultz2 as I have no idea if this was intentional or not.

I vote to merge this because it is good practice to be explicit. By casting a return value to void, its clear that the return value is ignored in this context.

orbitcowboy avatar Mar 12 '24 07:03 orbitcowboy

I vote to merge this because it is good practice to be explicit. By casting a return value to void, its clear that the return value is ignored in this context.

Watch out for more fun in that area soon.

firewave avatar Mar 12 '24 15:03 firewave