From e55bc4049defbdf87502baa4e0cdc5bdaebce14e Mon Sep 17 00:00:00 2001 From: Jay Krell Date: Wed, 25 Jul 2018 22:38:43 -0700 Subject: [PATCH] [cxx] Keywords: new => new_, typename => type_nam, namespace => name_space, conditionally class => super_class. --- mono/metadata/icall.c | 4 ++-- mono/metadata/sgen-client-mono.h | 8 +++---- mono/metadata/threadpool-worker-default.c | 28 +++++++++++------------ mono/metadata/w32handle.c | 22 +++++++++--------- mono/metadata/w32handle.h | 2 +- mono/utils/mono-threads-mach-helper.c | 4 ++++ 6 files changed, 36 insertions(+), 32 deletions(-) diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index 4a1b05d32e4f..bfc99b073cf6 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -4577,11 +4577,11 @@ ves_icall_System_Reflection_Assembly_InternalGetType (MonoReflectionAssemblyHand if (!type) { if (throwOnError) { ERROR_DECL_VALUE (inner_error); - char *typename = mono_string_handle_to_utf8 (name, &inner_error); + char *type_name = mono_string_handle_to_utf8 (name, &inner_error); mono_error_assert_ok (&inner_error); MonoAssembly *assembly = MONO_HANDLE_GETVAL (assembly_h, assembly); char *assmname = mono_stringify_assembly_name (&assembly->aname); - mono_error_set_type_load_name (error, typename, assmname, "%s", ""); + mono_error_set_type_load_name (error, type_name, assmname, "%s", ""); goto fail; } diff --git a/mono/metadata/sgen-client-mono.h b/mono/metadata/sgen-client-mono.h index e20022579977..4dcbb896c345 100644 --- a/mono/metadata/sgen-client-mono.h +++ b/mono/metadata/sgen-client-mono.h @@ -379,18 +379,18 @@ static void mono_binary_protocol_alloc_generic (gpointer obj, gpointer vtable, size_t size, gboolean pinned) { #ifdef ENABLE_DTRACE - const char *namespace = sgen_client_vtable_get_namespace (vtable); + const char *name_space = sgen_client_vtable_get_namespace (vtable); const char *name = sgen_client_vtable_get_name (vtable); if (sgen_ptr_in_nursery (obj)) { if (G_UNLIKELY (MONO_GC_NURSERY_OBJ_ALLOC_ENABLED ())) - MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, namespace, name); + MONO_GC_NURSERY_OBJ_ALLOC ((mword)obj, size, name_space, name); } else { if (size > SGEN_MAX_SMALL_OBJ_SIZE) { if (G_UNLIKELY (MONO_GC_MAJOR_OBJ_ALLOC_LARGE_ENABLED ())) - MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, namespace, name); + MONO_GC_MAJOR_OBJ_ALLOC_LARGE ((mword)obj, size, name_space, name); } else if (pinned) { - MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, namespace, name); + MONO_GC_MAJOR_OBJ_ALLOC_PINNED ((mword)obj, size, name_space, name); } } #endif diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 87d1873484af..81e54bfc48a6 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -307,20 +307,20 @@ mono_threadpool_worker_cleanup (void) static void work_item_push (void) { - gint32 old, new; + gint32 old, new_; do { old = mono_atomic_load_i32 (&worker.work_items_count); g_assert (old >= 0); - new = old + 1; - } while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old); + new_ = old + 1; + } while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old); } static gboolean work_item_try_pop (void) { - gint32 old, new; + gint32 old, new_; do { old = mono_atomic_load_i32 (&worker.work_items_count); @@ -329,8 +329,8 @@ work_item_try_pop (void) if (old == 0) return FALSE; - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.work_items_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.work_items_count, new_, old) != old); return TRUE; } @@ -362,7 +362,7 @@ worker_park (void) { gboolean timeout = FALSE; gboolean interrupted = FALSE; - gint32 old, new; + gint32 old, new_; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); @@ -385,8 +385,8 @@ worker_park (void) old = mono_atomic_load_i32 (&worker.parked_threads_count); g_assert (old >= G_MININT32); - new = old + 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old + 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); switch (mono_coop_sem_timedwait (&worker.parked_threads_sem, rand_next (&rand_handle, 5 * 1000, 60 * 1000), MONO_SEM_FLAGS_ALERTABLE)) { case MONO_SEM_TIMEDWAIT_RET_SUCCESS: @@ -407,8 +407,8 @@ worker_park (void) old = mono_atomic_load_i32 (&worker.parked_threads_count); g_assert (old > G_MININT32); - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); } COUNTER_ATOMIC (counter, { @@ -427,7 +427,7 @@ static gboolean worker_try_unpark (void) { gboolean res = TRUE; - gint32 old, new; + gint32 old, new_; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ()))); @@ -441,8 +441,8 @@ worker_try_unpark (void) break; } - new = old - 1; - } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + new_ = old - 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new_, old) != old); if (res) mono_coop_sem_post (&worker.parked_threads_sem); diff --git a/mono/metadata/w32handle.c b/mono/metadata/w32handle.c index dbb9051e6e34..a2e7d5141576 100644 --- a/mono/metadata/w32handle.c +++ b/mono/metadata/w32handle.c @@ -399,18 +399,18 @@ mono_w32handle_foreach (gboolean (*on_each)(MonoW32Handle *handle_data, gpointer static gboolean mono_w32handle_ref_core (MonoW32Handle *handle_data) { - guint old, new; + guint old, new_; do { old = handle_data->ref; if (old == 0) return FALSE; - new = old + 1; - } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old); + new_ = old + 1; + } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: ref %s handle %p, ref: %d -> %d", - __func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new); + __func__, mono_w32handle_ops_typename (handle_data->type), handle_data, old, new_); return TRUE; } @@ -419,7 +419,7 @@ static gboolean mono_w32handle_unref_core (MonoW32Handle *handle_data) { MonoW32Type type; - guint old, new; + guint old, new_; type = handle_data->type; @@ -428,16 +428,16 @@ mono_w32handle_unref_core (MonoW32Handle *handle_data) if (!(old >= 1)) g_error ("%s: handle %p has ref %d, it should be >= 1", __func__, handle_data, old); - new = old - 1; - } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new, (gint32)old) != (gint32)old); + new_ = old - 1; + } while (mono_atomic_cas_i32 ((gint32*) &handle_data->ref, (gint32)new_, (gint32)old) != (gint32)old); /* handle_data might contain invalid data from now on, if * another thread is unref'ing this handle at the same time */ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: unref %s handle %p, ref: %d -> %d destroy: %s", - __func__, mono_w32handle_ops_typename (type), handle_data, old, new, new == 0 ? "true" : "false"); + __func__, mono_w32handle_ops_typename (type), handle_data, old, new_, new_ == 0 ? "true" : "false"); - return new == 0; + return new_ == 0; } static void @@ -529,8 +529,8 @@ static const gchar* mono_w32handle_ops_typename (MonoW32Type type) { g_assert (handle_ops [type]); - g_assert (handle_ops [type]->typename); - return handle_ops [type]->typename (); + g_assert (handle_ops [type]->type_name); + return handle_ops [type]->type_name (); } static gsize diff --git a/mono/metadata/w32handle.h b/mono/metadata/w32handle.h index 53d70231f48f..8b5d7541df59 100644 --- a/mono/metadata/w32handle.h +++ b/mono/metadata/w32handle.h @@ -92,7 +92,7 @@ typedef struct void (*details)(MonoW32Handle *handle_data); /* Called to get the name of the handle type */ - const gchar* (*typename) (void); + const char* (*type_name) (void); /* Called to get the size of the handle type */ gsize (*typesize) (void); diff --git a/mono/utils/mono-threads-mach-helper.c b/mono/utils/mono-threads-mach-helper.c index db1e5b9fce9f..4e465597b528 100644 --- a/mono/utils/mono-threads-mach-helper.c +++ b/mono/utils/mono-threads-mach-helper.c @@ -57,7 +57,11 @@ mono_dead_letter_dealloc (id self, SEL _cmd) { struct objc_super super; super.receiver = self; +#if !defined(__cplusplus) && !__OBJC2__ super.class = nsobject; +#else + super.super_class = nsobject; +#endif objc_msgSendSuper (&super, dealloc); mono_thread_info_detach ();