Re: some extra warnings from MSVC

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: some extra warnings from MSVC
Date: 2026-04-11 14:09:58
Message-ID: 419716.1775916598@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter(at)eisentraut(dot)org> writes:
> The first one is from commit 65707ed9afc (Add backtrace support for
> Windows). This would be an error in gcc (from C99 on); it's kind of
> incredible that MSVC doesn't even warn about this by default. I propose
> to add this warning category to the default set.
> (Second thought: For consistency, make this an error, with '/we4013'
> instead of '/w24013'.)

+1 for making it an error.

> The second one is from commit 13b935cd521 (Change dynahash.c and
> hsearch.h to use int64 instead of long). I don't have a patch here to
> include this in the default warning set, mainly because it doesn't
> appear to map to any gcc warning option, but maybe we should add it
> anyway, since it can catch this kind of 4-byte-long-on-Windows issue.

I think it'd be a good idea to warn even if we can't make gcc do that.
I think Windows is the only 64-bit platform we deal with where long
is just 32 bits, so covering the case in MSVC will expose bugs we
would not notice otherwise.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message Dapeng Wang 2026-04-11 12:19:55 Re: Add missing CHECK_FOR_INTERRUPTS in autovacuum catalog scan loops