From: Sutou Kouhei <kou@clear-code.com>
To: andres@anarazel.de
Cc: peter@eisentraut.org
Cc: tristan@neon.tech
Cc: michael@paquier.xyz
Cc: pgsql-hackers@postgresql.org
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
Date: Mon, 08 Apr 2024 10:01:17 +0900 (JST)
Message-ID: <20240408.100117.1165016889947781960.kou@clear-code.com> (raw)
In-Reply-To: <20240407232635.fq4kc5556lahaoej@awork3.anarazel.de>
References: <49e97fd0-c17e-4cbc-aeee-80ac51400736@eisentraut.org>
<20240315.183655.616433279210896579.kou@clear-code.com>
<20240407232635.fq4kc5556lahaoej@awork3.anarazel.de>
Hi Andres,
Thanks for reviewing this!
In <20240407232635.fq4kc5556lahaoej@awork3.anarazel.de>
"Re: meson: Specify -Wformat as a common warning flag for extensions" on Sun, 7 Apr 2024 16:26:35 -0700,
Andres Freund <andres@anarazel.de> wrote:
> This seems like a fair amount of extra configure tests. Particularly because
> /W* isn't ever interesting for Makefile.global - they're msvc flags - because
> you can't use that with msvc.
>
> I'm also doubtful that it's worth supporting warning_level=3/everything, you
> end up with a completely flood of warnings that way.
OK. I've removed "/W*" flags and warning_level==3/everything
cases.
How about the attached v5 patch?
Thanks,
--
kou
Attachments:v5-0001-meson-Restore-implicit-warning-debug-optimize-fla.patch (text/x-patch, 3.3K) download
From 205ef88c66cf1050eedfc1e72d951de93a02e53a Mon Sep 17 00:00:00 2001
From: Sutou Kouhei <kou@clear-code.com>
Date: Fri, 15 Mar 2024 18:27:30 +0900
Subject: [PATCH v5] meson: Restore implicit warning/debug/optimize flags for
extensions
Meson specifies warning/debug/optimize flags such as "-Wall", "-g" and
"-O2" automatically based on "--warnlevel" and "--buildtype"
options. And we use "--warning_level=1" and
"--buildtype=debugoptimized" by default.
We don't specify warning/debug/optimize flags explicitly to build
PostgreSQL with Meson. Because Meson does it automatically as we said.
But Meson doesn't care about flags in Makefile.global and
pg_config. So we need to care about them manually.
This changes do it. They detect warning/debug/optimize flags based on
warning_level/debug/optimization option values because Meson doesn't
tell us flags Meson guessed.
---
meson.build | 41 +++++++++++++++++++++++++++++++++++++++++
src/include/meson.build | 4 ++--
2 files changed, 43 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.buildindex 5acf083ce3c..11bd56f79a7 100644--- a/meson.build+++ b/meson.build@@ -1848,6 +1848,47 @@ endif
vectorize_cflags = cc.get_supported_arguments(['-ftree-vectorize'])
unroll_loops_cflags = cc.get_supported_arguments(['-funroll-loops'])
+# They aren't used for building PostgreSQL itself because Meson does+# everything internally. They are used by extensions via pg_config or+# Makefile.global.+common_builtin_flags = []++warning_level = get_option('warning_level')+# See https://mesonbuild.com/Builtin-options.html#details-for-warning_level for+# warning_level values.+#+# We don't use "/W*" flags here because we don't need to care about MSVC here.+#+# We don't have "warning_level == 3" and "warning_level ==+# 'everything'" here because we don't use these warning levels.+if warning_level == '1'+ common_builtin_flags += ['-Wall']+elif warning_level == '2'+ common_builtin_flags += ['-Wall', '-Wextra']+endif++if get_option('debug')+ common_builtin_flags += ['-g']+endif++optimization = get_option('optimization')+if optimization == '0'+ common_builtin_flags += ['-O0']+elif optimization == '1'+ common_builtin_flags += ['-O1']+elif optimization == '2'+ common_builtin_flags += ['-O2']+elif optimization == '3'+ common_builtin_flags += ['-O3']+elif optimization == 's'+ common_builtin_flags += ['-Os']+endif++cflags_builtin = cc.get_supported_arguments(common_builtin_flags)+if llvm.found()+ cxxflags_builtin = cpp.get_supported_arguments(common_builtin_flags)+endif+
common_warning_flags = [
'-Wmissing-prototypes',
'-Wpointer-arith',
diff --git a/src/include/meson.build b/src/include/meson.buildindex a28f115d867..58b7a9c1e7e 100644--- a/src/include/meson.build+++ b/src/include/meson.build@@ -44,9 +44,9 @@ config_paths_data.set_quoted('MANDIR', dir_prefix / dir_man)
var_cc = ' '.join(cc.cmd_array())
var_cpp = ' '.join(cc.cmd_array() + ['-E'])
-var_cflags = ' '.join(cflags + cflags_warn + get_option('c_args'))+var_cflags = ' '.join(cflags + cflags_builtin + cflags_warn + get_option('c_args'))
if llvm.found()
- var_cxxflags = ' '.join(cxxflags + cxxflags_warn + get_option('cpp_args'))+ var_cxxflags = ' '.join(cxxflags + cxxflags_builtin + cxxflags_warn + get_option('cpp_args'))
else
var_cxxflags = ''
endif
--
2.43.0
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: pgsql-hackers@postgresql.org
Cc: kou@clear-code.com, andres@anarazel.de, peter@eisentraut.org, tristan@neon.tech, michael@paquier.xyz
Subject: Re: meson: Specify -Wformat as a common warning flag for extensions
In-Reply-To: <20240408.100117.1165016889947781960.kou@clear-code.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox