Re: cpluspluscheck complains about use of register - Mailing list pgsql-hackers

From Andres Freund
Subject Re: cpluspluscheck complains about use of register
Date
Msg-id 20220308185902.ibdqmasoaunzjrfc@alap3.anarazel.de
Whole thread Raw
In response to Re: cpluspluscheck complains about use of register  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: cpluspluscheck complains about use of register  (Fabien COELHO <coelho@cri.ensmp.fr>)
Re: cpluspluscheck complains about use of register  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Hi,

On 2022-03-08 13:46:36 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > When running cpluspluscheck I get many many complaints like
> > /tmp/pg-test-repo/src/include/port/atomics/arch-x86.h:143:23: warning: ISO C++17 does not allow ‘register’ storage
classspecifier [-Wregister]
 
>
> Interesting, I don't see that here.

Probably a question of the gcc version. I think starting with 11 g++ defaults
to C++ 17.


> > It seems we should just remove the use of register?
>
> I have a vague idea that it was once important to say "register" if
> you are going to use the variable in an asm snippet that requires it
> to be in a register.  That might be wrong, or it might be obsolete
> even if once true.  We could try taking these out and seeing if the
> buildfarm complains.

We have several inline asm statements not using register despite using
variables in a register (e.g. pg_atomic_compare_exchange_u32_impl()), so I
wouldn't expect a problem with compilers we support.

Should we make configure test for -Wregister? There's at least one additional
use of register that we'd have to change (pg_regexec).


> (If so, maybe -Wno-register would help?)

That's what I did to work around the flood of warnings locally, so it'd
work.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Time to drop plpython2?
Next
From: Andres Freund
Date:
Subject: Re: Time to drop plpython2?