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




commit d088508528f6c24d9e048c2619635f5c81c90fd5
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 a746bfbd..7a9cd762 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]