But if we do so, we got some hundreds warnings of Cppcheck because of unusedStructMember (we don't handle all values of header) and an uninitMemberVar hint in MyHandle. Is there a clean way to supress this warnings just for this struct without adding a cppcheck supressing hint to each member? I think a simple memset is not enough?
Regards
SunBlack
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
we have a struct, which we are using to read a header of a file.
So it looks like:
But if we do so, we got some hundreds warnings of Cppcheck because of unusedStructMember (we don't handle all values of header) and an uninitMemberVar hint in MyHandle. Is there a clean way to supress this warnings just for this struct without adding a cppcheck supressing hint to each member? I think a simple memset is not enough?
Regards
SunBlack
One way is to put StructMyHeader in a header file. This check only warns for structs declared in the non-included source file.
But it also feels like the check should somehow know that file.read will access all the struct members.