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

From Christoph Berg
Subject Re: cpluspluscheck complains about use of register
Date
Msg-id Zcn65ThY5lHK--3Z@msg.df7cb.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
List pgsql-hackers
Re: Tom Lane
> > I hit this again while porting cplupluscheck to be invoked by meson as
> > well. ISTM that we should just remove the uses of register.
> 
> OK by me.
> 
> > I tried to use -Wregister to keep us honest going forward, but unfortunately
> > it only works with a C++ compiler...
> 
> I think we only really care about stuff that cpluspluscheck would spot,
> so I don't feel a need to mess with the standard compilation flags.

This has started to hurt: postgresql-debversion (a Debian version number
data type written in C++) failed to build against Postgresql <= 15 on
Ubuntu's next LTS release (24.04):

In file included from /usr/include/postgresql/15/server/port/atomics.h:70:
/usr/include/postgresql/15/server/port/atomics/arch-x86.h:143:2: error: ISO C++17 does not allow 'register' storage
classspecifier [-Wregister]
 
  143 |         register char _res = 1;

I managed to work around it by putting `#define register` before
including the PG headers.

Should the removal of "register" be backported to support that better?

Christoph



pgsql-hackers by date:

Previous
From: Shlok Kyal
Date:
Subject: Add publisher and subscriber to glossary documentation.
Next
From: Alvaro Herrera
Date:
Subject: Re: Add publisher and subscriber to glossary documentation.