Fix clang warning

This commit is contained in:
Patrick Pelissier committed 2024-05-15 21:19:43 +02:00
1 parent 1ae904dff2
commit 66d2aa26d3
3 files changed
+21 -19

No files matched your search

+18
View File
@@ -241,6 +241,24 @@
#endif
/* Warnings disabled for CLANG in C mode:
Due to the genericity of the _Generic generation,
we cannot avoid generating both T and const T in the generic association. */
#if defined(__clang__) && __clang_major__ >= 15
#define M_G3N_BEGIN_PROTECTED_CODE \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunreachable-code-generic-assoc\"")
#define M_G3N_END_PROTECTED_CODE \
_Pragma("clang diagnostic pop")
#else
#define M_G3N_BEGIN_PROTECTED_CODE
#define M_G3N_END_PROTECTED_CODE
#endif
/* Autodetect if Address sanitizer is run */
#if defined(__has_feature)
-18
View File
@@ -112,24 +112,6 @@
#define m_typeof(x) typeof(x)
#endif
/* Warnings disabled for CLANG in C mode:
Due to the genericity of the _Generic generation,
we cannot avoid generating both T and const T in the generic association. */
#if defined(__clang__) && __clang_major__ >= 15
#define M_G3N_BEGIN_PROTECTED_CODE \
_Pragma("clang diagnostic push") \
_Pragma("clang diagnostic ignored \"-Wunreachable-code-generic-assoc\"")
#define M_G3N_END_PROTECTED_CODE \
_Pragma("clang diagnostic pop")
#else
#define M_G3N_BEGIN_PROTECTED_CODE
#define M_G3N_END_PROTECTED_CODE
#endif
// Instead of using expensive M_SEQ(1,50), precompute it:
#define M_G3N_SEQ_INT \
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, \
+3 -1
View File
@@ -826,9 +826,11 @@ M_INLINE void \
#define M_VAR1ANT_INIT_WITH(oplist, dest, src) \
M_VAR1ANT_INIT_WITH_B(M_GET_NAME oplist, M_GET_SIZE oplist, dest, src)
#define M_VAR1ANT_INIT_WITH_B(name, num, dest, src) \
M_G3N_BEGIN_PROTECTED_CODE \
_Generic( (src), \
M_MAP2(M_VAR1ANT_INIT_WITH_FUNC, (name,dest,src), M_SEQ(1, num)) \
struct m_var1ant_dummy_s *: abort() )
struct m_var1ant_dummy_s *: /* cannot happen */ (void)0 ) \
M_G3N_END_PROTECTED_CODE
#define M_VAR1ANT_INIT_WITH_FUNC(triplet, num) \
M_VAR1ANT_INIT_WITH_FUNC_EXPAND(M_TRIPLE_1 triplet, M_TRIPLE_2 triplet, M_TRIPLE_3 triplet, num)
#define M_VAR1ANT_INIT_WITH_FUNC_EXPAND(name, dest, src, num) \