[vala/wip/meson: 4/4] meson: Check suported cflags for tests
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/meson: 4/4] meson: Check suported cflags for tests
- Date: Sun, 10 Feb 2019 22:07:10 +0000 (UTC)
commit b0c01882bbd6ee5a8c777dcee467385f7f38852b
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Feb 10 21:03:53 2019 +0100
meson: Check suported cflags for tests
tests/meson.build | 54 ++++++++++++++++++++++++++++++++++--------------------
1 file changed, 34 insertions(+), 20 deletions(-)
---
diff --git a/tests/meson.build b/tests/meson.build
index 63bc1b031..69a0ab3a8 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -699,28 +699,42 @@ vala_flags = [
'-X', '-pipe',
'-X', '-lm',
'-X', '-DGETTEXT_PACKAGE="valac"',
- '-X', '-Werror=init-self',
- '-X', '-Werror=implicit',
- '-X', '-Werror=pointer-arith',
- '-X', '-Werror=redundant-decls',
- '-X', '-Werror=return-type',
- '-X', '-Werror=sequence-point',
- '-X', '-Werror=uninitialized',
- '-X', '-Werror=int-to-pointer-cast',
- '-X', '-Werror=pointer-to-int-cast',
- '-X', '-Wformat=2',
- '-X', '-Werror=format-security',
- '-X', '-Werror=format-nonliteral',
- '-X', '-Werror=int-conversion',
- '-X', '-Werror=duplicated-branches',
- '-X', '-Werror=duplicated-cond',
- '-X', '-Werror=declaration-after-statement',
- '-X', '-Werror=maybe-uninitialized',
-# '-X', '-Werror=missing-prototypes',
-# '-X', '-Werror=strict-prototypes',
-# '-X', '-Werror=enum-conversion',
]
+cc = meson.get_compiler('c')
+if cc.get_id() == 'gcc' or cc.get_id() == 'clang'
+ test_cflags = [
+ '-Werror=init-self',
+ '-Werror=implicit',
+ '-Werror=pointer-arith',
+ '-Werror=redundant-decls',
+ '-Werror=return-type',
+ '-Werror=sequence-point',
+ '-Werror=uninitialized',
+ '-Werror=int-to-pointer-cast',
+ '-Werror=pointer-to-int-cast',
+ '-Wformat=2',
+ '-Werror=format-security',
+ '-Werror=format-nonliteral',
+ '-Werror=int-conversion',
+ '-Werror=duplicated-branches',
+ '-Werror=duplicated-cond',
+ '-Werror=declaration-after-statement',
+ '-Werror=maybe-uninitialized',
+ '-Werror=missing-prototypes',
+ '-Werror=strict-prototypes',
+ '-Werror=enum-conversion',
+ ]
+else
+ test_cflags = []
+endif
+
+supported_test_cflags = cc.get_supported_arguments(test_cflags)
+
+foreach flag : supported_test_cflags
+ vala_flags += ['-X', flag]
+endforeach
+
add_test_setup('default', is_default: true, env: 'G_SLICE=debug-blocks G_DEBUG=fatal-warnings')
vg = find_program('valgrind', required: false)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]