forked from enlightenment/efl
eina: seems like all the compiler we support do support __typeof__.
This commit is contained in:
parent
2692234b60
commit
fa57dd8b2a
|
@ -685,17 +685,10 @@ EAPI Eina_Accessor *eina_inarray_accessor_new(const Eina_Inarray *array) EINA_MA
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define EINA_INARRAY_FOREACH(array, itr) \
|
||||
for ((itr) = (array)->members; \
|
||||
(itr) < (((__typeof__(*itr)*)(array)->members) + (array)->len); \
|
||||
(itr)++)
|
||||
#else
|
||||
# define EINA_INARRAY_FOREACH(array, itr) \
|
||||
for ((itr) = (array)->members; \
|
||||
(itr) < (((typeof(*itr)*)(array)->members) + (array)->len); \
|
||||
(itr)++)
|
||||
#endif
|
||||
#define EINA_INARRAY_FOREACH(array, itr) \
|
||||
for ((itr) = (array)->members; \
|
||||
(itr) < (((__typeof__(*itr)*)(array)->members) + (array)->len); \
|
||||
(itr)++)
|
||||
|
||||
/**
|
||||
* @def EINA_INARRAY_REVERSE_FOREACH
|
||||
|
@ -713,19 +706,11 @@ EAPI Eina_Accessor *eina_inarray_accessor_new(const Eina_Inarray *array) EINA_MA
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define EINA_INARRAY_REVERSE_FOREACH(array, itr) \
|
||||
for ((itr) = ((((__typeof__(*(itr))*)(array)->members) + (array)->len) - 1); \
|
||||
(((itr) >= (__typeof__(*(itr))*)(array)->members) \
|
||||
&& ((array)->members != NULL)); \
|
||||
(itr)--)
|
||||
#else
|
||||
# define EINA_INARRAY_REVERSE_FOREACH(array, itr) \
|
||||
for ((itr) = ((((typeof(*(itr))*)(array)->members) + (array)->len) - 1); \
|
||||
(((itr) >= (typeof(*(itr))*)(array)->members) \
|
||||
&& ((array)->members != NULL)); \
|
||||
(itr)--)
|
||||
#endif
|
||||
#define EINA_INARRAY_REVERSE_FOREACH(array, itr) \
|
||||
for ((itr) = ((((__typeof__(*(itr))*)(array)->members) + (array)->len) - 1); \
|
||||
(((itr) >= (__typeof__(*(itr))*)(array)->members) \
|
||||
&& ((array)->members != NULL)); \
|
||||
(itr)--)
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -818,13 +818,8 @@ EAPI Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func);
|
|||
* In C++ we can't assign a "type*" pointer to void* so we rely on GCC's typeof
|
||||
* operator.
|
||||
*/
|
||||
# ifdef __GNUC__
|
||||
# define _EINA_INLIST_CONTAINER(ref, ptr) (__typeof__(ref))((char *)(ptr) - \
|
||||
_EINA_INLIST_OFFSET(ref))
|
||||
# else
|
||||
# define _EINA_INLIST_CONTAINER(ref, ptr) (typeof(ref))((char *)(ptr) - \
|
||||
_EINA_INLIST_OFFSET(ref))
|
||||
# endif
|
||||
# define _EINA_INLIST_CONTAINER(ref, ptr) (__typeof__(ref))((char *)(ptr) - \
|
||||
_EINA_INLIST_OFFSET(ref))
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -873,14 +868,8 @@ EAPI Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func);
|
|||
* don't remove all items from the list.
|
||||
* @since 1.8
|
||||
*/
|
||||
#ifdef __GNUC__
|
||||
# define EINA_INLIST_FREE(list, it) \
|
||||
for (it = (__typeof__(it)) list; list; it = (__typeof__(it)) list)
|
||||
#else
|
||||
# define EINA_INLIST_FREE(list, it) \
|
||||
for (it = (typeof(it)) list; list; it = (typeof(it)) list)
|
||||
#endif
|
||||
|
||||
#define EINA_INLIST_FREE(list, it) \
|
||||
for (it = (__typeof__(it)) list; list; it = (__typeof__(it)) list)
|
||||
|
||||
#include "eina_inline_inlist.x"
|
||||
|
||||
|
|
Loading…
Reference in New Issue