THRIFT-3266 c_glib: Multiple compiler warnings building unit tests
Client: c_glib
Patch: Simon South
This closes #570
diff --git a/lib/c_glib/test/Makefile.am b/lib/c_glib/test/Makefile.am
index dc9432e..2a38878 100755
--- a/lib/c_glib/test/Makefile.am
+++ b/lib/c_glib/test/Makefile.am
@@ -160,6 +160,7 @@
gen-c_glib/t_test_thrift_test.h \
gen-c_glib/t_test_thrift_test_types.h
libtestgenc_la_LIBADD = $(top_builddir)/lib/c_glib/libthrift_c_glib.la
+libtestgenc_la_CPPFLAGS = $(AM_CPPFLAGS) -Wno-unused-function
nodist_libtestgencpp_la_SOURCES = \
gen-cpp/ThriftTest.cpp \
diff --git a/lib/c_glib/test/testapplicationexception.c b/lib/c_glib/test/testapplicationexception.c
index 2481340..89e39e2 100644
--- a/lib/c_glib/test/testapplicationexception.c
+++ b/lib/c_glib/test/testapplicationexception.c
@@ -99,7 +99,7 @@
/* "g_test_expect_message" is required for the property range tests below but is
not present in GLib before version 2.34 */
-#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION >= 34)
+#if (GLIB_CHECK_VERSION (2, 34, 0))
g_object_set (xception,
"type", THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN,
NULL);
@@ -161,7 +161,7 @@
int
main (int argc, char **argv)
{
-#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 36)
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init ();
#endif
diff --git a/lib/c_glib/test/testbinaryprotocol.c b/lib/c_glib/test/testbinaryprotocol.c
index f75c796..c6de385 100755
--- a/lib/c_glib/test/testbinaryprotocol.c
+++ b/lib/c_glib/test/testbinaryprotocol.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <netdb.h>
#include <string.h>
+#include <sys/wait.h>
#include <thrift/c_glib/protocol/thrift_protocol.h>
#include <thrift/c_glib/transport/thrift_socket.h>
@@ -660,7 +661,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testbinaryprotocol/CreateAndDestroy", test_create_and_destroy);
diff --git a/lib/c_glib/test/testbufferedtransport.c b/lib/c_glib/test/testbufferedtransport.c
index 7d9c46d..e4bee69 100755
--- a/lib/c_glib/test/testbufferedtransport.c
+++ b/lib/c_glib/test/testbufferedtransport.c
@@ -20,6 +20,7 @@
#include <assert.h>
#include <netdb.h>
#include <signal.h>
+#include <sys/wait.h>
#include <thrift/c_glib/transport/thrift_transport.h>
#include <thrift/c_glib/transport/thrift_socket.h>
@@ -273,7 +274,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testbufferedtransport/CreateAndDestroy", test_create_and_destroy);
diff --git a/lib/c_glib/test/testdebugproto.c b/lib/c_glib/test/testdebugproto.c
index e343c1e..703dff0 100644
--- a/lib/c_glib/test/testdebugproto.c
+++ b/lib/c_glib/test/testdebugproto.c
@@ -864,7 +864,7 @@
int
main(int argc, char *argv[])
{
-#if (GLIB_MAJOR_VERSION == 2) && (GLIB_MINOR_VERSION < 36)
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init ();
#endif
diff --git a/lib/c_glib/test/testframedtransport.c b/lib/c_glib/test/testframedtransport.c
index 843ad93..7261ff5 100755
--- a/lib/c_glib/test/testframedtransport.c
+++ b/lib/c_glib/test/testframedtransport.c
@@ -19,6 +19,7 @@
#include <assert.h>
#include <netdb.h>
+#include <sys/wait.h>
#include <thrift/c_glib/transport/thrift_transport.h>
#include <thrift/c_glib/transport/thrift_socket.h>
@@ -271,7 +272,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testframedtransport/CreateAndDestroy", test_create_and_destroy);
diff --git a/lib/c_glib/test/testmemorybuffer.c b/lib/c_glib/test/testmemorybuffer.c
index 7169a5c..5c75273 100755
--- a/lib/c_glib/test/testmemorybuffer.c
+++ b/lib/c_glib/test/testmemorybuffer.c
@@ -84,7 +84,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testmemorybuffer/CreateAndDestroy", test_create_and_destroy);
diff --git a/lib/c_glib/test/testoptionalrequired.c b/lib/c_glib/test/testoptionalrequired.c
index 2839dd4..931d8be 100755
--- a/lib/c_glib/test/testoptionalrequired.c
+++ b/lib/c_glib/test/testoptionalrequired.c
@@ -190,7 +190,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testoptionalrequired/OldSchool", test_old_school1);
diff --git a/lib/c_glib/test/testsimpleserver.c b/lib/c_glib/test/testsimpleserver.c
index 92629b4..cb270b4 100755
--- a/lib/c_glib/test/testsimpleserver.c
+++ b/lib/c_glib/test/testsimpleserver.c
@@ -106,7 +106,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testsimpleserver/SimpleServer", test_server);
diff --git a/lib/c_glib/test/teststruct.c b/lib/c_glib/test/teststruct.c
index 182a6ac..a1b3cc0 100755
--- a/lib/c_glib/test/teststruct.c
+++ b/lib/c_glib/test/teststruct.c
@@ -92,7 +92,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/teststruct/InitializeObject", test_initialize_object);
diff --git a/lib/c_glib/test/testthrifttest.c b/lib/c_glib/test/testthrifttest.c
index a42d089..5f0f6e3 100755
--- a/lib/c_glib/test/testthrifttest.c
+++ b/lib/c_glib/test/testthrifttest.c
@@ -8,7 +8,7 @@
static const int TEST_PORT = 64444;
static void
-test_thrift_server (const int port)
+test_thrift_server (void)
{
ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET,
"port", TEST_PORT, NULL);
@@ -19,7 +19,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testthrift/Server", test_thrift_server);
diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp
index d387396..faf81db 100755
--- a/lib/c_glib/test/testthrifttestclient.cpp
+++ b/lib/c_glib/test/testthrifttestclient.cpp
@@ -354,8 +354,10 @@
TTestXception *xception = NULL;
TTestXception2 *xception2 = NULL;
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
// initialize gobject
g_type_init ();
+#endif
// create a C client
tsocket = (ThriftSocket *) g_object_new (THRIFT_TYPE_SOCKET,
diff --git a/lib/c_glib/test/testtransportsocket.c b/lib/c_glib/test/testtransportsocket.c
index 08cad1c..bb1d47c 100755
--- a/lib/c_glib/test/testtransportsocket.c
+++ b/lib/c_glib/test/testtransportsocket.c
@@ -310,7 +310,10 @@
int
main(int argc, char *argv[])
{
+#if (!GLIB_CHECK_VERSION (2, 36, 0))
g_type_init();
+#endif
+
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/testtransportsocket/CreateAndDestroy", test_create_and_destroy);