Commit 573989f7 authored by kenton@google.com's avatar kenton@google.com

Explicitly call superclass constructor in generated code to avoid pedantic…

Explicitly call superclass constructor in generated code to avoid pedantic warning.  Based on patch from Oleg Smolsky.
parent 1a4193c2
......@@ -833,12 +833,17 @@ GenerateSharedDestructorCode(io::Printer* printer) {
void MessageGenerator::
GenerateStructors(io::Printer* printer) {
string superclass = HasDescriptorMethods(descriptor_->file()) ?
"Message" : "MessageLite";
// Generate the default constructor.
printer->Print(
"$classname$::$classname$() {\n"
"$classname$::$classname$()\n"
" : $superclass$() {\n"
" SharedCtor();\n"
"}\n",
"classname", classname_);
"classname", classname_,
"superclass", superclass);
printer->Print(
"\n"
......@@ -868,12 +873,14 @@ GenerateStructors(io::Printer* printer) {
// Generate the copy constructor.
printer->Print(
"$classname$::$classname$(const $classname$& from) {\n"
"$classname$::$classname$(const $classname$& from)\n"
" : $superclass$() {\n"
" SharedCtor();\n"
" MergeFrom(from);\n"
"}\n"
"\n",
"classname", classname_);
"classname", classname_,
"superclass", superclass);
// Generate the shared constructor code.
GenerateSharedConstructorCode(printer);
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment