summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2017-02-09 13:48:59 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2017-02-09 13:48:59 +0000
commit9b56140962ee6358184fb7c4ff2d5e3fac7dd7a9 (patch)
tree383049bae61748ba7600f4baa369485f929de7d6 /meson.build
parent8a4f42a7136e9b30402ad22e8e1a34d420966cd8 (diff)
downloadlibepoxy-9b56140962ee6358184fb7c4ff2d5e3fac7dd7a9.tar.gz
Add compiler arguments for MSVC builds
We're using a bunch of compiler arguments when building with GCC and compilers that expose a GCC compatibility layer, but we should also have warnings when building with MSVC. GLib has a bunch of compiler arguments, taken from the "Win32 Programming" book, that we can reuse.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build25
1 files changed, 24 insertions, 1 deletions
diff --git a/meson.build b/meson.build
index bf6531a..9651a6c 100644
--- a/meson.build
+++ b/meson.build
@@ -73,7 +73,30 @@ endif
conf.set10('ENABLE_GLX', build_glx)
# Compiler flags, taken from the Xorg macros
-if cc.get_id() != 'msvc'
+if cc.get_id() == 'msvc'
+ # Compiler options taken from msvc_recommended_pragmas.h
+ # in GLib, based on _Win32_Programming_ by Rector and Newcomer
+ test_cflags = [
+ '-W3',
+ '-we4002', # too many actual parameters for macro
+ '-we4003', # not enough actual parameters for macro
+ '-w14010', # single-line comment contains line-continuation character
+ '-we4013', # 'function' undefined; assuming extern returning int
+ '-w14016', # no function return type; using int as default
+ '-we4020', # too many actual parameters
+ '-we4021', # too few actual parameters
+ '-we4027', # function declared without formal parameter list
+ '-we4029', # declared formal parameter list different from definition
+ '-we4033', # 'function' must return a value
+ '-we4035', # 'function' : no return value
+ '-we4045', # array bounds overflow
+ '-we4047', # different levels of indirection
+ '-we4049', # terminating line number emission
+ '-we4053', # an expression of type void was used as an operand
+ '-we4071', # no function prototype given
+ '-we4819', # the file contains a character that cannot be represented in the current code page
+ ]
+elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
test_cflags = [
'-Wpointer-arith',
'-Wmissing-declarations',