[gjs/wip/ptomato/warnings: 9/10] WIP - Various compiler warnings



commit c8a01e8aedeb0eb7f6cab886ac39172d0dafca69
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Oct 2 15:56:46 2016 -0700

    WIP - Various compiler warnings

 gi/arg.cpp                 |    3 ++-
 gi/function.cpp            |    1 +
 gi/value.cpp               |    4 ++--
 gjs/compat.h               |    6 ++++++
 gjs/type-module.cpp        |    1 +
 modules/cairo.cpp          |    2 +-
 test/gjs-test-coverage.cpp |    3 ++-
 util/log.cpp               |    7 +++++++
 8 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 4f90602..35a2209 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -2788,7 +2788,8 @@ gjs_value_from_g_argument (JSContext  *context,
                 return result;
             } else {
                 /* arrays with length are handled outside of this function */
-                g_assert(("Use gjs_value_from_explicit_array() for arrays with length param",
+                g_assert(((void) "Use gjs_value_from_explicit_array() for "
+                          "arrays with length param",
                           g_type_info_get_array_length(type_info) == -1));
                 return gjs_array_from_fixed_size_array(context, value_p, type_info, arg->v_pointer);
             }
diff --git a/gi/function.cpp b/gi/function.cpp
index 97ca8ae..95256a3 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -262,6 +262,7 @@ gjs_callback_closure(ffi_cif *cif,
                                                (GArgument *) args[i], false))
                     goto out;
                 break;
+            case PARAM_CALLBACK:
             default:
                 g_assert_not_reached();
         }
diff --git a/gi/value.cpp b/gi/value.cpp
index c1e855b..6cd8b5a 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -971,8 +971,8 @@ gjs_value_from_g_value_internal(JSContext    *context,
         arg_info = g_callable_info_get_arg(signal_info, arg_n - 1);
         g_arg_info_load_type(arg_info, &type_info);
 
-        g_assert(("Check gjs_value_from_array_and_length_values() before calling"
-                  " gjs_value_from_g_value_internal()",
+        g_assert(((void) "Check gjs_value_from_array_and_length_values() before"
+                  " calling gjs_value_from_g_value_internal()",
                   g_type_info_get_array_length(&type_info) == -1));
 
         arg.v_pointer = g_value_get_pointer(gvalue);
diff --git a/gjs/compat.h b/gjs/compat.h
index bb6db79..ba73742 100644
--- a/gjs/compat.h
+++ b/gjs/compat.h
@@ -33,10 +33,16 @@
 _Pragma("clang diagnostic push")
 _Pragma("clang diagnostic ignored \"-Wuninitialized\"")
 _Pragma("clang diagnostic ignored \"-Winvalid-offsetof\"")
+_Pragma("clang diagnostic ignored \"-Wunused-variable\"")
+_Pragma("clang diagnostic ignored \"-Wignored-qualifiers\"")
 #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
 _Pragma("GCC diagnostic push")
 _Pragma("GCC diagnostic ignored \"-Wstrict-prototypes\"")
 _Pragma("GCC diagnostic ignored \"-Winvalid-offsetof\"")
+_Pragma("GCC diagnostic ignored \"-Wunused-variable\"")
+_Pragma("GCC diagnostic ignored \"-Wredundant-decls\"")
+_Pragma("GCC diagnostic ignored \"-Wignored-qualifiers\"")
+_Pragma("GCC diagnostic ignored \"-Wshadow\"")
 #endif
 #include <jsapi.h>
 #include <jsdbgapi.h> // Needed by some bits
diff --git a/gjs/type-module.cpp b/gjs/type-module.cpp
index 730d14c..4457d94 100644
--- a/gjs/type-module.cpp
+++ b/gjs/type-module.cpp
@@ -51,6 +51,7 @@ gjs_type_module_load (GTypeModule *self)
     return true;
 }
 
+G_GNUC_NORETURN
 static void
 gjs_type_module_unload (GTypeModule *self)
 {
diff --git a/modules/cairo.cpp b/modules/cairo.cpp
index 1a840c4..81eadab 100644
--- a/modules/cairo.cpp
+++ b/modules/cairo.cpp
@@ -27,7 +27,7 @@
 
 #include "cairo-private.h"
 
-#if CAIRO_HAS_XLIB_SURFACE
+#ifdef CAIRO_HAS_XLIB_SURFACE
 #include "cairo-xlib.h"
 
 class XLibConstructor {
diff --git a/test/gjs-test-coverage.cpp b/test/gjs-test-coverage.cpp
index bf5ef45..7037f9e 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -2207,7 +2207,8 @@ add_table_driven_test_for_fixture(const char                *name,
     for (test_table_index = 0;
          test_table_index < n_table_entries;
          ++test_table_index, test_table_ptr += table_entry_size) {
-        TestTableDataHeader *header = (TestTableDataHeader *) test_table_ptr;
+        const TestTableDataHeader *header =
+            reinterpret_cast<const TestTableDataHeader *>(test_table_ptr);
         gchar *test_name_for_table_index = g_strdup_printf("%s/%s",
                                                            name,
                                                            header->test_name);
diff --git a/util/log.cpp b/util/log.cpp
index e211031..38901db 100644
--- a/util/log.cpp
+++ b/util/log.cpp
@@ -125,7 +125,14 @@ gjs_debug(GjsDebugTopic topic,
              */
             c = strchr((char *) debug_output, '%');
             if (c && c[1] == 'u' && !strchr(c+1, '%')) {
+#if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+_Pragma("GCC diagnostic push")
+_Pragma("GCC diagnostic ignored \"-Wformat-nonliteral\"")
+#endif
                 free_me = g_strdup_printf(debug_output, (guint)getpid());
+#if defined(__clang__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
+_Pragma("GCC diagnostic pop")
+#endif
                 log_file = free_me;
             } else {
                 log_file = debug_output;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]