On 20.01.26 13:10, Bertrand Drouvot wrote:
On Tue, Jan 20, 2026 at 08:54:18AM +0100, Peter Eisentraut wrote:
This patch fixes cases where a qualifier (const, in all cases here) was
dropped by a cast, but the cast was otherwise necessary or desirable, so the
straightforward fix is to add the qualifier into the cast.

This was checked with gcc -Wcast-qual, but it doesn't fix all such warnings,
only the trivially fixable ones.

diff --git a/src/include/varatt.h b/src/include/varatt.h
index eccd3ca04d6..03e9d1869aa 100644
--- a/src/include/varatt.h
+++ b/src/include/varatt.h

It looks like those changes produce:

../../../src/include/varatt.h: In function ‘VARDATA’:
../../../src/include/varatt.h:261:33: warning: return discards ‘const’ 
qualifier from pointer target type [-Wdiscarded-qualifiers]
   261 | #define VARDATA_4B(PTR)         (((const varattrib_4b *) 
(PTR))->va_4byte.va_data)

Strange, I don't see that. What compiler is this, and do you use any special options?

Also [1], detected a few more trivially fixable ones (see attached).

Yes, these should be included.

The one in spgquadtreeproc.c was #ifdef'ed out, so my testing didn't see it. I suppose the other one is only compiled when you run the unicode tests.



Reply via email to