[Spice-devel] [PATCH spice-server 2/2] meson: Add option to enable all warnings
Eduardo Lima (Etrunko)
etrunko at redhat.com
Wed Jan 30 12:07:31 UTC 2019
Currently on the main meson.build file, this could be moved to a
subdirectory in a dedicated meson.build file for this sole purpose.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
meson.build | 220 +++++++++++++++++++++++++++++++++++++--
meson_options.txt | 4 +
subprojects/spice-common | 2 +-
3 files changed, 219 insertions(+), 7 deletions(-)
diff --git a/meson.build b/meson.build
index 14febb7e..1ab8efdb 100644
--- a/meson.build
+++ b/meson.build
@@ -38,13 +38,221 @@ message('libspice.so version: ' + spice_server_so_version)
# some global vars
spice_server_global_cflags = ['-DSPICE_SERVER_INTERNAL',
'-DG_LOG_DOMAIN="Spice"',
- '-DHAVE_CONFIG_H',
- #'-Werror',
- '-Wall',
- '-Wextra',
- '-Wno-sign-compare',
- '-Wno-unused-parameter']
+ '-DHAVE_CONFIG_H']
+
+all_warnings = {
+ '-fno-common' : true,
+ '-W' : true,
+ '-Wabi' : true,
+ '-Waddress' : true,
+ '-Waggressive-loop-optimizations' : true,
+ '-Wall' : true,
+ '-Wattributes' : true,
+ '-Wbad-function-cast' : true,
+ '-Wbool-compare' : true,
+ '-Wbuiltin-macro-redefined' : true,
+ '-Wcast-align' : true,
+ '-Wchar-subscripts' : true,
+ '-Wchkp' : true,
+ '-Wclobbered' : true,
+ '-Wcomment' : true,
+ '-Wcomments' : true,
+ '-Wcoverage-mismatch' : true,
+ '-Wcpp' : true,
+ '-Wdate-time' : true,
+ '-Wdeprecated' : true,
+ '-Wdeprecated-declarations' : true,
+ '-Wdesignated-init' : true,
+ '-Wdisabled-optimization' : true,
+ '-Wdiscarded-array-qualifiers' : true,
+ '-Wdiscarded-qualifiers' : true,
+ '-Wdiv-by-zero' : true,
+ '-Wdouble-promotion' : true,
+ '-Wduplicated-cond' : true,
+ '-Wempty-body' : true,
+ '-Wendif-labels' : true,
+ '-Wenum-compare' : true,
+ '-Wextra' : true,
+ '-Wformat-contains-nul' : true,
+ '-Wformat-extra-args' : true,
+ '-Wformat-nonliteral' : true,
+ '-Wformat-security' : true,
+ '-Wformat-signedness' : true,
+ '-Wformat-y2k' : true,
+ '-Wformat-zero-length' : true,
+ '-Wframe-address' : true,
+ '-Wfree-nonheap-object' : true,
+ '-Whsa' : true,
+ '-Wignored-attributes' : true,
+ '-Wignored-qualifiers' : true,
+ '-Wimplicit' : true,
+ '-Wimplicit-function-declaration' : true,
+ '-Wimplicit-int' : true,
+ '-Wincompatible-pointer-types' : true,
+ '-Winit-self' : true,
+ '-Winline' : true,
+ '-Wint-conversion' : true,
+ '-Wint-to-pointer-cast' : true,
+ '-Winvalid-memory-model' : true,
+ '-Winvalid-pch' : true,
+ '-Wjump-misses-init' : true,
+ '-Wlogical-not-parentheses' : true,
+ '-Wlogical-op' : true,
+ '-Wmain' : true,
+ '-Wmaybe-uninitialized' : true,
+ '-Wmemset-transposed-args' : true,
+ '-Wmisleading-indentation' : true,
+ '-Wmissing-braces' : true,
+ '-Wmissing-declarations' : true,
+ '-Wmissing-field-initializers' : true,
+ '-Wmissing-include-dirs' : true,
+ '-Wmissing-parameter-type' : true,
+ '-Wmissing-prototypes' : true,
+ '-Wmultichar' : true,
+ '-Wnarrowing' : true,
+ '-Wnested-externs' : true,
+ '-Wnonnull' : true,
+ '-Wnonnull-compare' : true,
+ '-Wnull-dereference' : true,
+ '-Wodr' : true,
+ '-Wold-style-declaration' : true,
+ '-Wold-style-definition' : true,
+ '-Wopenmp-simd' : true,
+ '-Woverflow' : true,
+ '-Woverlength-strings' : true,
+ '-Woverride-init' : true,
+ '-Wpacked' : true,
+ '-Wpacked-bitfield-compat' : true,
+ '-Wparentheses' : true,
+ '-Wpointer-arith' : true,
+ '-Wpointer-sign' : true,
+ '-Wpointer-to-int-cast' : true,
+ '-Wpragmas' : true,
+ '-Wreturn-local-addr' : true,
+ '-Wreturn-type' : true,
+ '-Wscalar-storage-order' : true,
+ '-Wsequence-point' : true,
+ '-Wshadow' : true,
+ '-Wshift-count-negative' : true,
+ '-Wshift-count-overflow' : true,
+ '-Wshift-negative-value' : true,
+ '-Wsizeof-array-argument' : true,
+ '-Wsizeof-pointer-memaccess' : true,
+ '-Wstack-protector' : true,
+ '-Wstrict-aliasing' : true,
+ '-Wstrict-overflow' : true,
+ '-Wstrict-prototypes' : true,
+ '-Wsuggest-attribute=const' : true,
+ '-Wsuggest-attribute=format' : true,
+ '-Wsuggest-attribute=noreturn' : true,
+ '-Wsuggest-attribute=pure' : true,
+ '-Wsuggest-final-methods' : true,
+ '-Wsuggest-final-types' : true,
+ '-Wswitch' : true,
+ '-Wswitch-bool' : true,
+ '-Wswitch-default' : true,
+ '-Wsync-nand' : true,
+ '-Wsystem-headers' : true,
+ '-Wtautological-compare' : true,
+ '-Wtrampolines' : true,
+ '-Wtrigraphs' : true,
+ '-Wtype-limits' : true,
+ '-Wuninitialized' : true,
+ '-Wunknown-pragmas' : true,
+ '-Wunsafe-loop-optimizations' : true,
+ '-Wunused' : true,
+ '-Wunused-but-set-parameter' : true,
+ '-Wunused-but-set-variable' : true,
+ '-Wunused-function' : true,
+ '-Wunused-label' : true,
+ '-Wunused-local-typedefs' : true,
+ '-Wunused-macros' : true,
+ '-Wunused-parameter' : true,
+ '-Wunused-result' : true,
+ '-Wunused-value' : true,
+ '-Wunused-variable' : true,
+ '-Wvarargs' : true,
+ '-Wvariadic-macros' : true,
+ '-Wvector-operation-performance' : true,
+ '-Wvla' : true,
+ '-Wvolatile-register-var' : true,
+ '-Wwrite-strings' : true,
+ '-Warray-bounds=2' : true,
+ '-Wnormalized=nfc' : true,
+ '-Wshift-overflow=2' : true,
+ '-Wunused-const-variable=2' : true,
+}
+
+spice_warnings = {
+ '-Wabi' : false,
+ '-Wbad-function-cast' : false,
+ '-Wdeprecated' : false,
+ '-Wenum-compare' : false,
+ '-Wtraditional' : false,
+ '-Wtraditional-conversion' : false,
+ '-Wsystem-headers' : false,
+ '-Wpadded' : false,
+ '-Wunreachable-code' : false,
+ '-Wconversion' : false,
+ '-Wsign-conversion' : false,
+ '-Wvla' : false,
+ '-Wundef' : false,
+ '-Wcast-qual' : false,
+ '-Wlong-long' : false,
+ '-Wswitch-default' : false,
+ '-Wswitch-enum' : false,
+ '-Wstrict-overflow' : false,
+ '-Wunsafe-loop-optimizations' : false,
+ '-Wformat-nonliteral' : false,
+ '-Wfloat-equal' : false,
+ '-Wdeclaration-after-statement' : false,
+ '-Wpacked' : false,
+ '-Wunused-macros' : false,
+ '-Woverlength-strings' : false,
+ '-Wstack-protector' : false,
+ '-Winline' : false,
+ '-Wshadow' : false,
+ '-Wformat-signedness' : false,
+ '-Wnull-dereference' : false,
+ '-Wshift-overflow=2' : false,
+ '-Wmissing-declarations' : false,
+
+ '-Wno-sign-compare' : true,
+ '-Wno-unused-parameter' : true,
+ '-Wno-format-nonliteral' : true,
+ '-Wframe-larger-than=20460' : true,
+ '-fstack-protector-all' : true,
+ '--param=ssp-buffer-size=4' : true,
+ '-fexceptions' : true,
+ '-fasynchronous-unwind-tables' : true,
+ '-fdiagnostics-show-option' : true,
+ '-funit-at-a-time' : true,
+ '-fipa-pure-const' : true,
+ '-Wno-suggest-attribute=pure' : true,
+ '-Wno-suggest-attribute=const' : true,
+}
+
+warnings_setting = []
+warnings_option = get_option('warnings')
+
+if warnings_option == 'all'
+ warnings_setting = all_warnings.keys()
+elif warnings_option == 'spice'
+ all_warnings += spice_warnings
+ foreach warn, enable : all_warnings
+ if enable
+ warnings_setting += warn
+ endif
+ endforeach
+endif
+
+if get_option('werror')
+ warnings_setting += ['-Werror']
+endif
+
+spice_server_global_cflags += warnings_setting
+# other global vars
compiler = meson.get_compiler('c')
spice_server_config_data = configuration_data()
spice_server_include = [include_directories('.')]
diff --git a/meson_options.txt b/meson_options.txt
index 49f59cc4..f89147d7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -50,3 +50,7 @@ option('recorder',
type : 'boolean',
value : false,
description: 'Enable recorder instrumentation')
+
+option('warnings',
+ type : 'combo',
+ choices : ['spice', 'all', 'none'])
diff --git a/subprojects/spice-common b/subprojects/spice-common
index 2e914f33..bb15d481 160000
--- a/subprojects/spice-common
+++ b/subprojects/spice-common
@@ -1 +1 @@
-Subproject commit 2e914f3305f685c82143fa04067ce9f57fbfd602
+Subproject commit bb15d4815ab586b4c4a20f4a565970a44824c42c
--
2.20.1
More information about the Spice-devel
mailing list