THRIFT-1452 generate a swap() method for all generated structs

fix compiler warnings, when having empty structs

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1212593 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Roger Meier 2011-12-09 19:33:07 +00:00
parent 8516f58b77
commit e1d2458f1a

View File

@ -1526,6 +1526,14 @@ void t_cpp_generator::generate_struct_swap(ofstream& out, t_struct* tstruct) {
indent() << "swap(a.__isset, b.__isset);" << endl;
}
// handle empty structs
if (fields.size() == 0) {
out <<
indent() << "(void) a;" << endl;
out <<
indent() << "(void) b;" << endl;
}
scope_down(out);
out << endl;
}