]> Kevux Git Server - fll/commitdiff
Bugfix: When specifying a specific section name, do not care if there is no "main...
authorKevin Day <kevin@kevux.org>
Fri, 31 Mar 2023 04:40:58 +0000 (23:40 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 31 Mar 2023 04:52:36 +0000 (23:52 -0500)
When I implemented the feature represented by commit 25671e39d0a275b4a14b1db6612ae46d497c38c7, I apparently forgot to handle this case.

This program correctly errors when there is no "main" section.
When specifically asking to run a named section rather than the default "main", who cares if there is no "main"?
Based on that logic the lack of a "main" section should not be an error.

level_3/fake/c/private-make-load_fakefile.c
level_3/fake/c/private-make-operate.c

index 01ffa0f65e547f697b44cfe36fda15e382188a72..e7037e1bb892a0fe7edb99c1641c23306f75a78e 100644 (file)
@@ -212,24 +212,9 @@ extern "C" {
         return;
       }
 
+      // Set the id out of range to designate that it is missing.
       if (missing_main) {
-        if (data_make->main->error.verbosity != f_console_verbosity_quiet_e) {
-          flockfile(data_make->main->error.to.stream);
-
-          fl_print_format("%r%[%QThe fakefile '%]", data_make->main->error.to.stream, f_string_eol_s, data_make->main->error.context, data_make->main->error.prefix, data_make->main->error.context);
-          fl_print_format("%[%Q%]", data_make->main->error.to.stream, data_make->main->error.notable, data_make->data->file_data_build_fakefile, data_make->main->error.notable);
-          fl_print_format("%[' is missing the required '%]", data_make->main->error.to.stream, data_make->main->error.context, data_make->main->error.context);
-          fl_print_format("%[%r%]", data_make->main->error.to.stream, data_make->main->error.notable, fake_make_section_main_s, data_make->main->error.notable);
-          fl_print_format("%[' object.%]%r", data_make->main->error.to.stream, data_make->main->error.context, data_make->main->error.context, f_string_eol_s);
-
-          funlockfile(data_make->main->error.to.stream);
-        }
-
-        *status = F_status_set_error(F_failure);
-
-        macro_f_fss_set_t_delete_simple(settings);
-
-        return;
+        data_make->id_main = data_make->fakefile.used;
       }
 
       // Always have the parameter variable "return" map at index 0 and be pre-initialized.
index 6feafad85d07352a5a58256c5fc3879d0e858135..dc802926c0b40058fd46cbf63d6dcc96635b10f5 100644 (file)
@@ -221,27 +221,44 @@ extern "C" {
       }
     }
     else {
-      {
-        const int result = fake_make_operate_section(&data_make, data_make.id_main, &section_stack, &status);
+      if (data_make.id_main == data_make.fakefile.used) {
+        if (data->main->error.verbosity != f_console_verbosity_quiet_e) {
+          flockfile(data->main->error.to.stream);
+
+          fl_print_format("%r%[%QThe fakefile '%]", data->main->error.to.stream, f_string_eol_s, data->main->error.context, data->main->error.prefix, data->main->error.context);
+          fl_print_format("%[%Q%]", data->main->error.to.stream, data->main->error.notable, data->file_data_build_fakefile, data->main->error.notable);
+          fl_print_format("%[' is missing the required '%]", data->main->error.to.stream, data->main->error.context, data->main->error.context);
+          fl_print_format("%[%r%]", data->main->error.to.stream, data->main->error.notable, fake_make_section_main_s, data->main->error.notable);
+          fl_print_format("%[' object.%]%r", data->main->error.to.stream, data->main->error.context, data->main->error.context, f_string_eol_s);
 
-        if (status == F_child) {
-          data->main->child = result;
+          funlockfile(data->main->error.to.stream);
         }
+
+        status = F_status_set_error(F_failure);
       }
+      else {
+        {
+          const int result = fake_make_operate_section(&data_make, data_make.id_main, &section_stack, &status);
 
-      if (status != F_child) {
-        const f_status_t status_path = f_path_change_at(data_make.path.top.id);
+          if (status == F_child) {
+            data->main->child = result;
+          }
+        }
 
-        if (F_status_is_error(status_path) && data->main->warning.verbosity >= f_console_verbosity_verbose_e) {
-          flockfile(data->main->warning.to.stream);
+        if (status != F_child) {
+          const f_status_t status_path = f_path_change_at(data_make.path.top.id);
 
-          fl_print_format("%r%[%QFailed change back to original path '%]", data->main->warning.to.stream, f_string_eol_s, data->main->warning.context, data->main->warning.prefix, data->main->warning.context);
-          fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, data_make.path.stack.array[0], data->main->warning.notable);
-          fl_print_format("%[', status code =%] ", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context);
-          fl_print_format("%[%ui%]", data->main->warning.to.stream, data->main->warning.notable, F_status_set_fine(status_path), data->main->warning.notable);
-          fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s);
+          if (F_status_is_error(status_path) && data->main->warning.verbosity >= f_console_verbosity_verbose_e) {
+            flockfile(data->main->warning.to.stream);
 
-          funlockfile(data->main->warning.to.stream);
+            fl_print_format("%r%[%QFailed change back to original path '%]", data->main->warning.to.stream, f_string_eol_s, data->main->warning.context, data->main->warning.prefix, data->main->warning.context);
+            fl_print_format("%[%Q%]", data->main->warning.to.stream, data->main->warning.notable, data_make.path.stack.array[0], data->main->warning.notable);
+            fl_print_format("%[', status code =%] ", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context);
+            fl_print_format("%[%ui%]", data->main->warning.to.stream, data->main->warning.notable, F_status_set_fine(status_path), data->main->warning.notable);
+            fl_print_format("%['.%]%r", data->main->warning.to.stream, data->main->warning.context, data->main->warning.context, f_string_eol_s);
+
+            funlockfile(data->main->warning.to.stream);
+          }
         }
       }
     }