[gtk-vnc] meson: only set extra warning flags when warninglevel==2
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] meson: only set extra warning flags when warninglevel==2
- Date: Thu, 1 Apr 2021 15:10:06 +0000 (UTC)
commit 731146cfefd9de998b3d50cde6a589bb82418ca1
Author: Daniel P. Berrangé <dan berrange com>
Date: Wed Mar 31 14:24:49 2021 +0100
meson: only set extra warning flags when warninglevel==2
This makes us respect the meson warning level and avoids warnings from
meson about reinventing its warninglevel feature.
Signed-off-by: Daniel P. Berrangé <berrange redhat com>
meson.build | 48 +++++++++++++++++++++++-------------------------
1 file changed, 23 insertions(+), 25 deletions(-)
---
diff --git a/meson.build b/meson.build
index ef8bc66..b3fd98b 100644
--- a/meson.build
+++ b/meson.build
@@ -5,7 +5,7 @@ project(
default_options: [
'buildtype=debugoptimized',
'c_std=gnu99',
- 'warning_level=1',
+ 'warning_level=2',
],
meson_version: '>= 0.49.0'
)
@@ -124,10 +124,8 @@ gnome = import('gnome')
i18n = import('i18n')
check_cflags = [
- '-W',
'-Waddress',
'-Waggressive-loop-optimizations',
- '-Wall',
'-Warray-bounds',
'-Wattributes',
'-Wbuiltin-macro-redefined',
@@ -145,7 +143,6 @@ check_cflags = [
'-Wempty-body',
'-Wendif-labels',
'-Wenum-compare',
- '-Wextra',
'-Wformat-contains-nul',
'-Wformat-extra-args',
'-Wformat-security',
@@ -241,31 +238,32 @@ check_cflags = [
'-Wno-suggest-attribute=const',
]
-cflags = []
-foreach cflag: check_cflags
- if cc.has_argument(cflag)
- cflags += [cflag]
+if get_option('warning_level') == '2'
+ cflags = []
+ foreach cflag: check_cflags
+ if cc.has_argument(cflag)
+ cflags += [cflag]
+ endif
+ endforeach
+
+ if host_machine.system() in [ 'linux', 'freebsd', 'windows' ]
+ # we prefer -fstack-protector-strong but fallback to -fstack-protector-all
+ fstack_cflags = cc.first_supported_argument([
+ '-fstack-protector-strong',
+ '-fstack-protector-all',
+ ])
+ cflags += fstack_cflags
+
+ # When building with mingw using -fstack-protector requires libssp library
+ # which is included by using -fstack-protector with linker.
+ if fstack_cflags.length() == 1 and host_machine.system() == 'windows'
+ add_project_link_arguments(fstack_cflags, language: 'c')
+ endif
endif
-endforeach
-
-if host_machine.system() in [ 'linux', 'freebsd', 'windows' ]
- # we prefer -fstack-protector-strong but fallback to -fstack-protector-all
- fstack_cflags = cc.first_supported_argument([
- '-fstack-protector-strong',
- '-fstack-protector-all',
- ])
- cflags += fstack_cflags
-
- # When building with mingw using -fstack-protector requires libssp library
- # which is included by using -fstack-protector with linker.
- if fstack_cflags.length() == 1 and host_machine.system() == 'windows'
- add_project_link_arguments(fstack_cflags, language: 'c')
- endif
+ add_project_arguments(cflags, language: 'c')
endif
-add_project_arguments(cflags, language: 'c')
-
gtk_vnc_prefix = get_option('prefix')
gtk_vnc_bindir = join_paths(gtk_vnc_prefix, get_option('bindir'))
gtk_vnc_libdir = join_paths(gtk_vnc_prefix, get_option('libdir'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]