Pass type argument to MONO_LLS_FOREACH and MONO_LLS_FOREACH_SAFE in order to avoid...
[mono.git] / mono / utils / mono-linked-list-set.h
index 5009fc8c8c2a06994d71970d3ed3e6dba95e5026..efb14f0352bad91156e076f94676c7ff7d4c9756 100644 (file)
@@ -62,11 +62,11 @@ get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers
 /*
 Requires the world to be stoped
 */
-#define MONO_LLS_FOREACH(list, element) {\
+#define MONO_LLS_FOREACH(list, element, type) {\
        MonoLinkedListSetNode *__cur;   \
        for (__cur = (list)->head; __cur; __cur = mono_lls_pointer_unmask (__cur->next)) \
                if (!mono_lls_pointer_get_mark (__cur->next)) { \
-                       (element) = (typeof((element)))__cur;                   \
+                       (element) = (type)__cur;                        \
 
 #define MONO_LLS_END_FOREACH }}
 
@@ -81,7 +81,7 @@ mono_lls_info_step (MonoLinkedListSetNode *val, MonoThreadHazardPointers *hp)
 /*
 Provides snapshot iteration
 */
-#define MONO_LLS_FOREACH_SAFE(list, element) {\
+#define MONO_LLS_FOREACH_SAFE(list, element, type) {\
        MonoThreadHazardPointers *__hp = mono_hazard_pointer_get ();    \
        MonoLinkedListSetNode *__cur, *__next;  \
        for (__cur = mono_lls_pointer_unmask (get_hazardous_pointer ((gpointer volatile*)&(list)->head, __hp, 1)); \
@@ -89,7 +89,7 @@ Provides snapshot iteration
                __cur = mono_lls_info_step (__next, __hp)) {    \
                __next = get_hazardous_pointer_with_mask ((gpointer volatile*)&__cur->next, __hp, 0);   \
                if (!mono_lls_pointer_get_mark (__next)) {      \
-                       (element) = (typeof((element)))__cur;
+                       (element) = (type)__cur;
 
 #define MONO_LLS_END_FOREACH_SAFE \
                } \