]> Kevux Git Server - fll/commitdiff
Bugfix: Multiple single-valued Objects should used last instead of first Object.
authorKevin Day <kevin@kevux.org>
Wed, 15 Feb 2023 04:15:23 +0000 (22:15 -0600)
committerKevin Day <kevin@kevux.org>
Wed, 15 Feb 2023 04:31:24 +0000 (22:31 -0600)
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
level_3/fake/documents/fakefile.txt

index 26e3372e455deb2229ae92a7c9fff108592d6631..844989e3d37b2677300641b008eb980dc86844d4 100644 (file)
@@ -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) {
index 2a05f0d909f67c4c7d6191d4019675b5039c454c..7d5e43c3b44c88c0d57376814fd72a957df6d251 100644 (file)
@@ -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)\: