[libadwaita/msvc: 266/271] meson.build: Force-include msvc_recommended_pragmas.h on MSVC
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/msvc: 266/271] meson.build: Force-include msvc_recommended_pragmas.h on MSVC
- Date: Tue, 12 Oct 2021 05:29:40 +0000 (UTC)
commit 32de3b9b84b405a68d9ad424160563a692d46456
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Mon Jul 26 18:51:55 2021 +0800
meson.build: Force-include msvc_recommended_pragmas.h on MSVC
This will cover much of the compiler flags that we use for GCC-like compilers
to ensure that the code do not trigger compiler warnings that we want to be
wary of.
meson.build | 94 ++++++++++++++++++++++++++++++++-----------------------------
1 file changed, 50 insertions(+), 44 deletions(-)
---
diff --git a/meson.build b/meson.build
index 30171e68..1f2fa0b3 100644
--- a/meson.build
+++ b/meson.build
@@ -37,54 +37,60 @@ src_inc = include_directories('src')
cc = meson.get_compiler('c')
global_c_args = []
-test_c_args = [
- '-Wcast-align',
- '-Wdate-time',
- '-Wdeclaration-after-statement',
- ['-Werror=format-security', '-Werror=format=2'],
- '-Wendif-labels',
- '-Werror=incompatible-pointer-types',
- '-Werror=missing-declarations',
- '-Werror=overflow',
- '-Werror=return-type',
- '-Werror=shift-count-overflow',
- '-Werror=shift-overflow=2',
- '-Werror=implicit-fallthrough=3',
- '-Wformat-nonliteral',
- '-Wformat-security',
- '-Winit-self',
- '-Wmaybe-uninitialized',
- '-Wmissing-field-initializers',
- '-Wmissing-include-dirs',
- '-Wmissing-noreturn',
- '-Wnested-externs',
- '-Wno-missing-field-initializers',
- '-Wno-sign-compare',
- '-Wno-strict-aliasing',
- '-Wno-unused-parameter',
- '-Wold-style-definition',
- '-Wpointer-arith',
- '-Wredundant-decls',
- '-Wshadow',
- '-Wstrict-prototypes',
- '-Wswitch-default',
- '-Wswitch-enum',
- '-Wtype-limits',
- '-Wundef',
- '-Wunused-function',
-]
+test_c_args = []
target_system = target_machine.system()
-if get_option('buildtype') != 'plain'
- if target_system == 'windows'
- test_c_args += '-fstack-protector'
- else
- test_c_args += '-fstack-protector-strong'
+if cc.get_id() != 'msvc'
+ test_c_args += [
+ '-Wcast-align',
+ '-Wdate-time',
+ '-Wdeclaration-after-statement',
+ ['-Werror=format-security', '-Werror=format=2'],
+ '-Wendif-labels',
+ '-Werror=incompatible-pointer-types',
+ '-Werror=missing-declarations',
+ '-Werror=overflow',
+ '-Werror=return-type',
+ '-Werror=shift-count-overflow',
+ '-Werror=shift-overflow=2',
+ '-Werror=implicit-fallthrough=3',
+ '-Wformat-nonliteral',
+ '-Wformat-security',
+ '-Winit-self',
+ '-Wmaybe-uninitialized',
+ '-Wmissing-field-initializers',
+ '-Wmissing-include-dirs',
+ '-Wmissing-noreturn',
+ '-Wnested-externs',
+ '-Wno-missing-field-initializers',
+ '-Wno-sign-compare',
+ '-Wno-strict-aliasing',
+ '-Wno-unused-parameter',
+ '-Wold-style-definition',
+ '-Wpointer-arith',
+ '-Wredundant-decls',
+ '-Wshadow',
+ '-Wstrict-prototypes',
+ '-Wswitch-default',
+ '-Wswitch-enum',
+ '-Wtype-limits',
+ '-Wundef',
+ '-Wunused-function',
+ ]
+
+ if get_option('buildtype') != 'plain'
+ if target_system == 'windows'
+ test_c_args += '-fstack-protector'
+ else
+ test_c_args += '-fstack-protector-strong'
+ endif
endif
-endif
-if get_option('profiling')
- test_c_args += '-pg'
+ if get_option('profiling')
+ test_c_args += '-pg'
+ endif
+else
+ test_c_args += '-FImsvc_recommended_pragmas.h'
endif
foreach arg: test_c_args
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]