You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2015/08/02 16:33:44 UTC
thrift git commit: THRIFT-3284 c_glib: Compiler: Omit
processing-function defs for empty services
Repository: thrift
Updated Branches:
refs/heads/master c76a9ecdd -> c1febebef
THRIFT-3284 c_glib: Compiler: Omit processing-function defs for empty services
This closes: #575
Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/c1febebe
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/c1febebe
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/c1febebe
Branch: refs/heads/master
Commit: c1febebef64f854824a5fb5a93c6d06789242942
Parents: c76a9ec
Author: Simon South <ss...@simonsouth.com>
Authored: Sat Aug 1 10:57:21 2015 +0000
Committer: Roger Meier <ro...@apache.org>
Committed: Sun Aug 2 16:19:06 2015 +0200
----------------------------------------------------------------------
compiler/cpp/src/generate/t_c_glib_generator.cc | 44 +++++++++++---------
1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/thrift/blob/c1febebe/compiler/cpp/src/generate/t_c_glib_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index 4fd6412..6603fa1 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -2055,29 +2055,33 @@ void t_c_glib_generator::generate_service_processor(t_service* tservice) {
}
f_service_ << endl;
- // Generate the processor's processing-function definitions
- f_service_ << indent() << "static " << process_function_def_type_name << endl
- << indent() << class_name_lc << "_process_function_defs["
- << functions.size() << "] = {" << endl;
- indent_up();
- for (function_iter = functions.begin();
- function_iter != functions.end();
- ++function_iter) {
- string service_function_name = (*function_iter)->get_name();
- string process_function_name = class_name_lc + "_process_"
- + initial_caps_to_underscores(service_function_name);
-
- f_service_ << indent() << "{" << endl;
+ // Generate the processor's processing-function definitions, if the service
+ // defines any methods
+ if (functions.size() > 0) {
+ f_service_ << indent() << "static " << process_function_def_type_name
+ << endl
+ << indent() << class_name_lc << "_process_function_defs["
+ << functions.size() << "] = {" << endl;
indent_up();
- f_service_ << indent() << "\"" << service_function_name << "\"," << endl
- << indent() << process_function_name << endl;
+ for (function_iter = functions.begin();
+ function_iter != functions.end();
+ ++function_iter) {
+ string service_function_name = (*function_iter)->get_name();
+ string process_function_name = class_name_lc + "_process_"
+ + initial_caps_to_underscores(service_function_name);
+
+ f_service_ << indent() << "{" << endl;
+ indent_up();
+ f_service_ << indent() << "\"" << service_function_name << "\"," << endl
+ << indent() << process_function_name << endl;
+ indent_down();
+ f_service_ << indent() << "}"
+ << (function_iter == --functions.end() ? "" : ",") << endl;
+ }
indent_down();
- f_service_ << indent() << "}"
- << (function_iter == --functions.end() ? "" : ",") << endl;
+ f_service_ << indent() << "};" << endl
+ << endl;
}
- indent_down();
- f_service_ << indent() << "};" << endl
- << endl;
// Generate the processor's processing functions
for (function_iter = functions.begin(); function_iter != functions.end(); ++function_iter) {