VC2008 with level warning 4 produces several warnings:
1>google\protobuf\stubs\common.h(1201) : warning C4512: 'google::protobuf::FatalException' : assignment operator could not be generated
1>google\protobuf\io\coded_stream.h(901) : warning C4244: '=' : conversion from 'google::protobuf::uint32' to google::protobuf::uint8', possible loss of data
1>google\protobuf\io\coded_stream.h(965) : warning C4244: '=' : conversion from 'google::protobuf::uint32' to google::protobuf::uint8', possible loss of data
There are also few warnings I don't know how to handle properly
protobuf-2.4.1\src\google\protobuf\text_format.cc:126: warning: C4355: 'this' : used in base member initializer list protobuf-2.4.1\src\google\protobuf\compiler\importer.cc:118: warning: C4355: 'this' : used in base member initializer list
protobuf-2.4.1\src\google\protobuf\text_format.cc:423: warning: C4800: 'google::protobuf::uint64' : forcing value to bool 'true' or 'false' (performance warning) protobuf-2.4.1\src\google\protobuf\text_format.cc:423: warning: C4800: 'google::protobuf::uint64' : forcing value to bool 'true' or 'false' (performance warning) protobuf-2.4.1\src\google\protobuf\generated_message_reflection.cc:1149: warning: C4800: 'const google::protobuf::uint32' : forcing value to bool 'true' or 'false' (performance warning)
In my setup, at least, GCC doesn't complain about "forcing value to bool", or about "'this' : used in base member initializer list".
I frankly think the "forcing value to bool" is a bogus error that should be suppressed in everyone's project. I honestly don't believe there is any significant "performance" penalty at all - the last time I looked at the generated code for bool a = x; and bool a = (x != 0); they were exactly the same.
The unit test warning probably should be suppressed with a pragma BUT if it isn't bothering people within Google IMHO this is a much lower priority.
As an external developer who makes heavy use of protocol buffers, I only ever ran the Google unit tests one time, and I really didn't care if there were a few warnings there. But warnings in my main build are troublesome because I like to have none at all so I can clearly see "real" warnings when they come up.
I've fixed all warnings in protobuf itself, only warnings for unittests
left:
google/protobuf/compiler/cpp/cpp_unittest.cc:878:5: ошибка: case value
«12589235» not in enumerated type «protobuf_unittest::TestSparseEnum»
[-Werror=switch]
It's the convention at Google to use "int" as loop counters, which makes it
pointless to update the code to use "size_t" as it's inevitable that new
code will introduce more "int"s in the future.
Unless Google's style guide discourages the use of "int", we shouldn't
bother to make the change.