[glibmm] Meson: Re-organize MSVC compiler warnings-related items



commit 59592487a21d3d2aee89376bb90c3ea4388052a4
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon May 23 15:35:29 2022 +0800

    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.

 meson.build | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 3ffc451a..cf632f0c 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', '/wd4267', '/EHsc', '/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
+    '/EHsc',  # avoid warnings caused by exception handling model used
+    '/utf-8', # Avoid C4819 unicode conversion warnings when building on CJK locales
+  ]
+  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')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]