[gjs/wip/ptomato/warnings: 17/18] build: Fix various compiler warnings
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs/wip/ptomato/warnings: 17/18] build: Fix various compiler warnings
- Date: Wed, 5 Oct 2016 07:26:36 +0000 (UTC)
commit 25a520b6944e4fbdf815e62f126324db1dc8b3a8
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Oct 2 15:56:46 2016 -0700
build: Fix various compiler warnings
Fixing various compiler warnings that are too small to have their own
commit.
gi/arg.cpp | 3 ++-
gi/function.cpp | 1 +
gi/object.cpp | 4 ++--
gi/value.cpp | 4 ++--
gjs/compat.h | 6 ++++++
gjs/jsapi-private.cpp | 1 +
gjs/jsapi-util-error.cpp | 1 +
gjs/runtime.cpp | 2 +-
gjs/type-module.cpp | 1 +
installed-tests/gjs-unit.cpp | 4 ++--
modules/cairo.cpp | 2 +-
test/gjs-test-coverage.cpp | 9 ++++++---
util/log.cpp | 7 +++++++
13 files changed, 33 insertions(+), 12 deletions(-)
---
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 4375062..8775936 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -2782,7 +2782,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 ee4aa3f..931a2f2 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/object.cpp b/gi/object.cpp
index 82e3884..05f4f94 100644
--- a/gi/object.cpp
+++ b/gi/object.cpp
@@ -3000,8 +3000,8 @@ gjs_signal_new(JSContext *cx,
return false;
}
- JS::RootedObject gtype(cx, >ype_val.toObject());
- params[i] = gjs_gtype_get_actual_gtype(cx, gtype);
+ JS::RootedObject gjs_gtype(cx, >ype_val.toObject());
+ params[i] = gjs_gtype_get_actual_gtype(cx, gjs_gtype);
}
gtype = gjs_gtype_get_actual_gtype(cx, obj);
diff --git a/gi/value.cpp b/gi/value.cpp
index 1c5cc34..3c53930 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -951,8 +951,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/jsapi-private.cpp b/gjs/jsapi-private.cpp
index e0314e3..d3fc96a 100644
--- a/gjs/jsapi-private.cpp
+++ b/gjs/jsapi-private.cpp
@@ -35,6 +35,7 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
+#pragma GCC diagnostic ignored "-Wredundant-decls"
#include <jsfriendapi.h>
#pragma GCC diagnostic pop
diff --git a/gjs/jsapi-util-error.cpp b/gjs/jsapi-util-error.cpp
index c6849a7..983b43e 100644
--- a/gjs/jsapi-util-error.cpp
+++ b/gjs/jsapi-util-error.cpp
@@ -42,6 +42,7 @@
* http://egachine.berlios.de/embedding-sm-best-practice/embedding-sm-best-practice.html#error-handling
*/
static void
+G_GNUC_PRINTF(3, 0)
gjs_throw_valist(JSContext *context,
const char *error_class,
const char *format,
diff --git a/gjs/runtime.cpp b/gjs/runtime.cpp
index de2e779..cc6a536 100644
--- a/gjs/runtime.cpp
+++ b/gjs/runtime.cpp
@@ -164,7 +164,7 @@ static JSLocaleCallbacks gjs_locale_callbacks =
gjs_locale_to_unicode
};
-void
+static void
gjs_finalize_callback(JSFreeOp *fop,
JSFinalizeStatus status,
JSBool isCompartment)
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/installed-tests/gjs-unit.cpp b/installed-tests/gjs-unit.cpp
index 54f7804..b673329 100644
--- a/installed-tests/gjs-unit.cpp
+++ b/installed-tests/gjs-unit.cpp
@@ -38,7 +38,7 @@ typedef struct {
char *filename;
} GjsTestData;
-GjsTestData *
+static GjsTestData *
gjs_unit_test_data_new(const char *coverage_prefix,
const char *coverage_output_path,
char *filename)
@@ -50,7 +50,7 @@ gjs_unit_test_data_new(const char *coverage_prefix,
return data;
}
-void
+static void
gjs_unit_test_data_free(gpointer test_data, gpointer user_data)
{
GjsTestData *data = (GjsTestData *) test_data;
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..7671bb9 100644
--- a/test/gjs-test-coverage.cpp
+++ b/test/gjs-test-coverage.cpp
@@ -36,6 +36,8 @@
#include <gjs/coverage-internal.h>
#include <gjs/gjs-module.h>
+#include "gjs-tests-add-funcs.h"
+
typedef struct _GjsCoverageFixture {
GjsContext *context;
GjsCoverage *coverage;
@@ -338,7 +340,7 @@ coverage_data_matches_values_for_key(const char *data,
}
/* A simple wrapper around gjs_coverage_new */
-GjsCoverage *
+static GjsCoverage *
create_coverage_for_script(GjsContext *context,
const char *script)
{
@@ -351,7 +353,7 @@ create_coverage_for_script(GjsContext *context,
context);
}
-GjsCoverage *
+static GjsCoverage *
create_coverage_for_script_and_cache(GjsContext *context,
const char *cache,
const char *script)
@@ -2207,7 +2209,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]