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
-~----------~----~----~----~------~----~------~--~---

Reply via email to