From e040595f57c67411746acb9e76b6645c4b7d418c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 3 Nov 2026 15:39:36 +0100 Subject: [PATCH v2 11/11] Add warning option -Wcast-qual All the warnings have been fixed by previous patches, so this can be activated by default now. Discussion: https://www.postgresql.org/message-id/flat/70b86618-4038-4b19-8847-1a400d99d477%40eisentraut.org --- configure | 4 ++-- configure.ac | 4 ++-- meson.build | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 8d29a0bf6a0..d44ade32d93 100755 --- a/configure +++ b/configure @@ -5250,8 +5250,8 @@ fi # but has its own. Also check other compiler-specific flags here. if test "$GCC" = yes -a "$ICC" = no; then - CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith" - CXXFLAGS="-Wall -Wpointer-arith" + CFLAGS="-Wall -Wcast-qual -Wmissing-prototypes -Wpointer-arith" + CXXFLAGS="-Wall -Wcast-qual -Wpointer-arith" # These work in some but not all gcc versions save_CFLAGS=$CFLAGS diff --git a/configure.ac b/configure.ac index 36e4f9ca0cf..a99e0c7288d 100644 --- a/configure.ac +++ b/configure.ac @@ -535,8 +535,8 @@ fi # but has its own. Also check other compiler-specific flags here. if test "$GCC" = yes -a "$ICC" = no; then - CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith" - CXXFLAGS="-Wall -Wpointer-arith" + CFLAGS="-Wall -Wcast-qual -Wmissing-prototypes -Wpointer-arith" + CXXFLAGS="-Wall -Wcast-qual -Wpointer-arith" # These work in some but not all gcc versions save_CFLAGS=$CFLAGS PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) diff --git a/meson.build b/meson.build index 3238c849e1b..aeabeed45bb 100644 --- a/meson.build +++ b/meson.build @@ -2204,6 +2204,7 @@ vectorize_cflags = cc.get_supported_arguments(['-ftree-vectorize']) unroll_loops_cflags = cc.get_supported_arguments(['-funroll-loops']) common_warning_flags = [ + '-Wcast-qual', '-Wpointer-arith', # Really don't want VLAs to be used in our dialect of C '-Werror=vla', -- 2.56.0