Re: More const-marking cleanup

From: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: More const-marking cleanup
Date: 2025-12-29 08:58:08
Message-ID: aVJCoNqO6ybov7eW@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, Dec 23, 2025 at 09:47:55PM -0500, Tom Lane wrote:
> Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com> writes:
> > I had another look and it seems to me that the one (src/port/getopt.c) reported
> > and fixed in the attached of the previous email is the only remaining one to fix.
>
> This fell off my radar for a bit, but pushed now.

Thanks!

> This does raise a question in my mind though: we did not find this
> case the first time around because machines that have new-enough
> compilers to detect such issues will probably not need our version of
> getopt(). So, what other not-always-compiled bits of code could use
> improvement, and how could we find them without undue effort? (This
> extends to more issues than just casting-away-const of course.)

That's a fair point. In fact this particular one has been found with the help of
a Coccinelle script, so your remark makes me think of this thread [1]. Indeed,
Coccinelle could help address this by analyzing the code tree without needing to
compile it.

We could imagine:

- adding Coccinelle scripts to the code tree, or
- running BF members with a set of Coccinelle scripts, or
- running a set of Coccinelle scripts at regular intervals

Analyzing the code tree without the need to compile it looks like a valid answer
to your concern, thoughts?

[1]: https://www.postgresql.org/message-id/aQh79jMqU7mq03Hv%40ip-10-97-1-34.eu-west-3.compute.internal

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 Chao Li 2025-12-29 08:59:48 Remove redundant AttStatsSlot initialization in eqjoinsel()
Previous Message Rahila Syed 2025-12-29 08:56:40 Re: Enhancing Memory Context Statistics Reporting