Re: -Wcast-qual home stretch

From: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
To: Peter Eisentraut <peter(at)eisentraut(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: -Wcast-qual home stretch
Date: 2026-11-05 05:39:24
Message-ID: EBBDFCBD-E1E0-4D8B-842E-A804EEAA3348@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Nov 5, 2026, at 05:55, Peter Eisentraut <peter(at)eisentraut(dot)org> wrote:
>
> On 04.11.26 03:46, Chao Li wrote:
>>
>
>> 4 - After applying the patch set, my local build still gets a couple of warnings:
>
>> We can fix them by using unconstify:
>> ```
>> diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
>> index 6d37359fc96..177434ed975 100644
>> --- a/src/bin/psql/input.c
>> +++ b/src/bin/psql/input.c
>> @@ -303,7 +303,7 @@ encode_history(void)
>> char *cur_ptr;
>> /* some platforms declare HIST_ENTRY.line as const char * */
>> - for (cur_ptr = (char *) cur_hist->line; *cur_ptr; cur_ptr++)
>> + for (cur_ptr = unconstify(char *, cur_hist->line); *cur_ptr; cur_ptr++)
>> {
>> if (*cur_ptr == '\n')
>> *cur_ptr = NL_IN_HISTORY;
>> @@ -323,7 +323,7 @@ decode_history(void)
>> char *cur_ptr;
>> /* some platforms declare HIST_ENTRY.line as const char * */
>> - for (cur_ptr = (char *) cur_hist->line; *cur_ptr; cur_ptr++)
>> + for (cur_ptr = unconstify(char *, cur_hist->line); *cur_ptr; cur_ptr++)
>> {
>> if (*cur_ptr == NL_IN_HISTORY)
>> *cur_ptr = '\n';
>> ```
>
> Ok, what platform and libreadline/libedit version is this? (It's apparently not covered on CI.)
>

It's MacOS 26.6.2 on arm64, using Apple’s system libedit. otool -L reports current version 3.0.0 and compatibility version 2.0.0:
```
% otool -L src/bin/psql/psql
src/bin/psql/psql:
/usr/local/pgsql/lib/libpq.5.dylib (compatibility version 5.0.0, current version 5.20.0)
/usr/lib/libedit.3.dylib (compatibility version 2.0.0, current version 3.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1356.0.0)
```

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-11-05 05:59:19 Clarify wait versus poll behavior in ExecAppendAsyncEventWait
Previous Message Michael Paquier 2026-11-05 05:33:40 Re: Fix cumulative WAL statistics double-counting from parallel workers