Good point, this was with -Wextra (which I had forgotten I compile with). I can understand if you're not interested in accommodating this. It is strange that -Wextra warns about this for this particular gcc version, but not others that I've tried.
On Aug 31, 4:49 pm, Kenton Varda <ken...@google.com> wrote: > What compiler flags are you using? Since you were able to compile > libprotobuf itself, I assume you have turned on additional warnings for your > own project? > > On Mon, Aug 31, 2009 at 3:26 PM, Joshua Haberman <jhaber...@gmail.com>wrote: > > > > > > > I just installed Snow Leopard, which ships with: > > > $ gcc --version > > i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) > > Copyright (C) 2007 Free Software Foundation, Inc. > > This is free software; see the source for copying conditions. There > > is NO > > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR > > PURPOSE. > > > The protobuf library compiled and installed fine, but the generated > > classes threw warnings (and since I was compiling with -Werror, failed > > to compile). The warning was: > > > benchmarks/google_messages.pb.cc: In copy constructor > > ‘benchmarks::SpeedMessage2::SpeedMessage2(const > > benchmarks::SpeedMessage2&)’: > > benchmarks/google_messages.pb.cc:4179: warning: base class ‘class > > google::protobuf::Message’ should be explicitly initialized in the > > copy constructor > > > I thought this was an odd warning, since the constructors don't > > explicitly initialize their base classes, and do not throw warnings. > > I also thought it was odd since other versions of gcc don't throw this > > warning AFAIK. > > > When I changed the copy constructors to explicitly initialize the > > parent class, the warnings went away, a la: > > > SpeedMessage2::SpeedMessage2(const SpeedMessage2& from) > > : google::protobuf::Message() { > > SharedCtor(); > > MergeFrom(from); > > } > > > Would you accept a patch that emits the above code for copy > > constructors? > > > Josh --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---