Skip to content

Commit f7c821f

Browse files
committed
options: Always print a warning if the 'verbose' option value is bogus
1 parent 5d92b5f commit f7c821f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/options.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,15 @@ static void mi_option_init(mi_option_desc_t* desc) {
536536
* so to avoid a possible infinite recursion it's important to mark the option as
537537
* "initialized" first */
538538
desc->init = DEFAULTED;
539+
if (desc->option == mi_option_verbose) {
540+
/* Special case: if the 'mimalloc_verbose' env var has a bogus value we'd never know
541+
* (since the value default to 'off') - so in that one case briefly set the option to 'on' */
542+
desc->value = 1;
543+
}
539544
_mi_warning_message("environment option mimalloc_%s has an invalid value: %s\n", desc->name, buf);
545+
if (desc->option == mi_option_verbose) {
546+
desc->value = 0;
547+
}
540548
}
541549
}
542550
mi_assert_internal(desc->init != UNINIT);

0 commit comments

Comments
 (0)