From 0e6d63a286faf5afdd9e1abe80ebd610af00b133 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 14 Feb 2023 22:15:23 -0600 Subject: [PATCH] Bugfix: Multiple single-valued Objects should used last instead of first Object. Early on I was uncertain on what the proper behavior should be. Over time I established that the last Object specified should be used. This makes sense with most things. Consider normal math: x = 1 x = 2 Is x equal to 1 or 2? I strongly believe the most common interpretation would be "2" because the assignment to "2" comes after the assignment to "1" when reading top-down. Following this logic, the single-valued settings Objects must use the last occurrence rather than the first. This is being considered a bug. --- level_3/fake/c/private-make-load_fakefile.c | 30 ++++++++++++++++++++--------- level_3/fake/documents/fakefile.txt | 2 ++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 26e3372..844989e 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -513,9 +513,9 @@ extern "C" { break; } - data_make->setting_build.environment.array[data_make->setting_build.environment.used].used = 0; + data_make->setting_build.environment.array[j].used = 0; - status = f_string_dynamic_increase_by(name_define.used + 1, &data_make->setting_build.environment.array[data_make->setting_build.environment.used]); + status = f_string_dynamic_increase_by(name_define.used + 1, &data_make->setting_build.environment.array[j]); if (F_status_is_error(status)) { fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_increase_by", F_true); @@ -523,7 +523,7 @@ extern "C" { break; } - status = f_string_dynamic_append_nulless(name_define, &data_make->setting_build.environment.array[data_make->setting_build.environment.used]); + status = f_string_dynamic_append_nulless(name_define, &data_make->setting_build.environment.array[j]); if (F_status_is_error(status)) { fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); @@ -533,14 +533,26 @@ extern "C" { ++data_make->setting_build.environment.used; } - else if (data_make->main->warning.verbosity >= f_console_verbosity_verbose_e) { - flockfile(data_make->main->warning.to.stream); + else if (j < data_make->setting_build.environment.used) { + if (data_make->main->warning.verbosity >= f_console_verbosity_verbose_e) { + flockfile(data_make->main->warning.to.stream); - fl_print_format("%r%[%QThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); - fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, name_define, data_make->main->warning.notable); - fl_print_format("%[' is already added.%]%r", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); + fl_print_format("%r%[%QThe environment name '%]", data_make->main->warning.to.stream, f_string_eol_s, data_make->main->warning.context, data_make->main->warning.prefix, data_make->main->warning.context); + fl_print_format("%[%Q%]", data_make->main->warning.to.stream, data_make->main->warning.notable, name_define, data_make->main->warning.notable); + fl_print_format("%[' is already added, replacing previous value.%]%r", data_make->main->warning.to.stream, data_make->main->warning.context, data_make->main->warning.context, f_string_eol_s); - funlockfile(data_make->main->warning.to.stream); + funlockfile(data_make->main->warning.to.stream); + } + + data_make->setting_build.environment.array[j].used = 0; + + status = f_string_dynamic_append_nulless(name_define, &data_make->setting_build.environment.array[j]); + + if (F_status_is_error(status)) { + fll_error_print(data_make->main->error, F_status_set_fine(status), "f_string_dynamic_append_nulless", F_true); + + break; + } } } else if (data_make->main->warning.verbosity >= f_console_verbosity_verbose_e) { diff --git a/level_3/fake/documents/fakefile.txt b/level_3/fake/documents/fakefile.txt index 2a05f0d..7d5e43c 100644 --- a/level_3/fake/documents/fakefile.txt +++ b/level_3/fake/documents/fakefile.txt @@ -20,6 +20,8 @@ Fakefile Documentation: Any configuration specific to this file:"fakefile" is stored here. This includes the declaration of define and parameter IKI variable substitution values. + If multiple bold:"Objects" of the same name exist and that bold:"Object" only supports a single value, then only the bold:"Content" from the last same named bold:"Object" is used. + The build settings may also be specified in the bold:"Settings Section". The following settings are available (in addition to the build settings)\: -- 1.8.3.1