pgsql: Fix -Wcast-qual warnings in psql

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix -Wcast-qual warnings in psql
Date: 2026-11-25 08:07:09
Message-ID: E1xW821-00000000Ety-1C2r@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix -Wcast-qual warnings in psql

Some platforms declare HIST_ENTRY.line as const char * (apparently
macOS and NetBSD libedit), but we cast that away using (char *) and
write into it. To appease -Wcast-qual, change that cast to
unconstify(). But for other platforms where it is plain char * to
begin with, unconstify doesn't work because it doesn't allow casting a
non-const to a non-const. So to make this work portably we first have
to cast to (const char *). (Maybe we could make unconstify handle
this, but so far it is only required in this one place, so it might
not be worth it.)

Reported-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/70b86618-4038-4b19-8847-1a400d99d477%40eisentraut.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5ff67951c46d304d5ac4cda62eb99d64cd292c8c

Modified Files
--------------
src/bin/psql/input.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-25 09:34:34 pgsql: Fix psql's non-autocommit mode for REPACK
Previous Message Fujii Masao 2026-11-25 07:23:40 pgsql: pg_receivewal, pg_basebackup: Fix temporary file cleanup on erro