]> 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:55:36 +0000 (23:55 -0500)
committerKevin Day <kevin@kevux.org>
Fri, 31 Mar 2023 04:55:36 +0000 (23:55 -0500)
When I implemented the feature represented by commit 6c05c66f50719c9edaa36dea75669e03cd558ee4, 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/main/make/load_fakefile.c
level_3/fake/c/main/make/operate.c

index 6c24be117ae19020df2fe19128a65ed9d7cf433f..d5fb93a122853200425ad7188f6de3fa8765af39 100644 (file)
@@ -197,14 +197,9 @@ extern "C" {
         return;
       }
 
+      // Set the id out of range to designate that it is missing.
       if (missing_main) {
-        fake_make_print_error_fakefile_section_missing(&data_make->main->program.warning, data_make->data->file_data_build_fakefile, fake_make_item_main_s);
-
-        data_make->main->setting.state.status = F_status_set_error(F_failure);
-
-        f_fss_set_resize(0, &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 09f92c114956eec8a618cbdf16cfa7b888576fa7..d89830e48a2adae8a33ac576ec739918e2da3320 100644 (file)
@@ -183,24 +183,31 @@ extern "C" {
       }
     }
     else {
-      {
-        const int result = fake_make_operate_section(&data_make, data_make.id_main, &section_stack);
+      if (data_make.id_main == data_make.fakefile.used) {
+        fake_make_print_error_fakefile_section_missing(&data->main->program.error, data->file_data_build_fakefile, fake_make_item_main_s);
 
-        if (data->main->setting.state.status == F_child) {
-          data->main->program.child = result;
-        }
+        data->main->setting.state.status = F_status_set_error(F_failure);
       }
+      else {
+        {
+          const int result = fake_make_operate_section(&data_make, data_make.id_main, &section_stack);
+
+          if (data->main->setting.state.status == F_child) {
+            data->main->program.child = result;
+          }
+        }
 
-      if (data->main->setting.state.status != F_child) {
-        const f_status_t status = data->main->setting.state.status;
+        if (data->main->setting.state.status != F_child) {
+          const f_status_t status = data->main->setting.state.status;
 
-        data->main->setting.state.status = f_path_change_at(data_make.path.top.id);
+          data->main->setting.state.status = f_path_change_at(data_make.path.top.id);
 
-        if (F_status_is_error(data->main->setting.state.status)) {
-          fake_make_print_warning_cannot_change_back(&data->main->program.warning, data_make.path.stack.array[0]);
-        }
+          if (F_status_is_error(data->main->setting.state.status)) {
+            fake_make_print_warning_cannot_change_back(&data->main->program.warning, data_make.path.stack.array[0]);
+          }
 
-        data->main->setting.state.status = status;
+          data->main->setting.state.status = status;
+        }
       }
     }