[libadwaita/msvc: 4/13] 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: 4/13] meson.build: Force-include msvc_recommended_pragmas.h on MSVC
- Date: Wed, 12 Jan 2022 10:00:00 +0000 (UTC)
commit 2fea8b184c4cd7c2c23de428fe378c76a888120a
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 41931b4c..99d56460 100644
--- a/meson.build
+++ b/meson.build
@@ -36,54 +36,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]