From: Patrick Steinhardt <ps@pks.im>
To: Eli Schwartz <eschwartz@gentoo.org>
Cc: git@vger.kernel.org, Ramsay Jones <ramsay@ramsayjones.plus.com>
Subject: Re: [PATCH] meson: reformat default options to workaround bug in `meson configure`
Date: Mon, 19 May 2025 21:19:08 +0200 [thread overview]
Message-ID: <aCuELL0SLUkszicn@pks.im> (raw)
In-Reply-To: <20250519170945.57746-1-eschwartz@gentoo.org>
On Mon, May 19, 2025 at 01:09:42PM -0400, Eli Schwartz wrote:
> Since 13cb20fc46 ("meson: fix compilation with Visual Studio",
> 2025-01-22) it has not been possible to list build options via `meson
> configure`.
Nit: it _is_ possible to do this in the build directory. What doesn't
work is to do this in the source directory.
> This is due to Meson's static analysis of build options
> failing to handle constant folding, and thinking we set a totally
> invalid default `-std=`.
Interesting.
> This is reported upstream but we anyways need to work with existing
> versions. It turns out there is a simple solution: turn the entire
> default option into a conditional branch, which means Meson sees either
> nothing, or everything.
>
> As a result, Git users can once again see pretty-printed options before
> building.
Nice.
> Reported-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> Bug: https://github.com/mesonbuild/meson/issues/14623
> Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
> ---
> meson.build | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index a1476e5b32..43fc3afdf5 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -215,14 +215,12 @@ project('git', 'c',
> capture: true,
> check: true,
> ).stdout().strip() : 'unknown',
> - default_options: [
> - # Git requires C99 with GNU extensions, which of course isn't supported by
> - # MSVC. Funny enough, C99 doesn't work with MSVC either, as it has only
> - # learned to define __STDC_VERSION__ with C11 and later. We thus require
> - # GNU C99 and fall back to C11. Meson only learned to handle the fallback
> - # with version 1.3.0, so on older versions we use GNU C99 unconditionally.
> - 'c_std=' + (meson.version().version_compare('>=1.3.0') ? 'gnu99,c11' : 'gnu99'),
> - ],
> + # Git requires C99 with GNU extensions, which of course isn't supported by
> + # MSVC. Funny enough, C99 doesn't work with MSVC either, as it has only
> + # learned to define __STDC_VERSION__ with C11 and later. We thus require
> + # GNU C99 and fall back to C11. Meson only learned to handle the fallback
> + # with version 1.3.0, so on older versions we use GNU C99 unconditionally.
> + default_options: meson.version().version_compare('>=1.3.0') ? ['c_std=gnu99,c11'] : ['c_std=gnu99'],
> )
Makes sense. It doesn't really make much of a difference for us in which
of the two ways we format this, so let's just stick with what works. We
could of course link to the upstream bug here in the comment, but on the
other hand I don't expect that we'll have to touch these anytime soon
anyway.
So this patch looks good to me, thanks!
Patrick
prev parent reply other threads:[~2025-05-19 19:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-19 17:09 [PATCH] meson: reformat default options to workaround bug in `meson configure` Eli Schwartz
2025-05-19 19:19 ` Patrick Steinhardt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aCuELL0SLUkszicn@pks.im \
--to=ps@pks.im \
--cc=eschwartz@gentoo.org \
--cc=git@vger.kernel.org \
--cc=ramsay@ramsayjones.plus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).