Github user hcorg commented on a diff in the pull request:
https://github.com/apache/thrift/pull/626#discussion_r40451162
--- Diff: compiler/cpp/src/generate/t_cpp_generator.cc ---
@@ -1506,24 +1523,16 @@ void generate_fields(std::ofstream& out,
/**
* Generates operator<<
*/
-void t_cpp_generator::generate_struct_ostream_operator(std::ofstream& out,
t_struct* tstruct) {
+void t_cpp_generator::generate_struct_print_operator(std::ofstream& out,
t_struct* tstruct) {
out << indent();
- generate_struct_ostream_operator_decl(out, tstruct);
+ generate_struct_print_operator_decl(out, tstruct);
out << " {" << endl;
indent_up();
out << indent() << "using apache::thrift::to_string;" << endl;
-
- // eliminate compiler unused warning
- const vector<t_field*>& fields = tstruct->get_members();
- if (fields.empty())
- out << indent() << "(void) obj;" << endl;
--- End diff --
why this line is removed? I'm pretty sure struct/exception without fields
will generate warning "unused function parameter" for operator<</print method
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---