Re: Windows build warnings

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Dunstan <andrew@dunslane.net>
Cc: Daniel Gustafsson <daniel@yesql.se>, Greg Nancarrow <gregn4422@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2021-11-26T19:33:28Z
Lists: pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> On 11/26/21 04:12, Daniel Gustafsson wrote:
>> On 26 Nov 2021, at 05:45, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>>> Personally I'm not really in favour of outright disabling the C4101
>>>> warning on Windows, because I think it is a useful warning for
>>>> Postgres developers on Windows for cases unrelated to the use of
>>>> PG_USED_FOR_ASSERTS_ONLY.

[ FTR, that text is not mine; somebody messed up the attribution ]

> I agree with Tom. I don't think we should disable the warning. If we
> can't come up with a reasonable implementation of
> PG_USED_FOR_ASSERTS_ONLY that works with MSVC we should just live with
> the warnings. It's not like we get flooded with them.

I think our policy is to suppress unused-variable warnings if they
appear on current mainstream compilers; and it feels a little churlish
to deem MSVC non-mainstream.  So I stick with my previous suggestion,
which basically was to disable C4101 until such time as somebody can
make PG_USED_FOR_ASSERTS_ONLY work correctly on MSVC.  In the worst
case, that might lead a Windows-based developer to submit a patch that
draws warnings elsewhere ... but the cfbot, other developers, or the
buildfarm will find such problems soon enough.

			regards, tom lane



Commits

  1. Disable unused-variable warning C4101 in MSVC

  2. Remove PF_USED_FOR_ASSERTS_ONLY from variables in general use

  3. Fix handling of non-key columns get_index_column_opclass()