[libgweather/improve-build: 6/7] Add compiler warnings



commit 9951e20ceeeb3d1bdc3cf435ac82c0454a4582c4
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Mar 9 12:31:50 2020 +0000

    Add compiler warnings
    
    It's good project hygiene to have a decent set of warnings enabled.

 libgweather/meson.build | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
---
diff --git a/libgweather/meson.build b/libgweather/meson.build
index 7ca614e..c2d5cff 100644
--- a/libgweather/meson.build
+++ b/libgweather/meson.build
@@ -5,6 +5,50 @@ add_project_arguments([
   '-D_DEFAULT_SOURCE',
 ], language: 'c')
 
+if c_compiler.get_id() == 'gcc' or c_compiler.get_id() == 'clang'
+  test_cflags = [
+    '-fno-strict-aliasing',
+    '-Wcast-align',
+    '-Wignored-qualifiers',
+    '-Wimplicit-function-declaration',
+    '-Wlogical-op',
+    '-Wmissing-format-attribute',
+    '-Wmissing-include-dirs',
+    '-Wmissing-noreturn',
+    '-Wnested-externs',
+    '-Wold-style-definition',
+    '-Wpointer-arith',
+    '-Wshadow',
+    '-Wstrict-prototypes',
+    '-Wundef',
+    '-Wuninitialized',
+    '-Wunused',
+    '-Werror=address',
+    '-Werror=array-bounds',
+    '-Werror=empty-body',
+    '-Werror=format=2',
+    '-Werror=format-nonliteral',
+    '-Werror=format-security',
+    '-Werror=implicit',
+    '-Werror=implicit-fallthrough',
+    '-Werror=init-self',
+    '-Werror=int-to-pointer-cast',
+    '-Werror=main',
+    '-Werror=missing-braces',
+    '-Werror=missing-declarations',
+    '-Werror=missing-prototypes',
+    '-Werror=pointer-to-int-cast',
+    '-Werror=redundant-decls',
+    '-Werror=return-type',
+    '-Werror=sequence-point',
+    '-Werror=trigraphs',
+    '-Werror=vla',
+    '-Werror=write-strings',
+  ]
+
+  add_project_arguments(c_compiler.get_supported_arguments(test_cflags), language: 'c')
+endif
+
 header_subdir = 'libgweather-3.0/libgweather'
 
 versionconf = configuration_data()


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