THRIFT-3260 multiple warnings in c_glib tutorial
Client: c_glib
Patch: Simon South <ssouth@simonsouth.com>
This closes #572
Tutorial:
- Silence unused-function warnings
- Remove spurious ";" from GObject type macro
Compiler:
- Suppress unused-var warnings in client initializers
- Omit spurious ";" after GObject type macros
diff --git a/compiler/cpp/src/generate/t_c_glib_generator.cc b/compiler/cpp/src/generate/t_c_glib_generator.cc
index a32b224..f8431cd 100644
--- a/compiler/cpp/src/generate/t_c_glib_generator.cc
+++ b/compiler/cpp/src/generate/t_c_glib_generator.cc
@@ -1384,7 +1384,7 @@
<< " G_IMPLEMENT_INTERFACE (" << this->nspace_uc << "TYPE_"
<< service_name_uc << "_IF," << endl
<< " " << this->nspace_lc
- << service_name_lc << "_if_interface_init));" << endl << endl;
+ << service_name_lc << "_if_interface_init))" << endl << endl;
// Generate property-related code only for base services---child
// service-client classes have only properties inherited from their
@@ -1620,6 +1620,9 @@
f_service_ << " client->input_protocol = NULL;" << endl << " client->output_protocol = NULL;"
<< endl;
}
+ else {
+ f_service_ << " THRIFT_UNUSED_VAR (client);" << endl;
+ }
f_service_ << "}" << endl << endl;
// create the client class initializer
@@ -1650,6 +1653,9 @@
<< " PROP_" << this->nspace_uc << service_name_uc
<< "_CLIENT_OUTPUT_PROTOCOL, param_spec);" << endl;
}
+ else {
+ f_service_ << " THRIFT_UNUSED_VAR (cls);" << endl;
+ }
f_service_ << "}" << endl << endl;
}
@@ -1780,7 +1786,7 @@
<< args_indent << "G_IMPLEMENT_INTERFACE (" << this->nspace_uc << "TYPE_"
<< service_name_uc << "_IF," << endl;
args_indent += string(23, ' ');
- f_service_ << args_indent << class_name_lc << "_" << service_name_lc << "_if_interface_init));"
+ f_service_ << args_indent << class_name_lc << "_" << service_name_lc << "_if_interface_init))"
<< endl << endl;
// Generate the handler method implementations
@@ -1966,7 +1972,7 @@
// Generate the implementation boilerplate
args_indent = string(15, ' ');
f_service_ << "G_DEFINE_TYPE (" << class_name << "," << endl << args_indent << class_name_lc
- << "," << endl << args_indent << parent_type_name << ");" << endl << endl;
+ << "," << endl << args_indent << parent_type_name << ")" << endl << endl;
// Generate the processor's processing-function type
args_indent = string(process_function_type_name.length() + 23, ' ');
diff --git a/tutorial/c_glib/Makefile.am b/tutorial/c_glib/Makefile.am
index 1862f1b..565f635 100755
--- a/tutorial/c_glib/Makefile.am
+++ b/tutorial/c_glib/Makefile.am
@@ -46,6 +46,8 @@
libtutorialgencglib_la_LIBADD = \
$(top_builddir)/lib/c_glib/libthrift_c_glib.la
+libtutorialgencglib_la_CFLAGS = \
+ $(AM_CFLAGS) -Wno-unused-function
noinst_PROGRAMS = \
tutorial_server \
diff --git a/tutorial/c_glib/c_glib_server.c b/tutorial/c_glib/c_glib_server.c
index 000d97c..3aa99ec 100644
--- a/tutorial/c_glib/c_glib_server.c
+++ b/tutorial/c_glib/c_glib_server.c
@@ -100,7 +100,7 @@
G_DEFINE_TYPE (TutorialCalculatorHandler,
tutorial_calculator_handler,
- TYPE_CALCULATOR_HANDLER);
+ TYPE_CALCULATOR_HANDLER)
/* Each of a handler's methods accepts at least two parameters: A
pointer to the service-interface implementation (the handler object