pgsql: Fix -Wcast-qual warning in guc_funcs.c

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

Fix -Wcast-qual warning in guc_funcs.c

show_all_settings() passed its char *values[] array to
GetConfigOptionValues() by casting it to const char **, which triggers
-Wcast-qual warnings. This was harmless in practice, because the only
consumer, BuildTupleFromCStrings(), does not modify the strings.

Fix by declaring the array as const char *values[], which is what
GetConfigOptionValues() stores into it, and casting away the const
with unconstify() when passing it to BuildTupleFromCStrings(). This
keeps the const removal explicit and type-checked, and it compiles to
the same code as before.

Reviewed-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/470d9948965835a8c3bfb3ac102384bcc84a604c

Modified Files
--------------
src/backend/utils/misc/guc_funcs.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 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