public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tristan Partin <[email protected]>
To: Sutou Kouhei <[email protected]>
Cc: [email protected]
Cc: [email protected]
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
Date: Wed, 13 Mar 2024 00:43:11 -0500
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
On Tue Mar 12, 2024 at 6:56 PM CDT, Sutou Kouhei wrote:
> Hi,
>
> In <[email protected]>
> "Re: meson: Specify -Wformat as a common warning flag for extensions" on Fri, 08 Mar 2024 10:05:27 -0600,
> "Tristan Partin" <[email protected]> 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.
> >
> > $ gcc $(pg_config --cflags) -E - < /dev/null > /dev/null
> > cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’
> > [-Wformat-security]
> > $ gcc -Wall $(pg_config --cflags) -E - < /dev/null > /dev/null
> > (nothing printed)
>
> Thanks for explaining this. You're right. This is the reason
> why we don't need this for PostgreSQL itself but we need
> this for PostgreSQL extensions. Sorry. I should have
> explained this in the first e-mail...
>
>
> What should we do to proceed this patch?
Perhaps adding some more clarification in the comments that I wrote.
- # -Wformat-security requires -Wformat, so check for it
+ # -Wformat-secuirty requires -Wformat. We compile with -Wall in
+ # Postgres, which includes -Wformat=1. -Wformat is shorthand for
+ # -Wformat=1. The set of flags which includes -Wformat-security is
+ # persisted into pg_config --cflags, which is commonly used by
+ # PGXS-based extensions. The lack of -Wformat in the persisted flags
+ # will produce a warning on many GCC versions, so even though adding
+ # -Wformat here is a no-op for Postgres, it silences other use cases.
That might be too long-winded though :).
--
Tristan Partin
Neon (https://neon.tech)
view thread (4+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox