From 0e09681a6a2aea29071b207f18b368e442fbaf8f Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 30 Oct 2024 23:42:45 +0100 Subject: [PATCH] Move m_typeof to core module. --- m-core.h | 12 +++++++++++- m-generic.h | 11 ----------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/m-core.h b/m-core.h index 058a0705..635fd64c 100644 --- a/m-core.h +++ b/m-core.h @@ -142,7 +142,6 @@ # define M_ATTR_COLD_FUNCTION #endif - /* Prefetch . */ #if defined(__GNUC__) # define M_PREFETCH(p) __builtin_prefetch((p), 0, 0) @@ -153,6 +152,17 @@ } while (0) #endif +/* Definition of the typeof keyword + In C23, we can use the standard keyword. + Otherwise we use some extensions of the compilers. */ +#ifdef _MSC_VER +#define m_typeof(x) decltype(x) +#elif defined(__GNUC__) +#define m_typeof(x) __typeof__(x) +#else +#define m_typeof(x) typeof(x) +#endif + /* Ignore some warnings detected by some compilers in the library. * Whatever we do, there is some warnings that cannot be fixed. * So they are ignored in order to avoid polluting the user with diff --git a/m-generic.h b/m-generic.h index f7241ea1..5ac7190e 100644 --- a/m-generic.h +++ b/m-generic.h @@ -101,17 +101,6 @@ /********************************** INTERNAL *********************************/ /*****************************************************************************/ -/* Definition of the typeof keyword - In C23, we can use the standard keyword. - Otherwise we use some extensions of the compilers. */ -#ifdef _MSC_VER -#define m_typeof(x) decltype(x) -#elif defined(__GNUC__) -#define m_typeof(x) __typeof__(x) -#else -#define m_typeof(x) typeof(x) -#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, \