Get rid of the macros in mono-tls.h to fix many warnings.
authorZoltan Varga <vargaz@gmail.com>
Wed, 10 Aug 2011 16:34:47 +0000 (18:34 +0200)
committerZoltan Varga <vargaz@gmail.com>
Wed, 10 Aug 2011 16:34:47 +0000 (18:34 +0200)
mono/metadata/domain.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/mono-wsq.c
mono/metadata/threads.c
mono/mini/debugger-agent.c
mono/mini/mini-amd64.c
mono/mini/mini-llvm.c
mono/mini/mini.c
mono/utils/mono-threads.c
mono/utils/mono-tls.h

index 6dd6dadb78b55cd8b5376adae9780443347eabae..9210a881a5f72dacfb3f659a4839bfa886787a24 100644 (file)
@@ -1241,7 +1241,7 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        mono_gc_base_init ();
 
        MONO_FAST_TLS_INIT (tls_appdomain);
-       mono_native_tls_alloc (appdomain_thread_id, NULL);
+       mono_native_tls_alloc (&appdomain_thread_id, NULL);
 
        InitializeCriticalSection (&appdomains_mutex);
 
index c2263d80dc786f217b76a0be925d727744292bc1..3f0fd5b7b9f92c17a15509597305fd78a9058b4e 100644 (file)
@@ -85,8 +85,8 @@ mono_loader_init ()
                InitializeCriticalSection (&loader_mutex);
                loader_lock_inited = TRUE;
 
-               mono_native_tls_alloc (loader_error_thread_id, NULL);
-               mono_native_tls_alloc (loader_lock_nest_id, NULL);
+               mono_native_tls_alloc (&loader_error_thread_id, NULL);
+               mono_native_tls_alloc (&loader_lock_nest_id, NULL);
 
                mono_counters_register ("Inflated signatures size",
                                                                MONO_COUNTER_GENERICS | MONO_COUNTER_INT, &inflated_signatures_size);
index 5ade3bb294adf8e8e169e00bedef1e13c8538fed..b00cb0d23788c0933149886265023afa26eeb7a5 100644 (file)
@@ -202,8 +202,8 @@ mono_marshal_init (void)
                module_initialized = TRUE;
                InitializeCriticalSection (&marshal_mutex);
                marshal_mutex_initialized = TRUE;
-               mono_native_tls_alloc (last_error_tls_id, NULL);
-               mono_native_tls_alloc (load_type_info_tls_id, NULL);
+               mono_native_tls_alloc (&last_error_tls_id, NULL);
+               mono_native_tls_alloc (&load_type_info_tls_id, NULL);
 
                register_icall (ves_icall_System_Threading_Thread_ResetAbort, "ves_icall_System_Threading_Thread_ResetAbort", "void", TRUE);
                register_icall (mono_marshal_string_to_utf16, "mono_marshal_string_to_utf16", "ptr obj", FALSE);
index 24b777153a91cd730a5fd4551f2180e0e95c6799..1a110ec3a156979530612b23c326796dcc8ad35b 100644 (file)
@@ -35,7 +35,7 @@ mono_wsq_init ()
        if (wsq_tlskey_inited)
                return;
 
-       mono_native_tls_alloc (wsq_tlskey, NULL);
+       mono_native_tls_alloc (&wsq_tlskey, NULL);
        wsq_tlskey_inited = TRUE;
 }
 
index c7c6a78f5cb0a98273e706039e93b2607ccfd47f..cd17b07dc9e6105dbdd9cc59280b122473c64568 100644 (file)
@@ -2432,7 +2432,7 @@ void mono_thread_init (MonoThreadStartCB start_cb,
        mono_init_static_data_info (&context_static_info);
 
        MONO_FAST_TLS_INIT (tls_current_object);
-       mono_native_tls_alloc (current_object_key, NULL);
+       mono_native_tls_alloc (&current_object_key, NULL);
        THREAD_DEBUG (g_message ("%s: Allocated current_object_key %d", __func__, current_object_key));
 
        mono_thread_start_cb = start_cb;
index 433b1061ef26db121a63ff17646e799dd5423725..2901bde1b694c9fb884c6ae626b98f4a6ea0bfc4 100644 (file)
@@ -850,7 +850,7 @@ mono_debugger_agent_init (void)
        mono_profiler_install_jit_end (jit_end);
        mono_profiler_install_method_invoke (start_runtime_invoke, end_runtime_invoke);
 
-       mono_native_tls_alloc (debugger_tls_id, NULL);
+       mono_native_tls_alloc (&debugger_tls_id, NULL);
 
        thread_to_tls = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_KEY_GC);
        MONO_GC_REGISTER_ROOT_FIXED (thread_to_tls);
index 5185922fa96ce1a1544753eada385a5b7d72b3ff..8855898b289ece75d5ed9029e429e13c1445a745 100644 (file)
@@ -1288,10 +1288,10 @@ mono_arch_init (void)
 
        InitializeCriticalSection (&mini_arch_mutex);
 #if defined(__native_client_codegen__)
-       mono_native_tls_alloc (nacl_instruction_depth, NULL);
+       mono_native_tls_alloc (&nacl_instruction_depth, NULL);
        mono_native_tls_set_value (nacl_instruction_depth, (gpointer)0);
-       mono_native_tls_alloc (nacl_rex_tag, NULL);
-       mono_native_tls_alloc (nacl_legacy_prefix_tag, NULL);
+       mono_native_tls_alloc (&nacl_rex_tag, NULL);
+       mono_native_tls_alloc (&nacl_legacy_prefix_tag, NULL);
 #endif
 
 #ifdef MONO_ARCH_NOMAP32BIT
index ac5adf9f15af21ee9859fbb1963e0bf142065473..f72eb8a85b6f553b7293798f41527ac0106ad43a 100644 (file)
@@ -5100,7 +5100,7 @@ add_intrinsics (LLVMModuleRef module)
 void
 mono_llvm_init (void)
 {
-       mono_native_tls_alloc (current_cfg_tls_id, NULL);
+       mono_native_tls_alloc (&current_cfg_tls_id, NULL);
 }
 
 static void
index 74ed84b9b0d112c3a4a0666e9e5782532aa5e041..fee8d27496a615731d899ff116716d98f1b2df36 100644 (file)
@@ -6291,7 +6291,7 @@ mini_init (const char *filename, const char *runtime_version)
        if (!g_thread_supported ())
                g_thread_init (NULL);
 
-       mono_native_tls_alloc (mono_jit_tls_id, NULL);
+       mono_native_tls_alloc (&mono_jit_tls_id, NULL);
        setup_jit_tls_data ((gpointer)-1, mono_thread_abort);
 
        if (default_opt & MONO_OPT_AOT)
index 694d019c22a45b280a8eafbbee03b57cccb6e03b..e68ae12b9e6f53d5c4c26d3a1049876c4b63a957 100644 (file)
@@ -243,13 +243,13 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
        threads_callbacks = *callbacks;
        thread_info_size = info_size;
 #ifdef HOST_WIN32
-       res = mono_native_tls_alloc (thread_info_key, NULL);
+       res = mono_native_tls_alloc (&thread_info_key, NULL);
 #else
-       res = mono_native_tls_alloc (thread_info_key, unregister_thread);
+       res = mono_native_tls_alloc (&thread_info_key, unregister_thread);
 #endif
        g_assert (res);
 
-       res = mono_native_tls_alloc (small_id_key, NULL);
+       res = mono_native_tls_alloc (&small_id_key, NULL);
        g_assert (res);
 
        InitializeCriticalSection (&global_suspend_lock);
index 52ce6f049e790ba6bd1795969f5433792b0686c9..11ece6d584b5ad8ee8223b49b2bdb94cfc0e8cf9 100644 (file)
@@ -16,7 +16,7 @@
 #include <windows.h>
 
 #define MonoNativeTlsKey DWORD
-#define mono_native_tls_alloc(key,destructor) ((key = TlsAlloc ()) != TLS_OUT_OF_INDEXES && destructor == NULL)
+#define mono_native_tls_alloc(key,destructor) ((*(key) = TlsAlloc ()) != TLS_OUT_OF_INDEXES && destructor == NULL)
 #define mono_native_tls_free TlsFree
 #define mono_native_tls_set_value TlsSetValue
 #define mono_native_tls_get_value TlsGetValue
 #include <pthread.h>
 
 #define MonoNativeTlsKey pthread_key_t
-#define mono_native_tls_alloc(key,destructor) (pthread_key_create (&key, destructor) == 0) 
-#define mono_native_tls_free pthread_key_delete
-#define mono_native_tls_set_value(k,v) (!pthread_setspecific ((k), (v)))
 #define mono_native_tls_get_value pthread_getspecific
 
+static inline int
+mono_native_tls_alloc (MonoNativeTlsKey *key, void *destructor)
+{
+       return pthread_key_create (key, destructor) == 0;
+}
+
+static inline void
+mono_native_tls_free (MonoNativeTlsKey key)
+{
+       pthread_key_delete (key);
+}
+
+static inline int
+mono_native_tls_set_value (MonoNativeTlsKey key, gpointer value)
+{
+       return !pthread_setspecific (key, value);
+}
+
 #endif /* HOST_WIN32 */