Re: Windows build warnings

2021-11-30 Thread Daniel Gustafsson
> On 27 Nov 2021, at 14:55, Andrew Dunstan wrote: > ISTM the worst case is that there will be undetected unused variables in > Windows-only code. I guess that would mostly be detected by Msys systems > running gcc. Yes, that should be caught there. I've applied this now together with the remova

Re: Windows build warnings

2021-11-27 Thread Andrew Dunstan
On 11/26/21 15:14, Daniel Gustafsson wrote: >> On 26 Nov 2021, at 20:33, Tom Lane wrote: >> >> 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

Re: Windows build warnings

2021-11-26 Thread Daniel Gustafsson
> On 26 Nov 2021, at 20:33, Tom Lane wrote: > > Andrew Dunstan writes: >> On 11/26/21 04:12, Daniel Gustafsson wrote: >>> On 26 Nov 2021, at 05:45, Tom Lane wrote: > Personally I'm not really in favour of outright disabling the C4101 > warning on Windows, because I think it is a useful

Re: Windows build warnings

2021-11-26 Thread Tom Lane
Andrew Dunstan writes: > On 11/26/21 04:12, Daniel Gustafsson wrote: >> On 26 Nov 2021, at 05:45, Tom Lane 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 ca

Re: Windows build warnings

2021-11-26 Thread Andrew Dunstan
On 11/26/21 04:12, Daniel Gustafsson wrote: >> On 26 Nov 2021, at 05:45, Tom Lane 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

Re: Windows build warnings

2021-11-26 Thread Daniel Gustafsson
> On 26 Nov 2021, at 05:45, Tom Lane 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. I'm not sure I fin

Re: Windows build warnings

2021-11-25 Thread Tom Lane
Greg Nancarrow 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.

Re: Windows build warnings

2021-11-25 Thread Greg Nancarrow
On Thu, Nov 25, 2021 at 11:03 PM Daniel Gustafsson wrote: > > 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 > th

Re: Windows build warnings

2021-11-25 Thread Daniel Gustafsson
> On 22 Nov 2021, at 16:06, Tom Lane wrote: > > Alvaro Herrera writes: >> .. but see >> https://postgr.es/m/cah2-wznwwu+9on9nzcnztk7ua238mctgpxyr1ty7u_msn5z...@mail.gmail.com >> where this was already discussed. I think if we're going to workaround >> PG_USED_FOR_ASSERTS_ONLY not actually worki

Re: Windows build warnings

2021-11-24 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= writes: >> Should we change the compiler checks for attributes in c.h to include >> `|| __has_attribute(…)`, so that we automatically get them on compilers >> that support that (particularly clang)? > > clang already #defines GCC, no?

Re: Windows build warnings

2021-11-24 Thread Tom Lane
=?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= writes: > Should we change the compiler checks for attributes in c.h to include > `|| __has_attribute(…)`, so that we automatically get them on compilers > that support that (particularly clang)? clang already #defines GCC, no? re

Re: Windows build warnings

2021-11-24 Thread Dagfinn Ilmari Mannsåker
Daniel Gustafsson writes: > On 22 Nov 2021, at 16:40, Tom Lane wrote: > >> I can't find anything that is providing a non-empty definition of >> PG_USED_FOR_ASSERTS_ONLY (a/k/a pg_attribute_unused) for anything >> except GCC. > > It's supported in clang as well per the documentation [0] in at l

Re: Windows build warnings

2021-11-23 Thread Greg Nancarrow
On Wed, Nov 24, 2021 at 1:41 AM Alvaro Herrera wrote: > > On 2021-Nov-23, Juan José Santamaría Flecha wrote: > > > On Tue, Nov 23, 2021 at 2:11 PM Daniel Gustafsson wrote: > > > > It's supported in clang as well per the documentation [0] in at least some > > > configurations or distributions: > >

Re: Windows build warnings

2021-11-23 Thread Tom Lane
Alvaro Herrera writes: > Right ... the problem, as I understand, is that the syntax for > [[maybe_unused]] is different from what we can do with the current > pg_attribute_unused -- [[maybe_unused]] goes before the variable name. > We would need to define pg_attribute_unused macro (maybe have it t

Re: Windows build warnings

2021-11-23 Thread Alvaro Herrera
On 2021-Nov-23, Juan José Santamaría Flecha wrote: > On Tue, Nov 23, 2021 at 2:11 PM Daniel Gustafsson wrote: > > It's supported in clang as well per the documentation [0] in at least some > > configurations or distributions: > [[maybe_unused]] is also recognized from Visual Studio 2017 onwards

Re: Windows build warnings

2021-11-23 Thread Juan José Santamaría Flecha
On Tue, Nov 23, 2021 at 2:11 PM Daniel Gustafsson wrote: > > On 22 Nov 2021, at 16:40, Tom Lane wrote: > > > I can't find anything that is providing a non-empty definition of > > PG_USED_FOR_ASSERTS_ONLY (a/k/a pg_attribute_unused) for anything > > except GCC. > > It's supported in clang as well

Re: Windows build warnings

2021-11-23 Thread Daniel Gustafsson
> On 22 Nov 2021, at 16:40, Tom Lane wrote: > > Daniel Gustafsson writes: >> Fair enough. Looking at where we use PG_USED_FOR_ASSERTS_ONLY (and where it >> works), these two warnings are the only places where we apply it to a pointer >> typedef (apart from one place where the variable is indeed

Re: Windows build warnings

2021-11-22 Thread Tom Lane
Daniel Gustafsson writes: > Fair enough. Looking at where we use PG_USED_FOR_ASSERTS_ONLY (and where it > works), these two warnings are the only places where we apply it to a pointer > typedef (apart from one place where the variable is indeed used outside of > asserts). Since it clearly works

Re: Windows build warnings

2021-11-22 Thread Daniel Gustafsson
> On 22 Nov 2021, at 16:06, Tom Lane wrote: > > Alvaro Herrera writes: >> .. but see >> https://postgr.es/m/cah2-wznwwu+9on9nzcnztk7ua238mctgpxyr1ty7u_msn5z...@mail.gmail.com >> where this was already discussed. I think if we're going to workaround >> PG_USED_FOR_ASSERTS_ONLY not actually worki

Re: Windows build warnings

2021-11-22 Thread Tom Lane
Alvaro Herrera writes: > .. but see > https://postgr.es/m/cah2-wznwwu+9on9nzcnztk7ua238mctgpxyr1ty7u_msn5z...@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 prefe

Re: Windows build warnings

2021-11-22 Thread Alvaro Herrera
On 2021-Nov-22, Daniel Gustafsson wrote: > > On 22 Nov 2021, at 12:10, Greg Nancarrow wrote: > > > I've attached a patch to fix these warnings. > > LGTM. .. but see https://postgr.es/m/cah2-wznwwu+9on9nzcnztk7ua238mctgpxyr1ty7u_msn5z...@mail.gmail.com where this was already discussed. I think

Re: Windows build warnings

2021-11-22 Thread Daniel Gustafsson
> On 22 Nov 2021, at 12:10, Greg Nancarrow wrote: > I've attached a patch to fix these warnings. LGTM. -- Daniel Gustafsson https://vmware.com/