diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-02-28 21:39:04 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-02-28 21:39:04 +0300 |
commit | dafe71bca00384b4647700635f8321885b3cf100 (patch) | |
tree | 598338f3e248e5fe11ea4e694da2359b790504e7 /include/private/gc_locks.h | |
parent | c6ea1f66fe335c303f9ce73319d24247bc504304 (diff) | |
download | bdwgc-dafe71bca00384b4647700635f8321885b3cf100.tar.gz |
Replace conditional extern 'C' blocks begin/end with EXTERN_C_BEGIN/END
(code refactoring)
Issue #206 (bdwgc).
Note: EXTERN_C_BEGIN and EXTERN_C_END are not available in the GC
public headers.
* include/private/darwin_stop_world.h: Replace the conditional
extern "C" block begin/end with EXTERN_C_BEGIN and EXTERN_C_END,
respectively.
* include/private/dbg_mlc.h: Likewise.
* include/private/gc_hdrs.h: Likewise.
* include/private/gc_locks.h: Likewise.
* include/private/gc_pmark.h: Likewise.
* include/private/gc_priv.h: Likewise.
* include/private/gcconfig.h: Likewise.
* include/private/pthread_stop_world.h: Likewise.
* include/private/pthread_support.h: Likewise.
* include/private/specific.h: Likewise.
* include/private/thread_local_alloc.h: Likewise.
* os_dep.c [MPROTECT_VDB && DARWIN]: Likewise.
* tests/test.c [GC_AMIGA_FASTALLOC && AMIGA]: Likewise.
* include/private/gcconfig.h (EXTERN_C_BEGIN, EXTERN_C_END): Define
macro.
Diffstat (limited to 'include/private/gc_locks.h')
-rw-r--r-- | include/private/gc_locks.h | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index fad4ad2d..15da91bb 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -33,9 +33,7 @@ # include <th/PCR_Th.h> # endif -# ifdef __cplusplus - extern "C" { -# endif + EXTERN_C_BEGIN # ifdef PCR GC_EXTERN PCR_Th_ML GC_allocate_ml; @@ -57,17 +55,13 @@ # endif # if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS) -# ifdef __cplusplus - } /* extern "C" */ -# endif # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif # define NOSERVICE + EXTERN_C_END # include <windows.h> -# ifdef __cplusplus - extern "C" { -# endif + EXTERN_C_BEGIN # define NO_THREAD (DWORD)(-1) GC_EXTERN CRITICAL_SECTION GC_allocate_ml; # ifdef GC_ASSERTIONS @@ -94,13 +88,9 @@ # define UNCOND_UNLOCK() LeaveCriticalSection(&GC_allocate_ml) # endif /* !GC_ASSERTIONS */ # elif defined(GC_PTHREADS) -# ifdef __cplusplus - } /* extern "C" */ -# endif + EXTERN_C_END # include <pthread.h> -# ifdef __cplusplus - extern "C" { -# endif + EXTERN_C_BEGIN /* Posix allows pthread_t to be a struct, though it rarely is. */ /* Unfortunately, we need to use a pthread_t to index a data */ /* structure. It also helps if comparisons don't involve a */ @@ -136,13 +126,9 @@ /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */ # ifdef SN_TARGET_PSP2 -# ifdef __cplusplus - } /* extern "C" */ -# endif + EXTERN_C_END # include "psp2-support.h" -# ifdef __cplusplus - extern "C" { -# endif + EXTERN_C_BEGIN GC_EXTERN WapiMutex GC_allocate_ml_PSP2; # define UNCOND_LOCK() { int res; GC_ASSERT(I_DONT_HOLD_LOCK()); \ res = PSP2_MutexLock(&GC_allocate_ml_PSP2); \ @@ -186,13 +172,9 @@ # endif # endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ # ifdef USE_PTHREAD_LOCKS -# ifdef __cplusplus - } /* extern "C" */ -# endif + EXTERN_C_END # include <pthread.h> -# ifdef __cplusplus - extern "C" { -# endif + EXTERN_C_BEGIN GC_EXTERN pthread_mutex_t GC_allocate_ml; # ifdef GC_ASSERTIONS # define UNCOND_LOCK() { GC_ASSERT(I_DONT_HOLD_LOCK()); \ @@ -258,9 +240,7 @@ # endif # endif -# ifdef __cplusplus - } /* extern "C" */ -# endif + EXTERN_C_END # else /* !THREADS */ # define LOCK() (void)0 |