Fix -Wcast-function-type warnings in util/ with gcc 4.8
authorBehdad Esfahbod <behdad@behdad.org>
Sat, 26 Jan 2019 13:04:51 +0000 (14:04 +0100)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 26 Jan 2019 13:04:51 +0000 (14:04 +0100)
src/hb.hh
util/options.hh

index 5945de4..860236b 100644 (file)
--- a/src/hb.hh
+++ b/src/hb.hh
@@ -60,6 +60,7 @@
 #ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_ERROR
 #pragma GCC diagnostic error   "-Wc++11-narrowing"
 #pragma GCC diagnostic error   "-Wcast-align"
+#pragma GCC diagnostic error   "-Wcast-function-type"
 #pragma GCC diagnostic error   "-Wdelete-non-virtual-dtor"
 #pragma GCC diagnostic error   "-Wformat-security"
 #pragma GCC diagnostic error   "-Wimplicit-function-declaration"
index d704519..e846258 100644 (file)
@@ -74,10 +74,13 @@ struct option_parser_t
 
     add_main_options ();
   }
+
+  static void _g_free_g_func (void *p, void * G_GNUC_UNUSED) { g_free (p); }
+
   ~option_parser_t ()
   {
     g_option_context_free (context);
-    g_ptr_array_foreach (to_free, (GFunc) g_free, nullptr);
+    g_ptr_array_foreach (to_free, _g_free_g_func, nullptr);
     g_ptr_array_free (to_free, TRUE);
   }