Re: Windows build warnings

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Greg Nancarrow <gregn4422(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Windows build warnings
Date: 2021-11-25 12:03:41
Message-ID: 0580A552-80FE-41AC-BAFD-FDFEB9E7D5EA@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 22 Nov 2021, at 16:06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
>> .. but see
>> https://postgr.es/m/CAH2-WznwWU+9on9nZCnZtk7uA238MCTgPxYr1Ty7U_Msn5ZGwQ@mail.gmail.com
>> where this was already discussed. I think if we're going to workaround
>> PG_USED_FOR_ASSERTS_ONLY not actually working, we may as well get rid of
>> it entirely. My preference would be to fix it so that it works on more
>> platforms (at least Windows in addition to GCC).
>
> Yeah, I do not think there is a reason to change the code if it's using
> PG_USED_FOR_ASSERTS_ONLY properly. We should either make that macro
> work on $compiler, or ignore such warnings from $compiler.

So, to reach some conclusion on this thread; it seems the code is using
PG_USED_FOR_ASSERTS_ONLY - as it's currently implemented - properly, but it
doesn't work on MSVC and isn't likely to work in the shape it is today.
Reworking to support a wider range of compilers will also likely mean net new
code.

To silence the warnings in the meantime (if the rework at all happens) we
should either apply the patch from Greg or add C4101 to disablewarnings in
src/tools/msvc/Project.pm as mentioned above. On top of that, we should apply
the patch I proposed downthread to remove PG_USED_FOR_ASSERTS_ONLY where it's
no longer applicable. Personally I'm fine with either, and am happy to make it
happen, once we agree on what it should be.

Thoughts?

--
Daniel Gustafsson https://vmware.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-11-25 12:08:13 Re: pg_get_publication_tables() output duplicate relid
Previous Message Marcos Pegoraro 2021-11-25 11:43:11 pg_upgrade and publication/subscription problem