The following small test case extracted from a larger program with cppcheck 1.71 (but not 1.52) gives
$ cppcheck --enable=all below.cpp
[...:4]: (style) union member 'Anonymous0::r' is never used.
It is being set, and read through the other member. I can appreciate some use of unions is for two disjoint but non-simultanious data sets in which case not using one would be an error, but perhaps if you see a union with two members, one being written and the other read, you could auto suppress it?
The following small test case extracted from a larger program with cppcheck 1.71 (but not 1.52) gives
$ cppcheck --enable=all below.cpp
It is being set, and read through the other member. I can appreciate some use of unions is for two disjoint but non-simultanious data sets in which case not using one would be an error, but perhaps if you see a union with two members, one being written and the other read, you could auto suppress it?
If you can reproduce it with the latest version still (1.72) you should report it on http://trac.cppcheck.net !