Thread

  1. Re: More const-marking cleanup

    Bertrand Drouvot <bertranddrouvot.pg@gmail.com> — 2025-12-29T08:58:08Z

    Hi,
    
    On Tue, Dec 23, 2025 at 09:47:55PM -0500, Tom Lane wrote:
    > Bertrand Drouvot <bertranddrouvot.pg@gmail.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