THRIFT-3288 c_glib: Build unit tests without compiler warnings
These changes allow the unit tests for C (GLib) to build without
compiler warnings, even with additional warnings enabled. They
include
- Disabling string-function optimizations when glibc is used, as
these produce compiler warnings when a string function is used
within a call to assert ();
- Remove the "LL" suffix (added in C99) from 64-bit integer
literals;
- Replace C++-style ("//") comments with C-style equivalents;
- Remove unused constant declarations that generated warnings;
and
- Mark (or remove, from main ()) unused function parameters.
diff --git a/lib/c_glib/test/testthrifttestclient.cpp b/lib/c_glib/test/testthrifttestclient.cpp
index a80ddf3..e1737cd 100755
--- a/lib/c_glib/test/testthrifttestclient.cpp
+++ b/lib/c_glib/test/testthrifttestclient.cpp
@@ -191,6 +191,8 @@
}
void testInsanity(map<UserId, map<Numberz::type,Insanity> > &insane, const Insanity &argument) {
+ THRIFT_UNUSED_VARIABLE (argument);
+
printf("[C -> C++] testInsanity()\n");
Xtruct hello;
@@ -260,6 +262,10 @@
}
void testMulti(Xtruct &hello, const int8_t arg0, const int32_t arg1, const int64_t arg2, const std::map<int16_t, std::string> &arg3, const Numberz::type arg4, const UserId arg5) {
+ THRIFT_UNUSED_VARIABLE (arg3);
+ THRIFT_UNUSED_VARIABLE (arg4);
+ THRIFT_UNUSED_VARIABLE (arg5);
+
printf("[C -> C++] testMulti()\n");
hello.string_thing = "Hello2";
@@ -582,11 +588,13 @@
static void
bailout (int signum)
{
+ THRIFT_UNUSED_VARIABLE (signum);
+
exit (1);
}
int
-main (int argc, char **argv)
+main (void)
{
int status;
int pid = fork ();
@@ -607,7 +615,7 @@
sleep (1);
test_thrift_client ();
kill (pid, SIGINT);
- wait (&status) == pid;
+ assert (wait (&status) == pid);
}
return 0;