Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler warnings when building #285

Closed
hubt opened this issue Apr 16, 2015 · 1 comment
Closed

Compiler warnings when building #285

hubt opened this issue Apr 16, 2015 · 1 comment

Comments

@hubt
Copy link

hubt commented Apr 16, 2015

Building on Ubuntu 14.04
vanilla ./configure, no options
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2

Lots of compiler warnings about unused local typedefs and uninitialized fields. Build works fine, but warnings are annoying.

Here's an unused local typedef:

In file included from ./google/protobuf/stubs/stringprintf.h:47:0,
                 from google/protobuf/stubs/stringprintf.cc:33:
google/protobuf/stubs/stringprintf.cc: In function 'std::string google::protobuf::StringPrintfVector(const char*, const std::vectorstd::basic_string<char >&)':
google/protobuf/stubs/stringprintf.cc:164:59: warning: typedef 'arg_count_mismatch' locally defined but not used [-Wunused-local-typedefs]
   GOOGLE_COMPILE_ASSERT(kStringPrintfVectorMaxArgs == 32, arg_count_mismatch);
                                                           ^
./google/protobuf/stubs/common.h:382:11: note: in definition of macro 'GOOGLE_COMPILE_ASSERT'
           msg[bool(expr) ? 1 : -1]
           ^

Here's a potentially uninitialized variable warning:


google/protobuf/generated_message_reflection.cc: In member function 'void google::protobuf::internal::GeneratedMessageReflection::SwapOneofField(google::protobuf::Message_, google::protobuf::Message_, const google::protobuf::OneofDescriptor*) const':
google/protobuf/generated_message_reflection.cc:503:54: warning: 'field1' may be used uninitialized in this function [-Wmaybe-uninitialized]
         SetField<TYPE>(message2, field1, temp_##TYPE);                  \
                                                      ^
google/protobuf/generated_message_reflection.cc:516:60: warning: 'temp_message' may be used uninitialized in this function [-Wmaybe-uninitialized]
         SetAllocatedMessage(message2, temp_message, field1);

@haberman
Copy link
Member

The current build (https://travis-ci.org/google/protobuf/jobs/211367266) no longer throws any "may be used uninitialized warnings. There are still a few "unused function" warnings: I am submitting changes to our internal code-base right now to fix these. These changes should propagate next time we sync to open-source.

@xfxyjwf xfxyjwf closed this as completed Dec 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants