From a0f3b0681a42d87ed4806936bd922d863066dadf Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 23 Mar 2026 16:04:02 +0100 Subject: [PATCH v2 1/4] Disable warnings in system headers in MSVC This matches the standard behavior in GCC. The required option is available since VS 2017. Then, we can remove one workaround for avoiding a warning from a system header. --- meson.build | 4 ++++ src/backend/port/win32/crashdump.c | 14 -------------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/meson.build b/meson.build index 0a181909fab..79cc7b4e758 100644 --- a/meson.build +++ b/meson.build @@ -2309,6 +2309,10 @@ if cc.get_id() == 'msvc' '/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] + + # Disable warnings in system headers + '/external:anglebrackets', + '/external:W0', ] cppflags += [ diff --git a/src/backend/port/win32/crashdump.c b/src/backend/port/win32/crashdump.c index 05790ba6ac1..0efeb9a9236 100644 --- a/src/backend/port/win32/crashdump.c +++ b/src/backend/port/win32/crashdump.c @@ -38,21 +38,7 @@ #include "postgres.h" -/* - * Some versions of the MS SDK contain "typedef enum { ... } ;" which the MS - * compiler quite sanely complains about. Well done, Microsoft. - * This pragma disables the warning just while we include the header. - * The pragma is known to work with all (as at the time of writing) supported - * versions of MSVC. - */ -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4091) -#endif #include -#ifdef _MSC_VER -#pragma warning(pop) -#endif /* * Much of the following code is based on CodeProject and MSDN examples, base-commit: 085a531983e210318d9e7d7088482cf4090b1fa6 -- 2.53.0