Re: meson: Specify -Wformat as a common warning flag for extensions

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Tristan Partin <tristan(at)neon(dot)tech>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Sutou Kouhei <kou(at)clear-code(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
Date: 2024-03-13 07:38:28
Message-ID: 49e97fd0-c17e-4cbc-aeee-80ac51400736@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
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.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andy Fan 2024-03-13 07:39:07 Re: a wrong index choose when statistics is out of date
Previous Message Heikki Linnakangas 2024-03-13 07:30:27 Re: Refactoring backend fork+exec code