diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2016-10-21 11:42:26 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2016-10-21 11:42:26 +0300 |
commit | 1a8c7c0e8952ce552be0956b45bcb93cc3dd3637 (patch) | |
tree | b9980d2571e445b7a50ec12472a7730d4ae76ce1 | |
parent | 4c5af8713cdf889fba25c86bc9e1dc2372f2265d (diff) | |
download | bdwgc-1a8c7c0e8952ce552be0956b45bcb93cc3dd3637.tar.gz |
Fix 'ISO C90 forbids mixed declarations and code' compiler warning
* pthread_support.c [GC_PTHREADS && !GC_WIN32_THREADS]
(GC_thread_exit_proc): Move GC_log_printf() call down to be after local
variables declarations.
* thread_local_alloc.c [THREAD_LOCAL_ALLOC && USE_PTHREAD_SPECIFIC
&& !USE_WIN32_SPECIFIC]: Add {} to have "k" local variable declaration
before any statement in a block.
-rw-r--r-- | pthread_support.c | 6 | ||||
-rw-r--r-- | thread_local_alloc.c | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/pthread_support.c b/pthread_support.c index d62d3568..538f0d9a 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1434,13 +1434,13 @@ GC_API int GC_CALL GC_unregister_my_thread(void) /* resources or id anyway. */ GC_INNER_PTHRSTART void GC_thread_exit_proc(void *arg) { + IF_CANCEL(int cancel_state;) + DCL_LOCK_STATE; + # ifdef DEBUG_THREADS GC_log_printf("Called GC_thread_exit_proc on %p, gc_thread = %p\n", (void *)((GC_thread)arg)->id, arg); # endif - IF_CANCEL(int cancel_state;) - DCL_LOCK_STATE; - LOCK(); DISABLE_CANCEL(cancel_state); GC_wait_for_gc_completion(FALSE); diff --git a/thread_local_alloc.c b/thread_local_alloc.c index 26b76990..ae1286db 100644 --- a/thread_local_alloc.c +++ b/thread_local_alloc.c @@ -157,13 +157,16 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_kind(size_t bytes, int knd) } # endif # if !defined(USE_PTHREAD_SPECIFIC) && !defined(USE_WIN32_SPECIFIC) + { GC_key_t k = GC_thread_key; + if (EXPECT(0 == k, FALSE)) { /* We haven't yet run GC_init_parallel. That means */ /* we also aren't locking, so this is fairly cheap. */ return GC_malloc_kind_global(bytes, knd); } tsd = GC_getspecific(k); + } # else tsd = GC_getspecific(GC_thread_key); # endif |