]> Kevux Git Server - fll/commitdiff
Workaround: Clang compiler problems, add _clang_not_a_compile_time_constant_workaroun...
authorKevin Day <kevin@kevux.org>
Thu, 27 Jul 2023 04:03:42 +0000 (23:03 -0500)
committerKevin Day <kevin@kevux.org>
Thu, 27 Jul 2023 04:03:42 +0000 (23:03 -0500)
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_3/byte_dump/c/main/common/string.c
level_3/byte_dump/data/build/defines
level_3/byte_dump/data/build/settings

index 2542d9cb69d7f550c1609408936872c558047d2f..3df6dd28138bb60d67efe51d6fd4828a02afcbe3 100644 (file)
@@ -36,14 +36,25 @@ extern "C" {
   const f_string_static_t byte_dump_padding_8_s = macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_8_s, 0, BYTE_DUMP_padding_8_s_length);
   const f_string_static_t byte_dump_padding_9_s = macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_9_s, 0, BYTE_DUMP_padding_9_s_length);
 
-  const f_string_static_t byte_dump_padding_s[] = {
-    byte_dump_padding_9_s,
-    byte_dump_padding_3_s,
-    byte_dump_padding_4_s,
-    byte_dump_padding_4_s,
-    byte_dump_padding_9_s,
-    byte_dump_padding_4_s,
-  };
+  #ifdef _clang_not_a_compile_time_constant_workaround_
+    const f_string_static_t byte_dump_padding_s[6] = {
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_9_s, 0, BYTE_DUMP_padding_9_s_length),
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_3_s, 0, BYTE_DUMP_padding_3_s_length),
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_4_s, 0, BYTE_DUMP_padding_4_s_length),
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_4_s, 0, BYTE_DUMP_padding_4_s_length),
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_9_s, 0, BYTE_DUMP_padding_9_s_length),
+      macro_f_string_static_t_initialize_1(BYTE_DUMP_padding_4_s, 0, BYTE_DUMP_padding_4_s_length),
+    };
+  #else
+    const f_string_static_t byte_dump_padding_s[] = {
+      byte_dump_padding_9_s,
+      byte_dump_padding_3_s,
+      byte_dump_padding_4_s,
+      byte_dump_padding_4_s,
+      byte_dump_padding_9_s,
+      byte_dump_padding_4_s,
+    };
+  #endif
 #endif // _di_byte_dump_padding_s_
 
 #ifndef _di_byte_dump_parameter_d_
index 490da41d8e72323bf3a9086dfbed1d8d565cd20f..d987e362273df7f468e153b8efcead0dcc069987 100644 (file)
@@ -4,3 +4,5 @@ _di_thread_support_ Disables thread support.
 
 _pthread_attr_unsupported_ Disable non-portable functionality associated with pthread_attr.
 _pthread_sigqueue_unsupported_ Disable GNU specific sigqueue().
+
+_clang_not_a_compile_time_constant_workaround_ Work around CLangs error "initializer element is not a compile-time constant".
index d00a32115027dcb0e094165af52b1389607d0773..ca7f6fd101f9226bc1d3244c2a3dd1d729c05094 100644 (file)
@@ -72,6 +72,7 @@ environment LANG LC_ALL LC_COLLATE LC_CTYPE LC_FASTMSG LC_MESSAGES LC_MONETARY L
 defines -D_libcap_legacy_only_
 defines-threadless -D_di_thread_support_
 defines-thread -D_pthread_attr_unsupported_ -D_pthread_sigqueue_unsupported_
+defines-clang -D_clang_not_a_compile_time_constant_workaround_
 
 flags -O2 -z now -g -fdiagnostics-color=always -Wno-logical-not-parentheses -Wno-parentheses -Wno-missing-braces
 flags-thread -pthread