Re: Windows build warnings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Windows build warnings
Date
Msg-id 363416.1637901909@sss.pgh.pa.us
Whole thread Raw
In response to Re: Windows build warnings  (Greg Nancarrow <gregn4422@gmail.com>)
Responses Re: Windows build warnings
List pgsql-hackers
Greg Nancarrow <gregn4422@gmail.com> writes:
> AFAICS, the fundamental difference here seems to be that the GCC
> compiler still regards a variable as "unused" if it is never read,
> whereas if the variable is set (but not necessarily read) that's
> enough for the Windows C compiler to regard it as "used".

It depends.  Older gcc versions don't complain about set-but-not-read
variables, but clang has done so for awhile (with a specific warning
message about the case), and I think recent gcc follows suit.

> 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.

IMO we should either do that or do whatever's necessary to make the
macro work properly on MSVC.  I'm not very much in favor of jumping
through hoops to satisfy a compiler that has a randomly-different-
but-still-demonstrably-inadequate version of this warning.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Greg Nancarrow
Date:
Subject: Re: Windows build warnings
Next
From: Ken Kato
Date:
Subject: [PATCH] ALTER tab completion