From: Patrick Steinhardt Date: Wed, 19 Mar 2025 13:36:02 GMT Subject: Re: [PATCH 03/12] meson.build: only set build variables for non-default values Message-ID: In-Reply-To: <5d0112ae-98b5-46f2-91ad-35ed11358c3e@ramsayjones.plus.com> On Sat, Mar 15, 2025 at 02:46:59AM +0000, Ramsay Jones wrote: > > Some preprocessor -Defines have defaults sets in the source code when > they have not been provided to the C compiler. In this case, there is > no need to pass them on the command-line, unless the build requires a > non-standard value. > > The build variables for DEFAULT_EDITOR, DEFAULT_HELP_FORMAT along with > DEFAULT_PAGER have appropriate defaults ('vi', 'man' and 'less') set in > the code. Add the preprocessor -Defines to the 'libgit_c_args' only if > the values set with the corresponding 'options' are different to these > standard values. Hm. Does this really change anything though? The behaviour before and after this patch are exactly the same as far as I understand, and by explicitly handling the defaults we basically have to hard-code more assumptions. So in the current form I don't see that this patch adds much. What we _could_ be doing is to completely drop the default values in "meson_options.txt". In that case we could instead compare whether we saw the empty string, which allows us to stop encoding the default vaule both in "meson_options.txt" and in "editor.c". Patrick