0001-MSVC-Improve-warning-options-set.patch
text/plain
Filename: 0001-MSVC-Improve-warning-options-set.patch
Type: text/plain
Part: 0
Message:
MSVC: Improve warning options set
Patch
Format: format-patch
Series: patch 0001
Subject: MSVC: Improve warning options set
| File | + | − |
|---|---|---|
| meson.build | 13 | 5 |
From bb67ddee244d74e77b3de9d1418e44d4152adbef Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Tue, 28 Oct 2025 22:11:26 +0100
Subject: [PATCH 1/2] MSVC: Improve warning options set
The previous code had a set of warnings to disable on MSVC. But some
of these weren't actually enabled by default anyway, only in higher
MSVC warning levels (/W, maps to meson warning_level). I rearranged
this so that it is clearer in what MSVC warning level a warning would
have been enabled. Furthermore, sort them numerically within the
levels.
Moreover, we can add a few warning types to the default set, to get a
similar set of warnings that we get by default with gcc or clang (the
equivalents of -Wswitch and -Wformat).
ci-os-only: windows
---
meson.build | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/meson.build b/meson.build
index 395416a6060..5ba7f2c8a24 100644
--- a/meson.build
+++ b/meson.build
@@ -2147,13 +2147,21 @@ endforeach
if cc.get_id() == 'msvc'
cflags_warn += [
- '/wd4018', # signed/unsigned mismatch
- '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
- '/wd4273', # inconsistent DLL linkage
- '/wd4101', # unreferenced local variable
- '/wd4102', # unreferenced label
+ # Warnings to disable:
+ # from /W1:
'/wd4090', # different 'modifier' qualifiers
+ '/wd4273', # inconsistent DLL linkage
+ # from /W2:
+ '/wd4244', # conversion from 'type1' to 'type2', possible loss of data
+ # from /W3:
+ '/wd4018', # signed/unsigned mismatch
+ '/wd4101', # unreferenced local variable [like -Wunused-variable, but there is no "unused" attribute, so too noisy]
'/wd4267', # conversion from 'size_t' to 'type', possible loss of data
+
+ # Additional warnings to enable:
+ '/w24062', # enumerator 'identifier' in switch of enum 'enumeration' is not handled [like -Wswitch]
+ '/w24102', # unreferenced label [like -Wunused-label]
+ '/w24777', # 'function' : format string 'string' requires an argument of type 'type1', but variadic argument number has type 'type2' [like -Wformat]
]
cppflags += [
--
2.51.0