From 54e221617eb37e54ba0f429e2c686f398056be93 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 13 Nov 2026 10:58:53 +0100 Subject: [PATCH 5/5] Add warning option -Wformat-nonliteral Note that this option is supported by ancient gcc and clang versions, so we don't need a check in configure. --- configure | 4 ++-- configure.ac | 4 ++-- meson.build | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 8d29a0bf6a0..d25476b604f 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 -Wformat-nonliteral -Wmissing-prototypes -Wpointer-arith" + CXXFLAGS="-Wall -Wformat-nonliteral -Wpointer-arith" # These work in some but not all gcc versions save_CFLAGS=$CFLAGS diff --git a/configure.ac b/configure.ac index 36e4f9ca0cf..1db1136a922 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 -Wformat-nonliteral -Wmissing-prototypes -Wpointer-arith" + CXXFLAGS="-Wall -Wformat-nonliteral -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..84033c4ead8 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 = [ + '-Wformat-nonliteral', '-Wpointer-arith', # Really don't want VLAs to be used in our dialect of C '-Werror=vla', -- 2.56.0