fix(options): latent codegen bug

Problem:
Latent bug from 7f6c14ed54a46e822b80134d39a89f97523a2706 (2015).
If an option default is "false" (`o.defaults.if_false = false`, e.g.
'fileignorecase'), codegen does not give it a `.def_val` on the platform
where its `#if` condition is undefined; it is zero-initialized.

This wasn't noticed until the parent commit, where zero value is
kObjectTypeNil, which `set_option_varp()` rejects.

Solution:
Check `if_false == nil` insteada of "falsey", so the `#else` branch gets
generated.
This commit is contained in:
Justin M. Keyes 2026-07-29 15:05:19 +02:00
parent cb7c019167
commit 1a755e4890

View File

@ -290,7 +290,8 @@ local function dump_option(i, o, write)
elseif o.defaults.condition then
write(('#if defined(%s)'):format(o.defaults.condition))
write(' .def_val=', get_defaults(o.defaults.if_true, o.full_name))
if o.defaults.if_false then
-- Check against nil: `if_false=false` is a valid default and must still emit the `#else`.
if o.defaults.if_false ~= nil then
write('#else')
write(' .def_val=', get_defaults(o.defaults.if_false, o.full_name))
end