[gjs/wip/ptomato/autotools] WIP - ax_compiler_flags



commit 2a5aff3e3ee4aeaedb4c6b572c9f421bc19f1379
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Sep 29 08:44:55 2016 -0700

    WIP - ax_compiler_flags

 Makefile-insttest.am |   18 +++++++++++++++---
 Makefile.am          |   10 +++++++---
 configure.ac         |    7 ++++++-
 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 +-
 util/log.cpp         |    7 +++++++
 10 files changed, 48 insertions(+), 11 deletions(-)
---
diff --git a/Makefile-insttest.am b/Makefile-insttest.am
index 1003b0c..59991f9 100644
--- a/Makefile-insttest.am
+++ b/Makefile-insttest.am
@@ -95,7 +95,11 @@ libgimarshallingtests_la_LIBADD = $(common_test_libadd)
 Regress-1.0.gir: libregress.la
 Regress_1_0_gir_LIBS = libregress.la
 Regress_1_0_gir_FILES = $(nodist_libregress_la_SOURCES)
-Regress_1_0_gir_SCANNERFLAGS = --warn-all --warn-error $(libregress_scannerflags_includes)
+Regress_1_0_gir_SCANNERFLAGS =                 \
+       --warn-all --warn-error                 \
+       $(libregress_scannerflags_includes)     \
+       $(WARN_SCANNERFLAGS)                    \
+       $(NULL)
 if !ENABLE_CAIRO
 Regress_1_0_gir_CFLAGS = -D_GI_DISABLE_CAIRO
 endif
@@ -105,14 +109,22 @@ WarnLib-1.0.gir: libwarnlib.la
 WarnLib_1_0_gir_LIBS = libwarnlib.la
 WarnLib_1_0_gir_INCLUDES = Gio-2.0
 WarnLib_1_0_gir_FILES = $(nodist_libwarnlib_la_SOURCES)
-WarnLib_1_0_gir_SCANNERFLAGS = --c-include="warnlib.h" --symbol-prefix=warnlib_
+WarnLib_1_0_gir_SCANNERFLAGS =         \
+       --c-include="warnlib.h"         \
+       --symbol-prefix=warnlib_        \
+       $(WARN_SCANNERFLAGS)            \
+       $(NULL)
 TEST_INTROSPECTION_GIRS += WarnLib-1.0.gir
 
 GIMarshallingTests-1.0.gir: libgimarshallingtests.la
 GIMarshallingTests_1_0_gir_LIBS = libgimarshallingtests.la
 GIMarshallingTests_1_0_gir_INCLUDES = Gio-2.0
 GIMarshallingTests_1_0_gir_FILES = $(nodist_libgimarshallingtests_la_SOURCES)
-GIMarshallingTests_1_0_gir_SCANNERFLAGS = --symbol-prefix=gi_marshalling_tests --warn-all --warn-error
+GIMarshallingTests_1_0_gir_SCANNERFLAGS =      \
+       --symbol-prefix=gi_marshalling_tests    \
+       --warn-all --warn-error                 \
+       $(WARN_SCANNERFLAGS)                    \
+       $(NULL)
 TEST_INTROSPECTION_GIRS += GIMarshallingTests-1.0.gir
 
 $(foreach gir,$(TEST_INTROSPECTION_GIRS),$(eval $(call introspection-scanner,$(gir))))
diff --git a/Makefile.am b/Makefile.am
index d4d8f5c..c24cf84 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@ INTROSPECTION_GIRS =
 ACLOCAL_AMFLAGS = -I m4
 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(CODE_COVERAGE_CFLAGS)
 AM_CPPFLAGS = -DG_LOG_DOMAIN=\"Gjs\" $(CODE_COVERAGE_CPPFLAGS)
-AM_LDFLAGS = $(CODE_COVERAGE_LDFLAGS)
+AM_LDFLAGS = $(WARN_LDFLAGS) $(CODE_COVERAGE_LDFLAGS)
 
 gjsjsdir = @gjsjsdir@
 gjsoverridedir = $(gjsjsdir)/overrides
@@ -176,7 +176,12 @@ GjsPrivate-1.0.gir: libgjs.la
 GjsPrivate_1_0_gir_LIBS = libgjs.la
 GjsPrivate_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0
 GjsPrivate_1_0_gir_FILES = $(libgjs_private_source_files)
-GjsPrivate_1_0_gir_SCANNERFLAGS = --identifier-prefix=Gjs --symbol-prefix=gjs_ --warn-all
+GjsPrivate_1_0_gir_SCANNERFLAGS =      \
+       --identifier-prefix=Gjs         \
+       --symbol-prefix=gjs_            \
+       --warn-all                      \
+       $(WARN_SCANNERFLAGS)            \
+       $(NULL)
 
 if ENABLE_GTK
 GjsPrivate_1_0_gir_INCLUDES += Gtk-3.0
@@ -218,7 +223,6 @@ gjs_console_CPPFLAGS =              \
        $(AM_CPPFLAGS)          \
         $(GOBJECT_CFLAGS)
 gjs_console_LDADD =            \
-       $(JS_LIBS)              \
        $(GOBJECT_LIBS)         \
        libgjs.la
 gjs_console_LDFLAGS = -rdynamic
diff --git a/configure.ac b/configure.ac
index 89548cf..48cc428 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,12 @@ LT_PREREQ([2.2.0])
 # no stupid static libraries
 LT_INIT([disable-static])
 
-GNOME_CXX_WARNINGS([maximum])
+dnl -Wno-switch-enum: We do a lot of switching on GI type enums here, and it
+dnl would be unreadable to list each of the 20 or so enum values every time.
+dnl -Wno-undef: grr, this is in a mozilla header, and you can't filter it out
+dnl using pragmas: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
+dnl use pragma system header instead?
+AX_COMPILER_FLAGS(,,,,[-Wno-switch-enum -Wno-undef])
 
 AX_CODE_COVERAGE
 dnl Clang does not need to link with -lgcov
diff --git a/gi/arg.cpp b/gi/arg.cpp
index 9dd30f5..bb54827 100644
--- a/gi/arg.cpp
+++ b/gi/arg.cpp
@@ -2789,7 +2789,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 800369f..fbcb298 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 be2c2c2..6eaf559 100644
--- a/gi/value.cpp
+++ b/gi/value.cpp
@@ -975,8 +975,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 89c2415..5b22dfd 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 36d3df5..1be5180 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 e1885f4..2ddcf4b 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/util/log.cpp b/util/log.cpp
index ed6ca18..1374641 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]