Pass type argument to MONO_LLS_FOREACH and MONO_LLS_FOREACH_SAFE in order to avoid...
authorJonathan Chambers <joncham@gmail.com>
Fri, 31 Aug 2012 02:10:30 +0000 (22:10 -0400)
committerJonathan Chambers <joncham@gmail.com>
Fri, 31 Aug 2012 02:10:30 +0000 (22:10 -0400)
mono/utils/mono-linked-list-set.h
mono/utils/mono-threads.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 \
                } \
index a9160c9a25a68be06b5135c3125c3e808334ded3..f192dd70732e1e6fc42a06395bcad58941879ead 100644 (file)
@@ -142,13 +142,13 @@ typedef struct {
 /*
 Requires the world to be stoped
 */
-#define FOREACH_THREAD(thread) MONO_LLS_FOREACH (mono_thread_info_list_head (), thread)
+#define FOREACH_THREAD(thread) MONO_LLS_FOREACH (mono_thread_info_list_head (), thread, SgenThreadInfo*)
 #define END_FOREACH_THREAD MONO_LLS_END_FOREACH
 
 /*
 Snapshot iteration.
 */
-#define FOREACH_THREAD_SAFE(thread) MONO_LLS_FOREACH_SAFE (mono_thread_info_list_head (), thread)
+#define FOREACH_THREAD_SAFE(thread) MONO_LLS_FOREACH_SAFE (mono_thread_info_list_head (), thread, SgenThreadInfo*)
 #define END_FOREACH_THREAD_SAFE MONO_LLS_END_FOREACH_SAFE
 
 #define mono_thread_info_get_tid(info) ((MonoNativeThreadId)((MonoThreadInfo*)info)->node.key)