Re: meson: Specify -Wformat as a common warning flag for extensions
Peter Eisentraut <peter@eisentraut.org>
From: Peter Eisentraut <peter@eisentraut.org>
To: Tristan Partin <tristan@neon.tech>, Michael Paquier <michael@paquier.xyz>
Cc: Sutou Kouhei <kou@clear-code.com>, pgsql-hackers@postgresql.org
Date: 2024-03-13T07:38:28Z
Lists: pgsql-hackers
On 08.03.24 17:05, Tristan Partin wrote: > Ok, I figured this out. -Wall implies -Wformat=1. We set warning_level > to 1 in the Meson project() call, which implies -Wall, and set -Wall in > CFLAGS for autoconf. That's the reason we don't get issues building > Postgres. A user making use of the pg_config --cflags option, as Sutou > is, *will* run into the aforementioned issues, since we don't propogate > -Wall into pg_config. (The actual mechanism for extensions is that they get CFLAGS from Makefile.global, but pg_config has the same underlying issue.) I think the fix then is to put -Wall into CFLAGS in Makefile.global. Looking at a diff of Makefile.global between an autoconf and a meson build, I also see that under meson, CFLAGS doesn't get -O2 -g (or similar, depending on settings). This presumably has the same underlying issue that meson handles those flags internally. For someone who wants to write a fix for this, the relevant variable is var_cflags in our meson scripts. And var_cxxflags as well.
Commits
-
meson: Restore implicit warning/debug/optimize flags for extensions
- 3482bab5e30a 17.0 landed