[libadwaita/msvc: 11/19] meson.build: Force-include msvc_recommended_pragmas.h on MSVC




commit ac83dd77b06e6f1959a159979fa033a035f8c7c7
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 baba25be..4d628565 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]