pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix -Wcast-qual warning in guc_funcs.c
Date: Wed, 25 Nov 2026 08:07:09 +0000
Message-ID: <E1xW821-00000000Etw-17T9@gemulon.postgresql.org> (raw)

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.evan.chao@gmail.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(-)



Message-ID: <E1xW821-00000000Etw-17T9@gemulon.postgresql.org>
Permalink:  ../E1xW821-00000000Etw-17T9@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xW821-00000000Etw-17T9@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: peter@eisentraut.org
  Subject: Re: pgsql: Fix -Wcast-qual warning in guc_funcs.c
  In-Reply-To: <E1xW821-00000000Etw-17T9@gemulon.postgresql.org>
  References: <E1xW821-00000000Etw-17T9@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox