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/testbinaryprotocol.c b/lib/c_glib/test/testbinaryprotocol.c
index c6de385..517fd25 100755
--- a/lib/c_glib/test/testbinaryprotocol.c
+++ b/lib/c_glib/test/testbinaryprotocol.c
@@ -17,6 +17,14 @@
* under the License.
*/
+/* Disable string-function optimizations when glibc is used, as these produce
+ compiler warnings about string length when a string function is used inside
+ a call to assert () */
+#include <features.h>
+#ifdef __GLIBC__
+#define __NO_STRING_INLINES 1
+#endif
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -33,7 +41,7 @@
#define TEST_BYTE 123
#define TEST_I16 12345
#define TEST_I32 1234567890
-#define TEST_I64 123456789012345LL
+#define TEST_I64 123456789012345
#define TEST_DOUBLE 1234567890.123
#define TEST_STRING "this is a test string 1234567890!@#$%^&*()"
#define TEST_PORT 51199
@@ -654,7 +662,7 @@
thrift_binary_protocol_read_string (protocol, &message_name, NULL);
g_object_unref (client);
- // TODO: investigate g_object_unref (tbp);
+ /* TODO: investigate g_object_unref (tbp); */
g_object_unref (tsocket);
}