From ef684fa6ea2f832ba97d39a1ffef6a7c084ddd9e Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 3 Aug 2026 11:55:28 +0200 Subject: [PATCH v2] Fix MSVC warnings from new timezone code The new timezone code from commit aeb07c55fab introduced a few new compiler warnings from MSVC: ../src/timezone/zic.c(353): warning C5287: operands are different enum types '' and ''; use an explicit cast to silence this warning ../src/timezone/zic.c(353): warning C5287: operands are different enum types '' and ''; use an explicit cast to silence this warning ../src/timezone/zic.c(1654): warning C4146: unary minus operator applied to unsigned type, result still unsigned Silence these warnings with pragmas. In order not to make future code merges more complicated, the pragmas apply to the entire file, not only to the specific code sections where they are needed. This also prevents further warnings of the same kinds creeping in. Discussion: https://www.postgresql.org/message-id/flat/2294297.1780270682%40sss.pgh.pa.us --- src/timezone/zic.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/timezone/zic.c b/src/timezone/zic.c index cc6550bdb14..a1256ca49c2 100644 --- a/src/timezone/zic.c +++ b/src/timezone/zic.c @@ -10,6 +10,17 @@ #include "postgres_fe.h" +/* + * Disable some warnings on MSVC. See also + * . + */ +#ifdef _MSC_VER +/* warning C4146: unary minus operator applied to unsigned type, result still unsigned */ +#pragma warning(disable: 4146) +/* warning C5287: operands are different enum types */ +#pragma warning(disable: 5287) +#endif + #include #include #include -- 2.55.0