]> Kevux Git Server - fll/commitdiff
Workaround: Clang compiler problems, add _clang_not_a_compile_time_constant_workaroun...
authorKevin Day <thekevinday@gmail.com>
Fri, 4 Mar 2022 04:44:19 +0000 (22:44 -0600)
committerKevin Day <thekevinday@gmail.com>
Fri, 4 Mar 2022 04:44:19 +0000 (22:44 -0600)
CLang fails to handle this well and errors out with: "initializer element is not a compile-time constant".

Provide a custom define _clang_not_a_compile_time_constant_workaround_ to be used as a work-around for the problematic CLang compiler.

level_0/f_print/c/print/common.c
level_0/f_print/data/build/defines
level_0/f_print/data/build/settings

index e804e35bf60a7a93fb377970560cc7aaad750a0a..0c99a1143b402f8cb309c68b06f28bc5f73d7e89 100644 (file)
@@ -44,40 +44,77 @@ extern "C" {
 #endif // _di_f_print_sequences_
 
 #ifndef _di_f_print_sequences_set_control_
-  const f_string_static_t f_print_sequence_set_control_s[32] = {
-    f_print_sequence_null_s,
-    f_print_sequence_start_of_header_s,
-    f_print_sequence_start_of_text_s,
-    f_print_sequence_end_of_text_s,
-    f_print_sequence_end_of_transmission_s,
-    f_print_sequence_enquiry_s,
-    f_print_sequence_acknowledge_s,
-    f_print_sequence_bell_s,
-    f_print_sequence_backspace_s,
-    f_print_sequence_tab_s,
-    f_print_sequence_line_feed_s,
-    f_print_sequence_tab_vertical_s,
-    f_print_sequence_form_feed_s,
-    f_print_sequence_carriage_return_s,
-    f_print_sequence_shift_out_s,
-    f_print_sequence_shift_in_s,
-    f_print_sequence_data_link_escape_s,
-    f_print_sequence_device_control_1_s,
-    f_print_sequence_device_control_2_s,
-    f_print_sequence_device_control_3_s,
-    f_print_sequence_device_control_4_s,
-    f_print_sequence_acknowledge_negative_s,
-    f_print_sequence_synchronous_idle_s,
-    f_print_sequence_end_of_transmission_block_s,
-    f_print_sequence_cancel_s,
-    f_print_sequence_end_of_medium_s,
-    f_print_sequence_substitute_s,
-    f_print_sequence_escape_s,
-    f_print_sequence_separator_file_s,
-    f_print_sequence_separator_group_s,
-    f_print_sequence_separator_record_s,
-    f_print_sequence_separator_unit_s,
-  };
+  #ifdef _clang_not_a_compile_time_constant_workaround_
+    const f_string_static_t f_print_sequence_set_control_s[32] = {
+      macro_f_string_static_t_initialize(F_print_sequence_null_s, 0, F_print_sequence_null_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_start_of_header_s, 0, F_print_sequence_start_of_header_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_start_of_text_s, 0, F_print_sequence_start_of_text_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_end_of_text_s, 0, F_print_sequence_end_of_text_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_end_of_transmission_s, 0, F_print_sequence_end_of_transmission_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_enquiry_s, 0, F_print_sequence_enquiry_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_acknowledge_s, 0, F_print_sequence_acknowledge_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_bell_s, 0, F_print_sequence_bell_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_backspace_s, 0, F_print_sequence_backspace_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_tab_s, 0, F_print_sequence_tab_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_line_feed_s, 0, F_print_sequence_line_feed_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_tab_vertical_s, 0, F_print_sequence_tab_vertical_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_form_feed_s, 0, F_print_sequence_form_feed_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_carriage_return_s, 0, F_print_sequence_carriage_return_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_shift_out_s, 0, F_print_sequence_shift_out_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_shift_in_s, 0, F_print_sequence_shift_in_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_data_link_escape_s, 0, F_print_sequence_data_link_escape_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_device_control_1_s, 0, F_print_sequence_device_control_1_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_device_control_2_s, 0, F_print_sequence_device_control_2_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_device_control_3_s, 0, F_print_sequence_device_control_3_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_device_control_4_s, 0, F_print_sequence_device_control_4_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_acknowledge_negative_s, 0, F_print_sequence_acknowledge_negative_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_synchronous_idle_s, 0, F_print_sequence_synchronous_idle_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_end_of_transmission_block_s, 0, F_print_sequence_end_of_transmission_block_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_cancel_s, 0, F_print_sequence_cancel_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_end_of_medium_s, 0, F_print_sequence_end_of_medium_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_substitute_s, 0, F_print_sequence_substitute_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_escape_s, 0, F_print_sequence_escape_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_separator_file_s, 0, F_print_sequence_separator_file_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_separator_group_s, 0, F_print_sequence_separator_group_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_separator_record_s, 0, F_print_sequence_separator_record_s_length),
+      macro_f_string_static_t_initialize(F_print_sequence_separator_unit_s, 0, F_print_sequence_separator_unit_s_length),
+    };
+  #else
+    const f_string_static_t f_print_sequence_set_control_s[32] = {
+      f_print_sequence_null_s,
+      f_print_sequence_start_of_header_s,
+      f_print_sequence_start_of_text_s,
+      f_print_sequence_end_of_text_s,
+      f_print_sequence_end_of_transmission_s,
+      f_print_sequence_enquiry_s,
+      f_print_sequence_acknowledge_s,
+      f_print_sequence_bell_s,
+      f_print_sequence_backspace_s,
+      f_print_sequence_tab_s,
+      f_print_sequence_line_feed_s,
+      f_print_sequence_tab_vertical_s,
+      f_print_sequence_form_feed_s,
+      f_print_sequence_carriage_return_s,
+      f_print_sequence_shift_out_s,
+      f_print_sequence_shift_in_s,
+      f_print_sequence_data_link_escape_s,
+      f_print_sequence_device_control_1_s,
+      f_print_sequence_device_control_2_s,
+      f_print_sequence_device_control_3_s,
+      f_print_sequence_device_control_4_s,
+      f_print_sequence_acknowledge_negative_s,
+      f_print_sequence_synchronous_idle_s,
+      f_print_sequence_end_of_transmission_block_s,
+      f_print_sequence_cancel_s,
+      f_print_sequence_end_of_medium_s,
+      f_print_sequence_substitute_s,
+      f_print_sequence_escape_s,
+      f_print_sequence_separator_file_s,
+      f_print_sequence_separator_group_s,
+      f_print_sequence_separator_record_s,
+      f_print_sequence_separator_unit_s,
+    };
+  #endif // _clang_not_a_compile_time_constant_workaround_
 #endif // _di_f_print_sequences_set_control_
 
 #ifdef __cplusplus
index c6653172ef1e71eb1aff738b1cbad4300feeacd6..99fe93e4549cad19317299a478a863b3594ad455 100644 (file)
@@ -1,2 +1,3 @@
 # fss-0000
 
+_clang_not_a_compile_time_constant_workaround_ Work around CLangs error "initializer element is not a compile-time constant".
index 9688209779eeb7df53cad888183fb109c959b8e4..fbd7eec27b2e28b79810d023d9e758dd2b85a010 100644 (file)
@@ -70,6 +70,7 @@ search_shared yes
 search_static yes
 
 defines
+defines-clang -D_clang_not_a_compile_time_constant_workaround_
 defines_library
 defines_library_shared
 defines_library_static