[tracker] build: Improve warnings generated from Vala generated C files



commit 3cee6eb0c0d0d9f0d46e37b8aea02408e0718c8a
Author: Martyn Russell <martyn lanedo com>
Date:   Sat Oct 19 14:06:38 2013 +0100

    build: Improve warnings generated from Vala generated C files
    
    Don't include all the warnings about -Wunused*

 acinclude.m4                              |   21 +++++++++++++++++
 configure.ac                              |    5 ++++
 src/libtracker-bus/Makefile.am            |    2 +-
 src/libtracker-data/Makefile.am           |    2 +-
 src/libtracker-direct/Makefile.am         |    2 +-
 src/libtracker-sparql-backend/Makefile.am |    2 +-
 src/libtracker-sparql/Makefile.am         |    2 +-
 src/tracker-needle/Makefile.am            |    4 +-
 src/tracker-preferences/Makefile.am       |    2 +-
 src/tracker-store/Makefile.am             |    2 +-
 tests/functional-tests/ipc/Makefile.am    |   35 +----------------------------
 tests/libtracker-miner/Makefile.am        |    2 +-
 utils/tracker-resdump/Makefile.am         |    2 +-
 13 files changed, 38 insertions(+), 45 deletions(-)
---
diff --git a/acinclude.m4 b/acinclude.m4
index 9a29d21..a7d3485 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -118,17 +118,30 @@ AC_DEFUN([IDT_COMPILE_WARNINGS],[
     fi
 
     warning_flags=
+    warning_valaflags=
     realsave_CFLAGS="$CFLAGS"
 
+    # Everything from -Wall except:
+    # 1. the -Wunused-* stuff
+    # 2. the non C warnings: -Wreorder -Wc++11-compat
+    # 3. unfixable issues: -Wmissing-braces
+    #
+    # We don't want to see warnings about generated code.
+    common_from_Wall="-Waddress -Warray-bounds -Wchar-subscripts -Wenum-compare -Wimplicit-int 
-Wimplicit-function-declaration -Wcomment -Wformat -Wmain -Wmaybe-uninitialized -Wnonnull -Wparentheses 
-Wpointer-sign -Wreturn-type -Wsequence-point -Wsign-compare -Wstrict-aliasing -Wstrict-overflow=1 -Wswitch 
-Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wvolatile-register-var"
+
     case "$enable_compile_warnings" in
     no)
        warning_flags=
+       warning_valaflags=
        ;;
     yes)
        warning_flags="-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations"
+       warning_valaflags="$common_from_Wall -Wmissing-prototypes -Wmissing-declarations"
        ;;
     maximum|error)
        warning_flags="-Wall -Wunused -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes 
-Wnested-externs -Wpointer-arith"
+       warning_valaflags="$common_from_Wall -Wmissing-prototypes -Wmissing-declarations -Wnested-externs 
-Wpointer-arith"
+
        CFLAGS="$warning_flags $CFLAGS"
        for option in -Wno-sign-compare -Wno-pointer-sign; do
                SAVE_CFLAGS="$CFLAGS"
@@ -141,6 +154,7 @@ AC_DEFUN([IDT_COMPILE_WARNINGS],[
                AC_MSG_RESULT($has_option)
                if test $has_option = yes; then
                  warning_flags="$warning_flags $option"
+                 warning_valaflags="$warning_valaflags $option"
                fi
                unset has_option
                unset SAVE_CFLAGS
@@ -148,6 +162,7 @@ AC_DEFUN([IDT_COMPILE_WARNINGS],[
        unset option
        if test "$enable_compile_warnings" = "error" ; then
            warning_flags="$warning_flags -Werror"
+           warning_valaflags="$warning_valaflags -Werror"
        fi
        ;;
     *)
@@ -158,6 +173,12 @@ AC_DEFUN([IDT_COMPILE_WARNINGS],[
     AC_MSG_CHECKING(what warning flags to pass to the C compiler)
     AC_MSG_RESULT($warning_flags)
 
+    AC_MSG_CHECKING(what warning flags to pass to the C compiler for Vala built sources)
+    AC_MSG_RESULT($warning_valaflags)
+
     WARN_CFLAGS="$warning_flags"
     AC_SUBST(WARN_CFLAGS)
+
+    WARN_VALACFLAGS="$warning_valaflags"
+    AC_SUBST(WARN_VALACFLAGS)
 ]) dnl IDT_COMPILE_WARNINGS
diff --git a/configure.ac b/configure.ac
index 97b87b5..e426ad1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -520,12 +520,17 @@ AC_SUBST(GCOV_LIBS)
 
 ####################################################################
 # General VALAFLAGS/CFLAGS/LIBS
+#
+# NOTE: BUILD_VALACFLAGS are for the sources built by Vala,
+#       not for .vala files themselves.
 ####################################################################
 BUILD_VALAFLAGS="-g --target-glib=2.34"
+BUILD_VALACFLAGS="${WARN_VALACFLAGS} ${GCOV_CFLAGS} -DG_LOG_DOMAIN=\\\"Tracker\\\" -DTRACKER_COMPILATION"
 BUILD_CFLAGS="${WARN_CFLAGS} ${GCOV_CFLAGS} -DG_LOG_DOMAIN=\\\"Tracker\\\" -DTRACKER_COMPILATION"
 BUILD_LIBS="${GCOV_LIBS}"
 
 AC_SUBST(BUILD_VALAFLAGS)
+AC_SUBST(BUILD_VALACFLAGS)
 AC_SUBST(BUILD_CFLAGS)
 AC_SUBST(BUILD_LIBS)
 
diff --git a/src/libtracker-bus/Makefile.am b/src/libtracker-bus/Makefile.am
index 704d956..fde7644 100644
--- a/src/libtracker-bus/Makefile.am
+++ b/src/libtracker-bus/Makefile.am
@@ -12,7 +12,7 @@ AM_VALAFLAGS =                                         \
        $(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        -DNO_LIBDBUS                                   \
diff --git a/src/libtracker-data/Makefile.am b/src/libtracker-data/Makefile.am
index 6b93977..4827542 100644
--- a/src/libtracker-data/Makefile.am
+++ b/src/libtracker-data/Makefile.am
@@ -12,7 +12,7 @@ AM_VALAFLAGS =                                         \
        libtracker-data.vapi
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        -DSHAREDIR=\""$(datadir)"\"                    \
diff --git a/src/libtracker-direct/Makefile.am b/src/libtracker-direct/Makefile.am
index c315adc..1e2813d 100644
--- a/src/libtracker-direct/Makefile.am
+++ b/src/libtracker-direct/Makefile.am
@@ -14,7 +14,7 @@ AM_VALAFLAGS =                                         \
        $(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        $(LIBTRACKER_DIRECT_CFLAGS)
diff --git a/src/libtracker-sparql-backend/Makefile.am b/src/libtracker-sparql-backend/Makefile.am
index 52b8843..5087428 100644
--- a/src/libtracker-sparql-backend/Makefile.am
+++ b/src/libtracker-sparql-backend/Makefile.am
@@ -10,7 +10,7 @@ AM_VALAFLAGS =                                         \
        $(top_srcdir)/src/libtracker-direct/tracker-direct.vapi
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        $(LIBTRACKER_SPARQL_CFLAGS)
diff --git a/src/libtracker-sparql/Makefile.am b/src/libtracker-sparql/Makefile.am
index 94e27bb..de36125 100644
--- a/src/libtracker-sparql/Makefile.am
+++ b/src/libtracker-sparql/Makefile.am
@@ -12,7 +12,7 @@ libtracker_sparql_la_VALAFLAGS =                       \
        $(BUILD_VALAFLAGS)
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        $(LIBTRACKER_SPARQL_CFLAGS)
diff --git a/src/tracker-needle/Makefile.am b/src/tracker-needle/Makefile.am
index adbc2b6..5db83f3 100644
--- a/src/tracker-needle/Makefile.am
+++ b/src/tracker-needle/Makefile.am
@@ -8,8 +8,8 @@ AM_VALAFLAGS = \
        $(top_srcdir)/src/libtracker-sparql/tracker-sparql-$(TRACKER_API_VERSION).vapi \
        config.vapi
 
-AM_CPPFLAGS =                                      \
-       $(BUILD_CFLAGS)                                \
+AM_CPPFLAGS =                                          \
+       $(BUILD_VALACFLAGS)                            \
        -D_XOPEN_SOURCE                                \
        -D_XOPEN_SOURCE_EXTENDED                       \
        -I$(top_srcdir)/src                            \
diff --git a/src/tracker-preferences/Makefile.am b/src/tracker-preferences/Makefile.am
index 7a87d31..9827e7e 100644
--- a/src/tracker-preferences/Makefile.am
+++ b/src/tracker-preferences/Makefile.am
@@ -16,7 +16,7 @@ AM_VALAFLAGS =                                         \
        tracker-config.vapi
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -I$(top_srcdir)/src                            \
        -I$(top_builddir)/src                          \
        -DTRACKER_UI_DIR=\"$(datadir)/tracker/\"       \
diff --git a/src/tracker-store/Makefile.am b/src/tracker-store/Makefile.am
index 6ef3532..06a19f9 100644
--- a/src/tracker-store/Makefile.am
+++ b/src/tracker-store/Makefile.am
@@ -1,7 +1,7 @@
 include $(top_srcdir)/Makefile.decl
 
 AM_CPPFLAGS =                                          \
-       $(BUILD_CFLAGS)                                \
+       $(BUILD_VALACFLAGS)                            \
        -DSHAREDIR=\""$(datadir)"\"                    \
        -DLOCALEDIR=\""$(localedir)"\"                 \
        -DMAIL_MODULES_DIR=\""$(libdir)"/tracker-$(TRACKER_API_VERSION)/mail-modules\" \
diff --git a/tests/functional-tests/ipc/Makefile.am b/tests/functional-tests/ipc/Makefile.am
index 3ca28a2..7fb0513 100644
--- a/tests/functional-tests/ipc/Makefile.am
+++ b/tests/functional-tests/ipc/Makefile.am
@@ -19,7 +19,7 @@ AM_VALAFLAGS = \
        $(top_srcdir)/src/libtracker-bus/tracker-bus.vapi
 
 AM_CPPFLAGS =\
-       $(BUILD_CFLAGS) \
+       $(BUILD_VALACFLAGS) \
        -I$(top_srcdir)/src \
        -I$(top_builddir)/src \
        $(LIBTRACKER_SPARQL_CFLAGS)
@@ -35,21 +35,9 @@ LDADD =\
 
 test_insert_or_replace_SOURCES = \
        test-insert-or-replace.vala
-test_insert_or_replace_CFLAGS = \
-        $(AM_CPPFLAGS)
-test_insert_or_replace_VALAFLAGS = \
-        $(AM_VALAFLAGS)
-test_insert_or_replace_LDADD = \
-        $(LDADD)
 
 test_busy_handling_SOURCES = \
        test-busy-handling.vala
-test_busy_handling_CFLAGS = \
-       $(AM_CPPFLAGS)
-test_busy_handling_VALAFLAGS = \
-       $(AM_VALAFLAGS)
-test_busy_handling_LDADD = \
-       $(LDADD)
 
 test_direct_query_SOURCES = \
        test-shared-query.vala \
@@ -72,31 +60,10 @@ test_bus_update_SOURCES = \
 
 test_class_signal_SOURCES = \
        test-class-signal.vala
-test_class_signal_CFLAGS = \
-       $(AM_CPPFLAGS)
-
-test_class_signal_VALAFLAGS = \
-       $(AM_VALAFLAGS)
-test_class_signal_LDADD = \
-       $(LDADD)
 
 test_class_signal_performance_SOURCES = \
        test-class-signal-performance.vala
-test_class_signal_performance_CFLAGS = \
-       $(AM_CPPFLAGS)
-
-test_class_signal_performance_VALAFLAGS = \
-       $(AM_VALAFLAGS)
-test_class_signal_performance_LDADD = \
-       $(LDADD)
 
 test_class_signal_performance_batch_SOURCES = \
        test-class-signal-performance-batch.vala
-test_class_signal_performance_batch_CFLAGS = \
-       $(AM_CPPFLAGS)
-
-test_class_signal_performance_batch_VALAFLAGS = \
-       $(AM_VALAFLAGS)
-test_class_signal_performance_batch_LDADD = \
-       $(LDADD)
 
diff --git a/tests/libtracker-miner/Makefile.am b/tests/libtracker-miner/Makefile.am
index 9a990e9..a86b131 100644
--- a/tests/libtracker-miner/Makefile.am
+++ b/tests/libtracker-miner/Makefile.am
@@ -29,7 +29,7 @@ TEST_PROGS +=                                          \
        tracker-indexing-tree-test
 
 AM_CPPFLAGS = \
-       $(BUILD_CFLAGS) \
+       $(BUILD_VALACFLAGS) \
        -DTEST \
        -DLIBEXEC_PATH=\""$(libexecdir)"\" \
        -DTEST_DATA_DIR=\""$(abs_top_srcdir)/tests/libtracker-miner/data"\" \
diff --git a/utils/tracker-resdump/Makefile.am b/utils/tracker-resdump/Makefile.am
index 45da7b9..8ff90a2 100644
--- a/utils/tracker-resdump/Makefile.am
+++ b/utils/tracker-resdump/Makefile.am
@@ -10,7 +10,7 @@ AM_VALAFLAGS = \
        $(top_srcdir)/src/libtracker-bus/tracker-bus.vapi
 
 AM_CPPFLAGS =\
-       $(BUILD_CFLAGS) \
+       $(BUILD_VALACFLAGS) \
        -I$(top_srcdir)/src \
        -I$(top_builddir)/src \
        $(LIBTRACKER_SPARQL_CFLAGS) \


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