summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2022-05-23 15:35:29 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2022-05-23 15:35:29 +0800
commit364955d423c9d02b0d35145e87824ddbe6e51fa1 (patch)
treed2d635d264edc425038acbdcc23e07effd401796
parentb5081c2436663e4122ea6bb790747f3e21d95679 (diff)
downloadglibmm-364955d423c9d02b0d35145e87824ddbe6e51fa1.tar.gz
Meson: Re-organize MSVC compiler warnings-related items
Add a short description of each of the current compiler flags we are using for this purpose, and only apply '/wd4267' for 64-bit builds since that flag normally applies for 64-bit builds only.
-rw-r--r--meson.build18
1 files changed, 14 insertions, 4 deletions
diff --git a/meson.build b/meson.build
index 26c9e1e7..f3f4d730 100644
--- a/meson.build
+++ b/meson.build
@@ -233,10 +233,20 @@ msvc14x_toolset_ver = ''
# MSVC: Ignore warnings that aren't really harmful, but make those
# that should not be overlooked stand out.
if is_msvc
- disabled_warnings = cpp_compiler.get_supported_arguments([
- '/FImsvc_recommended_pragmas.h', '/wd4146', '/wd4267', '/utf-8'
- ])
- add_project_arguments(disabled_warnings, language: 'cpp')
+ disable_warnings_list = [
+ '/FImsvc_recommended_pragmas.h', # Turn off harmless warnings but make potentially
+ # dangerous ones glaring, distributed with GLib
+ '/utf-8', # Avoid C4819 unicode conversion warnings when building on CJK locales
+ '/wd4146', # unary minus operator applied to unsigned type, result still unsigned
+ ]
+ if host_machine.cpu_family() == 'x86_64' or host_machine.cpu_family() == 'aarch64'
+ # 'var' : conversion from 'size_t' to 'type', possible loss of data (applies on 64-bit builds)
+ disable_warnings_list += '/wd4267'
+ endif
+ add_project_arguments(
+ cpp_compiler.get_supported_arguments(disable_warnings_list),
+ language: 'cpp',
+ )
if use_msvc14x_toolset_ver
if cpp_compiler.version().version_compare('>=19.30')