From: Kevin Day Date: Fri, 4 Mar 2022 04:44:19 +0000 (-0600) Subject: Workaround: Clang compiler problems, add _clang_not_a_compile_time_constant_workaroun... X-Git-Tag: 0.5.9~96 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=90bf698e6b183770e80d440c7457cc8446780123;p=fll Workaround: Clang compiler problems, add _clang_not_a_compile_time_constant_workaround_ define. 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. --- diff --git a/level_0/f_print/c/print/common.c b/level_0/f_print/c/print/common.c index e804e35..0c99a11 100644 --- a/level_0/f_print/c/print/common.c +++ b/level_0/f_print/c/print/common.c @@ -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 diff --git a/level_0/f_print/data/build/defines b/level_0/f_print/data/build/defines index c665317..99fe93e 100644 --- a/level_0/f_print/data/build/defines +++ b/level_0/f_print/data/build/defines @@ -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". diff --git a/level_0/f_print/data/build/settings b/level_0/f_print/data/build/settings index 9688209..fbd7eec 100644 --- a/level_0/f_print/data/build/settings +++ b/level_0/f_print/data/build/settings @@ -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