[tracker: 3/8] meson: Enable more compilation warnings




commit e5869a346c52626714c484e611515db2e9c99f7a
Author: Daniele Nicolodi <daniele grinta net>
Date:   Sat May 1 16:41:28 2021 +0200

    meson: Enable more compilation warnings
    
    Enable -Wextra and explicitly disable the warning types that make many
    but relatively harmless warnings to be emitted. It could be worth to
    review the list of disable warnings at a later time.

 meson.build | 34 ++++++++++++++++++++++++++++------
 1 file changed, 28 insertions(+), 6 deletions(-)
---
diff --git a/meson.build b/meson.build
index 43935b803..f7bdf79ac 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,9 @@
 project('tracker', 'c', 'vala',
         version: '3.2.0-alpha',
-        meson_version: '>=0.51')
+        meson_version: '>=0.51',
+        default_options: [
+          'c_std=c99',
+          'warning_level=3'])
 
 gnome = import('gnome')
 i18n = import('i18n')
@@ -71,11 +74,30 @@ if get_option('tests_tap_protocol')
 endif
 python = import('python').find_installation('python3', modules: py_modules)
 
-add_project_arguments('-Wformat', '-Wformat-security', language: 'c')
-
-# There are various gchar vs. unsigned char warnings that occur in extract
-# modules, it's not worth adding casts everywhere so we disable the warning.
-add_project_arguments('-Wno-pointer-sign', language: 'c')
+cc_warning_flags = [
+  '-Wformat',
+  '-Wformat-security',
+  # There are numerous switches over data or token types in the
+  # codebase. This makes it easy to verify that all are handled
+  # correctly. -Wswitch-enum could be even better, but there are a few
+  # enums with hundreds of entries that are only partially covered in
+  # some of the switches.
+  '-Wswitch',
+  # Too many warnings in libtracker-data/tracker-sparql-grammar.h
+  '-Wno-tautological-constant-out-of-range-compare',
+  # There are various gchar vs. unsigned char warnings that occur in
+  # extract modules, it is not worth adding casts everywhere.
+  '-Wno-pointer-sign',
+  # Similarly there are many instances of guint vs. int comparisons.
+  # There would be easy but tedious to fix.
+  '-Wno-sign-compare',
+  # This probably deserves a better look.
+  '-Wno-missing-field-initializers',
+  # Too many unused parameters in tests. Disabling this warning only
+  # for the tests executables could be a better solution.
+  '-Wno-unused-parameter',
+]
+add_project_arguments(cc.get_supported_arguments(cc_warning_flags), language: 'c')
 
 add_project_arguments('-DTRACKER_COMPILATION',
                       '-DG_LOG_DOMAIN="Tracker"',


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