Re: Don't cast away const where possible

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Don't cast away const where possible
Date: 2026-02-24 16:33:49
Message-ID: aZ3S7b++9As/yLez@ip-10-97-1-34.eu-west-3.compute.internal
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Tue, Feb 24, 2026 at 05:05:34PM +0100, Peter Eisentraut wrote:
> On 23.02.26 12:22, Bertrand Drouvot wrote:
> > I can see a "volatile" one though:
> >
> > vacuum.c:1885:46: warning: cast discards ‘volatile’ qualifier from pointer target type [-Wcast-qual]
> >
> > worth to "fix" like in the attached while at it? (It's not really a fix as it
> > moves the warning from vacuum.c to c.h, but that's consistent with 481018f2804).
>
> That fix looks correct.

Thanks for looking at it!

> But my patch says it's making changes only without
> use unconstify and the like.
> To fix all -Wcast-qual warnings, you'd need
> more changes like that, which I'm not currently proposing.

That's the only one "cast discards ‘volatile'" remaining outside c.h, that's
why I proposed a dedicated patch for it in passing. I'll open a dedicated thread
for the remaining volatile one.

Regards,

--
Bertrand Drouvot
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2026-02-24 16:37:13 Re: Fix bug of clearing of waitStart in ProcWakeup()
Previous Message Induja Sreekanthan 2026-02-24 16:33:03 BUG: ReadStream look-ahead exhausts local buffers when effective_io_concurrency>=64