diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-04-18 09:49:13 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-04-18 09:49:13 +0300 |
commit | 9d77d70bed28887d4b965d1d85db6e95059952d3 (patch) | |
tree | aa19ca913466943a737e84368a7804068893f2f5 | |
parent | ad916805e21835a728f4f055196f264180cf4ab3 (diff) | |
download | bdwgc-9d77d70bed28887d4b965d1d85db6e95059952d3.tar.gz |
Adjust indentation in C preprocessor directives
(reformatting)
* cord/tests/de.c: Adjust indentation in directives.
* cord/tests/de_win.c: Likewise.
* dbg_mlc.c: Likewise.
* dyn_load.c: Likewise.
* extra/AmigaOS.c: Likewise.
* include/gc/ec.h: Likewise.
* include/gc/gc_tiny_fl.h: Likewise.
* include/private/gc_locks.h: Likewise.
* include/private/gc_priv.h: Likewise.
* include/private/gcconfig.h: Likewise.
* include/private/thread_local_alloc.h: Likewise.
* malloc.c: Likewise.
* mark.c: Likewise.
* os_dep.c: Likewise.
* ptr_chck.c: Likewise.
* reclaim.c: Likewise.
* tests/gctest.c: Likewise.
* tools/threadlibs.c: Likewise.
-rw-r--r-- | cord/tests/de.c | 52 | ||||
-rw-r--r-- | cord/tests/de_win.c | 54 | ||||
-rw-r--r-- | dbg_mlc.c | 10 | ||||
-rw-r--r-- | dyn_load.c | 48 | ||||
-rw-r--r-- | extra/AmigaOS.c | 2 | ||||
-rw-r--r-- | include/gc/ec.h | 6 | ||||
-rw-r--r-- | include/gc/gc_tiny_fl.h | 12 | ||||
-rw-r--r-- | include/private/gc_locks.h | 316 | ||||
-rw-r--r-- | include/private/gc_priv.h | 79 | ||||
-rw-r--r-- | include/private/gcconfig.h | 338 | ||||
-rw-r--r-- | include/private/thread_local_alloc.h | 2 | ||||
-rw-r--r-- | malloc.c | 2 | ||||
-rw-r--r-- | mark.c | 161 | ||||
-rw-r--r-- | os_dep.c | 92 | ||||
-rw-r--r-- | ptr_chck.c | 28 | ||||
-rw-r--r-- | reclaim.c | 2 | ||||
-rw-r--r-- | tests/gctest.c | 170 | ||||
-rw-r--r-- | tools/threadlibs.c | 12 |
18 files changed, 692 insertions, 694 deletions
diff --git a/cord/tests/de.c b/cord/tests/de.c index 4a30863b..6ad38b47 100644 --- a/cord/tests/de.c +++ b/cord/tests/de.c @@ -45,33 +45,33 @@ #endif #if defined(WIN32) -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN 1 -# endif -# define NOSERVICE -# include <windows.h> -# include "de_win.h" +# ifndef WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN 1 +# endif +# define NOSERVICE +# include <windows.h> +# include "de_win.h" #elif defined(MACINTOSH) -# include <console.h> +# include <console.h> /* curses emulation. */ -# define initscr() -# define endwin() -# define nonl() -# define noecho() csetmode(C_NOECHO, stdout) -# define cbreak() csetmode(C_CBREAK, stdout) -# define refresh() -# define addch(c) putchar(c) -# define standout() cinverse(1, stdout) -# define standend() cinverse(0, stdout) -# define move(line,col) cgotoxy(col + 1, line + 1, stdout) -# define clrtoeol() ccleol(stdout) -# define de_error(s) { fprintf(stderr, s); getchar(); } -# define LINES 25 -# define COLS 80 +# define initscr() +# define endwin() +# define nonl() +# define noecho() csetmode(C_NOECHO, stdout) +# define cbreak() csetmode(C_CBREAK, stdout) +# define refresh() +# define addch(c) putchar(c) +# define standout() cinverse(1, stdout) +# define standend() cinverse(0, stdout) +# define move(line,col) cgotoxy(col + 1, line + 1, stdout) +# define clrtoeol() ccleol(stdout) +# define de_error(s) { fprintf(stderr, s); getchar(); } +# define LINES 25 +# define COLS 80 #else -# include <curses.h> -# include <unistd.h> /* for sleep() */ -# define de_error(s) { fprintf(stderr, s); sleep(2); } +# include <curses.h> +# include <unistd.h> /* for sleep() */ +# define de_error(s) { fprintf(stderr, s); sleep(2); } #endif #include "de_cmds.h" @@ -383,9 +383,9 @@ void fix_pos(void) } #if defined(WIN32) -# define beep() Beep(1000 /* Hz */, 300 /* ms */) +# define beep() Beep(1000 /* Hz */, 300 /* ms */) #elif defined(MACINTOSH) -# define beep() SysBeep(1) +# define beep() SysBeep(1) #else /* * beep() is part of some curses packages and not others. diff --git a/cord/tests/de_win.c b/cord/tests/de_win.c index 878cae2a..9ba4c462 100644 --- a/cord/tests/de_win.c +++ b/cord/tests/de_win.c @@ -49,21 +49,21 @@ void de_error(const char *s) int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR command_line, int nCmdShow) { - MSG msg; - WNDCLASS wndclass; - HACCEL hAccel; + MSG msg; + WNDCLASS wndclass; + HACCEL hAccel; - GC_set_find_leak(0); - GC_INIT(); -# ifndef NO_INCREMENTAL + GC_set_find_leak(0); + GC_INIT(); +# ifndef NO_INCREMENTAL GC_enable_incremental(); -# endif -# if defined(CPPCHECK) +# endif +# if defined(CPPCHECK) GC_noop1((GC_word)&WinMain); -# endif +# endif - if (!hPrevInstance) - { + if (!hPrevInstance) + { wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbClsExtra = 0; @@ -79,28 +79,28 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, de_error("RegisterClass error"); return(0); } - } + } - /* Empirically, the command line does not include the command name ... - if (command_line != 0) { + /* Empirically, the command line does not include the command name ... + if (command_line != 0) { while (isspace(*command_line)) command_line++; while (*command_line != 0 && !isspace(*command_line)) command_line++; while (isspace(*command_line)) command_line++; - } */ + } */ - if (command_line == 0 || *command_line == 0) { + if (command_line == 0 || *command_line == 0) { de_error("File name argument required"); return( 0 ); - } else { + } else { char *p = command_line; while (*p != 0 && !isspace(*(unsigned char *)p)) p++; arg_file_name = CORD_to_char_star( CORD_substr(command_line, 0, p - command_line)); - } + } - hwnd = CreateWindow (szAppName, + hwnd = CreateWindow(szAppName, TEXT("Demonstration Editor"), WS_OVERLAPPEDWINDOW | WS_CAPTION, /* Window style */ CW_USEDEFAULT, 0, /* default pos. */ @@ -108,24 +108,24 @@ int APIENTRY WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, NULL, /* No parent */ NULL, /* Window class menu */ hInstance, NULL); - if (hwnd == NULL) { + if (hwnd == NULL) { de_error("CreateWindow error"); return(0); - } + } - ShowWindow (hwnd, nCmdShow); + ShowWindow (hwnd, nCmdShow); - hAccel = LoadAccelerators( hInstance, szAppName ); + hAccel = LoadAccelerators( hInstance, szAppName ); - while (GetMessage (&msg, NULL, 0, 0)) - { + while (GetMessage (&msg, NULL, 0, 0)) + { if( !TranslateAccelerator( hwnd, hAccel, &msg ) ) { TranslateMessage (&msg); DispatchMessage (&msg); } - } - return (int)msg.wParam; + } + return (int)msg.wParam; } /* Return the argument with all control characters replaced by blanks. */ @@ -892,11 +892,11 @@ GC_API void * GC_CALL GC_debug_realloc(void * p, size_t lb, GC_EXTRA_PARAMS) case UNCOLLECTABLE: result = GC_debug_malloc_uncollectable(lb, OPT_RA s, i); break; -# ifdef GC_ATOMIC_UNCOLLECTABLE - case AUNCOLLECTABLE: - result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i); - break; -# endif +# ifdef GC_ATOMIC_UNCOLLECTABLE + case AUNCOLLECTABLE: + result = GC_debug_malloc_atomic_uncollectable(lb, OPT_RA s, i); + break; +# endif default: result = NULL; /* initialized to prevent warning. */ ABORT_RET("GC_debug_realloc: encountered bad kind"); @@ -140,29 +140,29 @@ STATIC GC_has_static_roots_func GC_has_static_roots = 0; /* Newer versions of GNU/Linux define this macro. We * define it similarly for any ELF systems that don't. */ -# ifndef ElfW -# if defined(FREEBSD) -# if __ELF_WORD_SIZE == 32 -# define ElfW(type) Elf32_##type -# else -# define ElfW(type) Elf64_##type -# endif -# elif defined(NETBSD) || defined(OPENBSD) -# if ELFSIZE == 32 -# define ElfW(type) Elf32_##type -# elif ELFSIZE == 64 -# define ElfW(type) Elf64_##type -# else -# error Missing ELFSIZE define -# endif -# else -# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 -# define ElfW(type) Elf32_##type -# else -# define ElfW(type) Elf64_##type -# endif -# endif -# endif +# ifndef ElfW +# if defined(FREEBSD) +# if __ELF_WORD_SIZE == 32 +# define ElfW(type) Elf32_##type +# else +# define ElfW(type) Elf64_##type +# endif +# elif defined(NETBSD) || defined(OPENBSD) +# if ELFSIZE == 32 +# define ElfW(type) Elf32_##type +# elif ELFSIZE == 64 +# define ElfW(type) Elf64_##type +# else +# error Missing ELFSIZE define +# endif +# else +# if !defined(ELF_CLASS) || ELF_CLASS == ELFCLASS32 +# define ElfW(type) Elf32_##type +# else +# define ElfW(type) Elf64_##type +# endif +# endif +# endif #if defined(SOLARISDL) && !defined(USE_PROC_FOR_LIBRARIES) @@ -696,7 +696,7 @@ STATIC GC_bool GC_register_dynamic_libraries_dl_iterate_phdr(void) # define PF_W 2 # endif # elif !defined(HOST_ANDROID) -# include <elf.h> +# include <elf.h> # endif # ifndef HOST_ANDROID diff --git a/extra/AmigaOS.c b/extra/AmigaOS.c index 1daaa0ac..c55b985d 100644 --- a/extra/AmigaOS.c +++ b/extra/AmigaOS.c @@ -72,7 +72,7 @@ ptr_t GC_get_main_stack_base(void) BPTR myseglist; ULONG *data; -# ifdef __GNUC__ +# ifdef __GNUC__ ULONG dataSegSize; GC_bool found_segment = FALSE; extern char __data_size[]; diff --git a/include/gc/ec.h b/include/gc/ec.h index e7e0f7f5..ec200a27 100644 --- a/include/gc/ec.h +++ b/include/gc/ec.h @@ -14,9 +14,9 @@ #ifndef EC_H #define EC_H -# ifndef CORD_H -# include "cord.h" -# endif +#ifndef CORD_H +# include "cord.h" +#endif #ifdef __cplusplus extern "C" { diff --git a/include/gc/gc_tiny_fl.h b/include/gc/gc_tiny_fl.h index 0382b417..73c44682 100644 --- a/include/gc/gc_tiny_fl.h +++ b/include/gc/gc_tiny_fl.h @@ -51,18 +51,18 @@ || (defined(__x86_64__) && !defined(__ILP32__)) \ || defined(__alpha__) || defined(__powerpc64__) \ || defined(__arch64__) -# define GC_GRANULE_BYTES 16 -# define GC_GRANULE_WORDS 2 +# define GC_GRANULE_BYTES 16 +# define GC_GRANULE_WORDS 2 # else -# define GC_GRANULE_BYTES 8 -# define GC_GRANULE_WORDS 2 +# define GC_GRANULE_BYTES 8 +# define GC_GRANULE_WORDS 2 # endif #endif /* !GC_GRANULE_BYTES */ #if GC_GRANULE_WORDS == 2 -# define GC_WORDS_TO_GRANULES(n) ((n)>>1) +# define GC_WORDS_TO_GRANULES(n) ((n)>>1) #else -# define GC_WORDS_TO_GRANULES(n) ((n)*sizeof(void *)/GC_GRANULE_BYTES) +# define GC_WORDS_TO_GRANULES(n) ((n)*sizeof(void *)/GC_GRANULE_BYTES) #endif /* A "tiny" free list header contains TINY_FREELISTS pointers to */ diff --git a/include/private/gc_locks.h b/include/private/gc_locks.h index 81d20330..638693d2 100644 --- a/include/private/gc_locks.h +++ b/include/private/gc_locks.h @@ -26,123 +26,123 @@ * Note that I_HOLD_LOCK and I_DONT_HOLD_LOCK are used only positively * in assertions, and may return TRUE in the "don't know" case. */ -# ifdef THREADS +#ifdef THREADS -# ifdef PCR -# include <base/PCR_Base.h> -# include <th/PCR_Th.h> -# endif +# ifdef PCR +# include <base/PCR_Base.h> +# include <th/PCR_Th.h> +# endif - EXTERN_C_BEGIN + EXTERN_C_BEGIN -# ifdef PCR - GC_EXTERN PCR_Th_ML GC_allocate_ml; -# if defined(CPPCHECK) -# define DCL_LOCK_STATE /* empty */ -# else -# define DCL_LOCK_STATE \ +# ifdef PCR + GC_EXTERN PCR_Th_ML GC_allocate_ml; +# if defined(CPPCHECK) +# define DCL_LOCK_STATE /* empty */ +# else +# define DCL_LOCK_STATE \ PCR_ERes GC_fastLockRes; PCR_sigset_t GC_old_sig_mask -# endif -# define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml) -# define UNCOND_UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml) -# elif defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) - extern void GC_lock(void); - extern void GC_unlock(void); -# define UNCOND_LOCK() GC_lock() -# define UNCOND_UNLOCK() GC_unlock() -# endif +# endif +# define UNCOND_LOCK() PCR_Th_ML_Acquire(&GC_allocate_ml) +# define UNCOND_UNLOCK() PCR_Th_ML_Release(&GC_allocate_ml) +# elif defined(NN_PLATFORM_CTR) || defined(NINTENDO_SWITCH) + extern void GC_lock(void); + extern void GC_unlock(void); +# define UNCOND_LOCK() GC_lock() +# define UNCOND_UNLOCK() GC_unlock() +# endif -# if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \ +# if (!defined(AO_HAVE_test_and_set_acquire) || defined(GC_RTEMS_PTHREADS) \ || defined(SN_TARGET_PS3) \ || defined(GC_WIN32_THREADS) || defined(BASE_ATOMIC_OPS_EMULATED) \ || defined(LINT2)) && defined(GC_PTHREADS) -# define USE_PTHREAD_LOCKS -# undef USE_SPIN_LOCK -# if defined(LINT2) && !defined(NO_PTHREAD_TRYLOCK) -# define NO_PTHREAD_TRYLOCK -# endif -# endif +# define USE_PTHREAD_LOCKS +# undef USE_SPIN_LOCK +# if defined(LINT2) && !defined(NO_PTHREAD_TRYLOCK) +# define NO_PTHREAD_TRYLOCK +# endif +# endif -# if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS) -# define NO_THREAD (DWORD)(-1) - GC_EXTERN CRITICAL_SECTION GC_allocate_ml; -# ifdef GC_ASSERTIONS - GC_EXTERN DWORD GC_lock_holder; -# define SET_LOCK_HOLDER() GC_lock_holder = GetCurrentThreadId() -# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD -# define I_HOLD_LOCK() (!GC_need_to_lock \ +# if defined(GC_WIN32_THREADS) && !defined(USE_PTHREAD_LOCKS) +# define NO_THREAD (DWORD)(-1) + GC_EXTERN CRITICAL_SECTION GC_allocate_ml; +# ifdef GC_ASSERTIONS + GC_EXTERN DWORD GC_lock_holder; +# define SET_LOCK_HOLDER() GC_lock_holder = GetCurrentThreadId() +# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD +# define I_HOLD_LOCK() (!GC_need_to_lock \ || GC_lock_holder == GetCurrentThreadId()) -# ifdef THREAD_SANITIZER -# define I_DONT_HOLD_LOCK() TRUE /* Conservatively say yes */ -# else -# define I_DONT_HOLD_LOCK() (!GC_need_to_lock \ +# ifdef THREAD_SANITIZER +# define I_DONT_HOLD_LOCK() TRUE /* Conservatively say yes */ +# else +# define I_DONT_HOLD_LOCK() (!GC_need_to_lock \ || GC_lock_holder != GetCurrentThreadId()) -# endif -# define UNCOND_LOCK() \ +# endif +# define UNCOND_LOCK() \ { GC_ASSERT(I_DONT_HOLD_LOCK()); \ EnterCriticalSection(&GC_allocate_ml); \ SET_LOCK_HOLDER(); } -# define UNCOND_UNLOCK() \ +# define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ LeaveCriticalSection(&GC_allocate_ml); } -# else -# define UNCOND_LOCK() EnterCriticalSection(&GC_allocate_ml) -# define UNCOND_UNLOCK() LeaveCriticalSection(&GC_allocate_ml) -# endif /* !GC_ASSERTIONS */ -# elif defined(GC_PTHREADS) - EXTERN_C_END -# include <pthread.h> - 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 */ - /* function call. Hence we introduce platform-dependent macros */ - /* to compare pthread_t ids and to map them to integers. */ - /* The mapping to integers does not need to result in different */ - /* integers for each thread, though that should be true as much */ - /* as possible. */ - /* Refine to exclude platforms on which pthread_t is struct. */ -# if !defined(GC_WIN32_PTHREADS) -# define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) -# define THREAD_EQUAL(id1, id2) ((id1) == (id2)) -# define NUMERIC_THREAD_ID_UNIQUE -# elif defined(__WINPTHREADS_VERSION_MAJOR) /* winpthreads */ -# define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) -# define THREAD_EQUAL(id1, id2) ((id1) == (id2)) -# ifndef _WIN64 - /* NUMERIC_THREAD_ID is 32-bit and not unique on Win64. */ -# define NUMERIC_THREAD_ID_UNIQUE -# endif -# else /* pthreads-win32 */ -# define NUMERIC_THREAD_ID(id) ((unsigned long)(word)(id.p)) - /* Using documented internal details of pthreads-win32 library. */ - /* Faster than pthread_equal(). Should not change with */ - /* future versions of pthreads-win32 library. */ -# define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) -# undef NUMERIC_THREAD_ID_UNIQUE - /* Generic definitions based on pthread_equal() always work but */ - /* will result in poor performance (as NUMERIC_THREAD_ID is */ - /* defined to just a constant) and weak assertion checking. */ -# endif -# define NO_THREAD ((unsigned long)(-1l)) +# else +# define UNCOND_LOCK() EnterCriticalSection(&GC_allocate_ml) +# define UNCOND_UNLOCK() LeaveCriticalSection(&GC_allocate_ml) +# endif /* !GC_ASSERTIONS */ +# elif defined(GC_PTHREADS) + EXTERN_C_END +# include <pthread.h> + 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 */ + /* function call. Hence we introduce platform-dependent macros */ + /* to compare pthread_t ids and to map them to integers. */ + /* The mapping to integers does not need to result in different */ + /* integers for each thread, though that should be true as much */ + /* as possible. */ + /* Refine to exclude platforms on which pthread_t is struct. */ +# if !defined(GC_WIN32_PTHREADS) +# define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) +# define THREAD_EQUAL(id1, id2) ((id1) == (id2)) +# define NUMERIC_THREAD_ID_UNIQUE +# elif defined(__WINPTHREADS_VERSION_MAJOR) /* winpthreads */ +# define NUMERIC_THREAD_ID(id) ((unsigned long)(id)) +# define THREAD_EQUAL(id1, id2) ((id1) == (id2)) +# ifndef _WIN64 + /* NUMERIC_THREAD_ID is 32-bit and not unique on Win64. */ +# define NUMERIC_THREAD_ID_UNIQUE +# endif +# else /* pthreads-win32 */ +# define NUMERIC_THREAD_ID(id) ((unsigned long)(word)(id.p)) + /* Using documented internal details of pthreads-win32 library. */ + /* Faster than pthread_equal(). Should not change with */ + /* future versions of pthreads-win32 library. */ +# define THREAD_EQUAL(id1, id2) ((id1.p == id2.p) && (id1.x == id2.x)) +# undef NUMERIC_THREAD_ID_UNIQUE + /* Generic definitions based on pthread_equal() always work but */ + /* will result in poor performance (as NUMERIC_THREAD_ID is */ + /* defined to just a constant) and weak assertion checking. */ +# endif +# define NO_THREAD ((unsigned long)(-1l)) /* != NUMERIC_THREAD_ID(pthread_self()) for any thread */ -# ifdef SN_TARGET_PSP2 - EXTERN_C_END -# include "psp2-support.h" - EXTERN_C_BEGIN - GC_EXTERN WapiMutex GC_allocate_ml_PSP2; -# define UNCOND_LOCK() { int res; GC_ASSERT(I_DONT_HOLD_LOCK()); \ +# ifdef SN_TARGET_PSP2 + EXTERN_C_END +# include "psp2-support.h" + 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); \ GC_ASSERT(0 == res); (void)res; \ SET_LOCK_HOLDER(); } -# define UNCOND_UNLOCK() { int res; GC_ASSERT(I_HOLD_LOCK()); \ +# define UNCOND_UNLOCK() { int res; GC_ASSERT(I_HOLD_LOCK()); \ UNSET_LOCK_HOLDER(); \ res = PSP2_MutexUnlock(&GC_allocate_ml_PSP2); \ GC_ASSERT(0 == res); (void)res; } -# elif (!defined(THREAD_LOCAL_ALLOC) || defined(USE_SPIN_LOCK)) \ - && !defined(USE_PTHREAD_LOCKS) && !defined(THREAD_SANITIZER) +# elif (!defined(THREAD_LOCAL_ALLOC) || defined(USE_SPIN_LOCK)) \ + && !defined(USE_PTHREAD_LOCKS) && !defined(THREAD_SANITIZER) /* In the THREAD_LOCAL_ALLOC case, the allocation lock tends to */ /* be held for long periods, if it is held at all. Thus spinning */ /* and sleeping for fixed periods are likely to result in */ @@ -154,87 +154,87 @@ /* Allocation lock holder. Only set if acquired by client through */ /* GC_call_with_alloc_lock. */ # ifdef GC_ASSERTIONS -# define UNCOND_LOCK() \ +# define UNCOND_LOCK() \ { GC_ASSERT(I_DONT_HOLD_LOCK()); \ if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_SET) \ GC_lock(); \ SET_LOCK_HOLDER(); } -# define UNCOND_UNLOCK() \ +# define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ AO_CLEAR(&GC_allocate_lock); } # else -# define UNCOND_LOCK() \ +# define UNCOND_LOCK() \ { if (AO_test_and_set_acquire(&GC_allocate_lock) == AO_TS_SET) \ GC_lock(); } -# define UNCOND_UNLOCK() AO_CLEAR(&GC_allocate_lock) +# define UNCOND_UNLOCK() AO_CLEAR(&GC_allocate_lock) # endif /* !GC_ASSERTIONS */ -# else /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ -# ifndef USE_PTHREAD_LOCKS -# define USE_PTHREAD_LOCKS -# endif -# endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ -# ifdef USE_PTHREAD_LOCKS - EXTERN_C_END -# include <pthread.h> - EXTERN_C_BEGIN - GC_EXTERN pthread_mutex_t GC_allocate_ml; -# ifdef GC_ASSERTIONS - GC_INNER void GC_lock(void); -# define UNCOND_LOCK() { GC_ASSERT(I_DONT_HOLD_LOCK()); \ +# else /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ +# ifndef USE_PTHREAD_LOCKS +# define USE_PTHREAD_LOCKS +# endif +# endif /* THREAD_LOCAL_ALLOC || USE_PTHREAD_LOCKS */ +# ifdef USE_PTHREAD_LOCKS + EXTERN_C_END +# include <pthread.h> + EXTERN_C_BEGIN + GC_EXTERN pthread_mutex_t GC_allocate_ml; +# ifdef GC_ASSERTIONS + GC_INNER void GC_lock(void); +# define UNCOND_LOCK() { GC_ASSERT(I_DONT_HOLD_LOCK()); \ GC_lock(); SET_LOCK_HOLDER(); } -# define UNCOND_UNLOCK() \ +# define UNCOND_UNLOCK() \ { GC_ASSERT(I_HOLD_LOCK()); UNSET_LOCK_HOLDER(); \ pthread_mutex_unlock(&GC_allocate_ml); } -# else /* !GC_ASSERTIONS */ -# if defined(NO_PTHREAD_TRYLOCK) -# define UNCOND_LOCK() pthread_mutex_lock(&GC_allocate_ml) -# else - GC_INNER void GC_lock(void); -# define UNCOND_LOCK() \ +# else /* !GC_ASSERTIONS */ +# if defined(NO_PTHREAD_TRYLOCK) +# define UNCOND_LOCK() pthread_mutex_lock(&GC_allocate_ml) +# else + GC_INNER void GC_lock(void); +# define UNCOND_LOCK() \ { if (0 != pthread_mutex_trylock(&GC_allocate_ml)) \ GC_lock(); } -# endif -# define UNCOND_UNLOCK() pthread_mutex_unlock(&GC_allocate_ml) -# endif /* !GC_ASSERTIONS */ -# endif /* USE_PTHREAD_LOCKS */ -# ifdef GC_ASSERTIONS - GC_EXTERN unsigned long GC_lock_holder; -# define SET_LOCK_HOLDER() \ +# endif +# define UNCOND_UNLOCK() pthread_mutex_unlock(&GC_allocate_ml) +# endif /* !GC_ASSERTIONS */ +# endif /* USE_PTHREAD_LOCKS */ +# ifdef GC_ASSERTIONS + GC_EXTERN unsigned long GC_lock_holder; +# define SET_LOCK_HOLDER() \ GC_lock_holder = NUMERIC_THREAD_ID(pthread_self()) -# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD -# define I_HOLD_LOCK() \ +# define UNSET_LOCK_HOLDER() GC_lock_holder = NO_THREAD +# define I_HOLD_LOCK() \ (!GC_need_to_lock \ || GC_lock_holder == NUMERIC_THREAD_ID(pthread_self())) -# if !defined(NUMERIC_THREAD_ID_UNIQUE) || defined(THREAD_SANITIZER) -# define I_DONT_HOLD_LOCK() TRUE /* Conservatively say yes */ -# else -# define I_DONT_HOLD_LOCK() \ +# if !defined(NUMERIC_THREAD_ID_UNIQUE) || defined(THREAD_SANITIZER) +# define I_DONT_HOLD_LOCK() TRUE /* Conservatively say yes */ +# else +# define I_DONT_HOLD_LOCK() \ (!GC_need_to_lock \ || GC_lock_holder != NUMERIC_THREAD_ID(pthread_self())) -# endif -# endif /* GC_ASSERTIONS */ -# ifndef GC_WIN32_THREADS - GC_EXTERN volatile GC_bool GC_collecting; -# ifdef AO_HAVE_char_store -# define ENTER_GC() AO_char_store((unsigned char*)&GC_collecting, TRUE) -# define EXIT_GC() AO_char_store((unsigned char*)&GC_collecting, FALSE) -# else -# define ENTER_GC() (void)(GC_collecting = TRUE) -# define EXIT_GC() (void)(GC_collecting = FALSE) -# endif -# endif -# endif /* GC_PTHREADS */ -# if defined(GC_ALWAYS_MULTITHREADED) \ +# endif +# endif /* GC_ASSERTIONS */ +# ifndef GC_WIN32_THREADS + GC_EXTERN volatile GC_bool GC_collecting; +# ifdef AO_HAVE_char_store +# define ENTER_GC() AO_char_store((unsigned char*)&GC_collecting, TRUE) +# define EXIT_GC() AO_char_store((unsigned char*)&GC_collecting, FALSE) +# else +# define ENTER_GC() (void)(GC_collecting = TRUE) +# define EXIT_GC() (void)(GC_collecting = FALSE) +# endif +# endif /* !GC_WIN32_THREADS */ +# endif /* GC_PTHREADS */ +# if defined(GC_ALWAYS_MULTITHREADED) \ && (defined(USE_PTHREAD_LOCKS) || defined(USE_SPIN_LOCK)) -# define GC_need_to_lock TRUE -# define set_need_to_lock() (void)0 -# else -# if defined(GC_ALWAYS_MULTITHREADED) && !defined(CPPCHECK) -# error Runtime initialization of GC lock is needed! -# endif -# undef GC_ALWAYS_MULTITHREADED - GC_EXTERN GC_bool GC_need_to_lock; -# ifdef THREAD_SANITIZER +# define GC_need_to_lock TRUE +# define set_need_to_lock() (void)0 +# else +# if defined(GC_ALWAYS_MULTITHREADED) && !defined(CPPCHECK) +# error Runtime initialization of GC lock is needed! +# endif +# undef GC_ALWAYS_MULTITHREADED + GC_EXTERN GC_bool GC_need_to_lock; +# ifdef THREAD_SANITIZER /* To workaround TSan false positive (e.g., when */ /* GC_pthread_create is called from multiple threads in */ /* parallel), do not set GC_need_to_lock if it is already set. */ @@ -242,15 +242,15 @@ (void)(*(GC_bool volatile *)&GC_need_to_lock \ ? FALSE \ : (GC_need_to_lock = TRUE)) -# else +# else # define set_need_to_lock() (void)(GC_need_to_lock = TRUE) /* We are multi-threaded now. */ -# endif -# endif +# endif +# endif - EXTERN_C_END + EXTERN_C_END -# else /* !THREADS */ +#else /* !THREADS */ # define LOCK() (void)0 # define UNLOCK() (void)0 # ifdef GC_ASSERTIONS @@ -260,7 +260,7 @@ /* we still need to acquire the lock. TRUE works in */ /* either case. */ # endif -# endif /* !THREADS */ +#endif /* !THREADS */ #if defined(UNCOND_LOCK) && !defined(LOCK) # if (defined(LINT2) && defined(USE_PTHREAD_LOCKS)) \ diff --git a/include/private/gc_priv.h b/include/private/gc_priv.h index 9c562ca5..c9c86ea8 100644 --- a/include/private/gc_priv.h +++ b/include/private/gc_priv.h @@ -864,13 +864,13 @@ EXTERN_C_BEGIN #endif #if CPP_WORDSZ == 64 -# define WORDS_TO_BYTES(x) ((x)<<3) -# define BYTES_TO_WORDS(x) ((x)>>3) -# define LOGWL ((word)6) /* log[2] of CPP_WORDSZ */ -# define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */ -# if ALIGNMENT != 8 -# define UNALIGNED_PTRS -# endif +# define WORDS_TO_BYTES(x) ((x)<<3) +# define BYTES_TO_WORDS(x) ((x)>>3) +# define LOGWL ((word)6) /* log[2] of CPP_WORDSZ */ +# define modWORDSZ(n) ((n) & 0x3f) /* n mod size of word */ +# if ALIGNMENT != 8 +# define UNALIGNED_PTRS +# endif #endif /* The first TINY_FREELISTS free lists correspond to the first */ @@ -995,9 +995,9 @@ EXTERN_C_BEGIN # define ROUNDED_UP_GRANULES(lb) /* lb should have no side-effect */ \ BYTES_TO_GRANULES(SIZET_SAT_ADD(lb, GRANULE_BYTES - 1 + EXTRA_BYTES)) # if MAX_EXTRA_BYTES == 0 -# define SMALL_OBJ(bytes) EXPECT((bytes) <= (MAXOBJBYTES), TRUE) +# define SMALL_OBJ(bytes) EXPECT((bytes) <= (MAXOBJBYTES), TRUE) # else -# define SMALL_OBJ(bytes) \ +# define SMALL_OBJ(bytes) \ (EXPECT((bytes) <= (MAXOBJBYTES - MAX_EXTRA_BYTES), TRUE) \ || (bytes) <= MAXOBJBYTES - EXTRA_BYTES) /* This really just tests bytes <= MAXOBJBYTES - EXTRA_BYTES. */ @@ -1688,34 +1688,35 @@ GC_API_PRIV GC_FAR struct _GC_arrays GC_arrays; # define MAXOBJKINDS 16 #endif GC_EXTERN struct obj_kind { - void **ok_freelist; /* Array of free list headers for this kind of */ + void **ok_freelist; /* Array of free list headers for this kind of */ /* object. Point either to GC_arrays or to */ /* storage allocated with GC_scratch_alloc. */ - struct hblk **ok_reclaim_list; + struct hblk **ok_reclaim_list; /* List headers for lists of blocks waiting to */ /* be swept. Indexed by object size in */ /* granules. */ - word ok_descriptor; /* Descriptor template for objects in this */ + word ok_descriptor; /* Descriptor template for objects in this */ /* block. */ - GC_bool ok_relocate_descr; + GC_bool ok_relocate_descr; /* Add object size in bytes to descriptor */ /* template to obtain descriptor. Otherwise */ /* template is used as is. */ - GC_bool ok_init; /* Clear objects before putting them on the free list. */ -# ifdef ENABLE_DISCLAIM - GC_bool ok_mark_unconditionally; + GC_bool ok_init; + /* Clear objects before putting them on the free list. */ +# ifdef ENABLE_DISCLAIM + GC_bool ok_mark_unconditionally; /* Mark from all, including unmarked, objects */ /* in block. Used to protect objects reachable */ /* from reclaim notifiers. */ - int (GC_CALLBACK *ok_disclaim_proc)(void * /*obj*/); + int (GC_CALLBACK *ok_disclaim_proc)(void * /*obj*/); /* The disclaim procedure is called before obj */ /* is reclaimed, but must also tolerate being */ /* called with object from freelist. Non-zero */ /* exit prevents object from being reclaimed. */ -# define OK_DISCLAIM_INITZ /* comma */, FALSE, 0 -# else -# define OK_DISCLAIM_INITZ /* empty */ -# endif /* !ENABLE_DISCLAIM */ +# define OK_DISCLAIM_INITZ /* comma */, FALSE, 0 +# else +# define OK_DISCLAIM_INITZ /* empty */ +# endif /* !ENABLE_DISCLAIM */ } GC_obj_kinds[MAXOBJKINDS]; #define beginGC_obj_kinds ((ptr_t)(&GC_obj_kinds)) @@ -1870,19 +1871,19 @@ struct GC_traced_stack_sect_s { #endif /* !USE_MARK_BYTES */ #ifdef MARK_BIT_PER_OBJ -# define MARK_BIT_NO(offset, sz) (((word)(offset))/(sz)) +# define MARK_BIT_NO(offset, sz) (((word)(offset))/(sz)) /* Get the mark bit index corresponding to the given byte */ /* offset and size (in bytes). */ -# define MARK_BIT_OFFSET(sz) 1 +# define MARK_BIT_OFFSET(sz) 1 /* Spacing between useful mark bits. */ -# define IF_PER_OBJ(x) x -# define FINAL_MARK_BIT(sz) ((sz) > MAXOBJBYTES? 1 : HBLK_OBJS(sz)) +# define IF_PER_OBJ(x) x +# define FINAL_MARK_BIT(sz) ((sz) > MAXOBJBYTES? 1 : HBLK_OBJS(sz)) /* Position of final, always set, mark bit. */ #else /* MARK_BIT_PER_GRANULE */ -# define MARK_BIT_NO(offset, sz) BYTES_TO_GRANULES((word)(offset)) -# define MARK_BIT_OFFSET(sz) BYTES_TO_GRANULES(sz) -# define IF_PER_OBJ(x) -# define FINAL_MARK_BIT(sz) \ +# define MARK_BIT_NO(offset, sz) BYTES_TO_GRANULES((word)(offset)) +# define MARK_BIT_OFFSET(sz) BYTES_TO_GRANULES(sz) +# define IF_PER_OBJ(x) +# define FINAL_MARK_BIT(sz) \ ((sz) > MAXOBJBYTES ? MARK_BITS_PER_HBLK \ : BYTES_TO_GRANULES((sz) * HBLK_OBJS(sz))) #endif @@ -2335,13 +2336,13 @@ GC_INNER ptr_t GC_allocobj(size_t sz, int kind); /* used by GC debug API macros) thus GC_RETURN_ADDR_PARENT (pointing */ /* to client caller) should be used if possible. */ # ifdef GC_HAVE_RETURN_ADDR_PARENT -# define GC_DBG_EXTRAS GC_RETURN_ADDR_PARENT, NULL, 0 +# define GC_DBG_EXTRAS GC_RETURN_ADDR_PARENT, NULL, 0 # else -# define GC_DBG_EXTRAS GC_RETURN_ADDR, NULL, 0 +# define GC_DBG_EXTRAS GC_RETURN_ADDR, NULL, 0 # endif #else # define GC_DBG_EXTRAS "unknown", 0 -#endif +#endif /* !GC_ADD_CALLER */ #ifdef GC_COLLECT_AT_MALLOC extern size_t GC_dbg_collect_at_malloc_min_lb; @@ -2607,14 +2608,14 @@ void GC_print_heap_sects(void); void GC_print_static_roots(void); #ifdef KEEP_BACK_PTRS - GC_INNER void GC_store_back_pointer(ptr_t source, ptr_t dest); - GC_INNER void GC_marked_for_finalization(ptr_t dest); -# define GC_STORE_BACK_PTR(source, dest) GC_store_back_pointer(source, dest) -# define GC_MARKED_FOR_FINALIZATION(dest) GC_marked_for_finalization(dest) + GC_INNER void GC_store_back_pointer(ptr_t source, ptr_t dest); + GC_INNER void GC_marked_for_finalization(ptr_t dest); +# define GC_STORE_BACK_PTR(source, dest) GC_store_back_pointer(source, dest) +# define GC_MARKED_FOR_FINALIZATION(dest) GC_marked_for_finalization(dest) #else -# define GC_STORE_BACK_PTR(source, dest) (void)(source) -# define GC_MARKED_FOR_FINALIZATION(dest) -#endif +# define GC_STORE_BACK_PTR(source, dest) (void)(source) +# define GC_MARKED_FOR_FINALIZATION(dest) +#endif /* !KEEP_BACK_PTRS */ /* Make arguments appear live to compiler */ void GC_noop6(word, word, word, word, word, word); diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index fc2dbd91..4f75be72 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -112,12 +112,12 @@ EXTERN_C_BEGIN /* And one for NetBSD: */ # if defined(__NetBSD__) -# define NETBSD +# define NETBSD # endif /* And one for OpenBSD: */ # if defined(__OpenBSD__) -# define OPENBSD +# define OPENBSD # endif /* And one for FreeBSD: */ @@ -137,112 +137,112 @@ EXTERN_C_BEGIN /* Determine the machine type: */ # if defined(__native_client__) -# define NACL -# if !defined(__portable_native_client__) && !defined(__arm__) -# define I386 -# define mach_type_known -# else - /* Here we will rely upon arch-specific defines. */ -# endif +# define NACL +# if !defined(__portable_native_client__) && !defined(__arm__) +# define I386 +# define mach_type_known +# else + /* Here we will rely upon arch-specific defines. */ +# endif # endif # if defined(__aarch64__) -# define AARCH64 -# if !defined(LINUX) && !defined(DARWIN) && !defined(FREEBSD) \ - && !defined(NETBSD) && !defined(NN_BUILD_TARGET_PLATFORM_NX) \ - && !defined(OPENBSD) && !defined(_WIN32) -# define NOSYS -# define mach_type_known -# endif +# define AARCH64 +# if !defined(LINUX) && !defined(DARWIN) && !defined(FREEBSD) \ + && !defined(NETBSD) && !defined(NN_BUILD_TARGET_PLATFORM_NX) \ + && !defined(OPENBSD) && !defined(_WIN32) +# define NOSYS +# define mach_type_known +# endif # endif # if defined(__arm) || defined(__arm__) || defined(__thumb__) -# define ARM32 -# if defined(NACL) -# define mach_type_known -# elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \ - && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \ - && !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \ - && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) \ - && !defined(SYMBIAN) -# define NOSYS -# define mach_type_known -# endif +# define ARM32 +# if defined(NACL) +# define mach_type_known +# elif !defined(LINUX) && !defined(NETBSD) && !defined(FREEBSD) \ + && !defined(OPENBSD) && !defined(DARWIN) && !defined(_WIN32) \ + && !defined(__CEGCC__) && !defined(NN_PLATFORM_CTR) \ + && !defined(GC_NO_NOSYS) && !defined(SN_TARGET_PSP2) \ + && !defined(SYMBIAN) +# define NOSYS +# define mach_type_known +# endif # endif # if defined(sun) && defined(mc68000) && !defined(CPPCHECK) -# error SUNOS4 no longer supported +# error SUNOS4 no longer supported # endif # if defined(hp9000s300) && !defined(CPPCHECK) -# error M68K based HP machines no longer supported +# error M68K based HP machines no longer supported # endif # if defined(OPENBSD) && defined(m68k) -# define M68K -# define mach_type_known +# define M68K +# define mach_type_known # endif # if defined(OPENBSD) && defined(__sparc__) -# define SPARC -# define mach_type_known +# define SPARC +# define mach_type_known # endif # if defined(OPENBSD) && defined(__arm__) -# define ARM32 -# define mach_type_known +# define ARM32 +# define mach_type_known # endif # if defined(OPENBSD) && defined(__aarch64__) -# define AARCH64 -# define mach_type_known +# define AARCH64 +# define mach_type_known # endif # if defined(OPENBSD) && defined(__sh__) -# define SH -# define mach_type_known +# define SH +# define mach_type_known # endif # if defined(NETBSD) && (defined(m68k) || defined(__m68k__)) -# define M68K -# define mach_type_known +# define M68K +# define mach_type_known # endif # if defined(NETBSD) && defined(__powerpc__) -# define POWERPC -# define mach_type_known +# define POWERPC +# define mach_type_known # endif # if defined(NETBSD) && (defined(__arm32__) || defined(__arm__)) -# define ARM32 -# define mach_type_known +# define ARM32 +# define mach_type_known # endif # if defined(NETBSD) && defined(__aarch64__) -# define AARCH64 -# define mach_type_known +# define AARCH64 +# define mach_type_known # endif # if defined(NETBSD) && defined(__sh__) -# define SH -# define mach_type_known +# define SH +# define mach_type_known # endif # if defined(vax) || defined(__vax__) -# define VAX -# ifdef ultrix -# define ULTRIX -# else -# define BSD -# endif -# define mach_type_known +# define VAX +# ifdef ultrix +# define ULTRIX +# else +# define BSD +# endif +# define mach_type_known # endif # if defined(NETBSD) && defined(__vax__) -# define VAX -# define mach_type_known +# define VAX +# define mach_type_known # endif # if defined(mips) || defined(__mips) || defined(_mips) -# define MIPS -# if defined(nec_ews) || defined(_nec_ews) -# define EWS4800 -# endif -# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) \ - && !defined(OPENBSD) -# if defined(ultrix) || defined(__ultrix) -# define ULTRIX -# else -# define IRIX5 /* or IRIX 6.X */ -# endif -# endif /* !LINUX */ -# if defined(NETBSD) && defined(__MIPSEL__) -# undef ULTRIX -# endif -# define mach_type_known +# define MIPS +# if defined(nec_ews) || defined(_nec_ews) +# define EWS4800 +# endif +# if !defined(LINUX) && !defined(EWS4800) && !defined(NETBSD) \ + && !defined(OPENBSD) +# if defined(ultrix) || defined(__ultrix) +# define ULTRIX +# else +# define IRIX5 /* or IRIX 6.X */ +# endif +# endif /* !LINUX */ +# if defined(NETBSD) && defined(__MIPSEL__) +# undef ULTRIX +# endif +# define mach_type_known # endif # if defined(__QNX__) # define I386 @@ -253,35 +253,35 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if defined(__or1k__) -# define OR1K /* OpenRISC/or1k */ -# define mach_type_known +# define OR1K /* OpenRISC/or1k */ +# define mach_type_known # endif # if defined(DGUX) && (defined(i386) || defined(__i386__)) -# define I386 -# ifndef _USING_DGUX -# define _USING_DGUX -# endif -# define mach_type_known +# define I386 +# ifndef _USING_DGUX +# define _USING_DGUX +# endif +# define mach_type_known # endif # if defined(sequent) && (defined(i386) || defined(__i386__)) -# define I386 -# define SEQUENT -# define mach_type_known +# define I386 +# define SEQUENT +# define mach_type_known # endif # if (defined(sun) || defined(__sun)) && (defined(i386) || defined(__i386__)) -# define I386 -# define SOLARIS -# define mach_type_known +# define I386 +# define SOLARIS +# define mach_type_known # endif # if (defined(sun) || defined(__sun)) && defined(__amd64) -# define X86_64 -# define SOLARIS -# define mach_type_known +# define X86_64 +# define SOLARIS +# define mach_type_known # endif # if (defined(__OS2__) || defined(__EMX__)) && defined(__32BIT__) -# define I386 -# define OS2 -# define mach_type_known +# define I386 +# define OS2 +# define mach_type_known # endif # if defined(ibm032) && !defined(CPPCHECK) # error IBM PC/RT no longer supported @@ -338,77 +338,77 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if (defined(__BEOS__) || defined(__HAIKU__)) && defined(_X86_) -# define I386 -# define HAIKU -# define mach_type_known +# define I386 +# define HAIKU +# define mach_type_known # endif # if defined(__HAIKU__) && (defined(__amd64__) || defined(__x86_64__)) -# define X86_64 -# define HAIKU -# define mach_type_known +# define X86_64 +# define HAIKU +# define mach_type_known # endif # if defined(OPENBSD) && defined(__amd64__) -# define X86_64 -# define mach_type_known +# define X86_64 +# define mach_type_known # endif # if defined(LINUX) && (defined(i386) || defined(__i386__)) -# define I386 -# define mach_type_known +# define I386 +# define mach_type_known # endif # if defined(LINUX) && defined(__x86_64__) -# define X86_64 -# define mach_type_known +# define X86_64 +# define mach_type_known # endif # if defined(LINUX) && (defined(__ia64__) || defined(__ia64)) -# define IA64 -# define mach_type_known +# define IA64 +# define mach_type_known # endif # if defined(LINUX) && defined(__e2k__) -# define E2K -# define mach_type_known +# define E2K +# define mach_type_known # endif # if defined(LINUX) && defined(__aarch64__) -# define AARCH64 -# define mach_type_known +# define AARCH64 +# define mach_type_known # endif # if defined(LINUX) && (defined(__arm) || defined(__arm__)) -# define ARM32 -# define mach_type_known +# define ARM32 +# define mach_type_known # endif # if defined(LINUX) && defined(__cris__) -# ifndef CRIS -# define CRIS -# endif -# define mach_type_known +# ifndef CRIS +# define CRIS +# endif +# define mach_type_known # endif # if defined(LINUX) && defined(__loongarch__) -# define LOONGARCH -# define mach_type_known +# define LOONGARCH +# define mach_type_known # endif # if defined(LINUX) && (defined(powerpc) || defined(__powerpc__) \ || defined(powerpc64) || defined(__powerpc64__)) -# define POWERPC -# define mach_type_known +# define POWERPC +# define mach_type_known # endif # if defined(LINUX) && defined(__mc68000__) -# define M68K -# define mach_type_known +# define M68K +# define mach_type_known # endif # if defined(LINUX) && (defined(sparc) || defined(__sparc__)) -# define SPARC -# define mach_type_known +# define SPARC +# define mach_type_known # endif # if defined(LINUX) && defined(__sh__) -# define SH -# define mach_type_known +# define SH +# define mach_type_known # endif # if defined(LINUX) && defined(__avr32__) -# define AVR32 -# define mach_type_known +# define AVR32 +# define mach_type_known # endif # if defined(LINUX) && defined(__m32r__) -# define M32R -# define mach_type_known +# define M32R +# define mach_type_known # endif # if defined(__alpha) || defined(__alpha__) # define ALPHA @@ -443,20 +443,20 @@ EXTERN_C_BEGIN # endif # if defined(DARWIN) # if defined(__ppc__) || defined(__ppc64__) -# define POWERPC -# define mach_type_known +# define POWERPC +# define mach_type_known # elif defined(__x86_64__) || defined(__x86_64) -# define X86_64 -# define mach_type_known +# define X86_64 +# define mach_type_known # elif defined(__i386__) -# define I386 -# define mach_type_known +# define I386 +# define mach_type_known # elif defined(__arm__) -# define ARM32 -# define mach_type_known +# define ARM32 +# define mach_type_known # elif defined(__aarch64__) -# define AARCH64 -# define mach_type_known +# define AARCH64 +# define mach_type_known # endif # endif # if defined(__rtems__) && (defined(i386) || defined(__i386__)) @@ -483,8 +483,8 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if defined(NETBSD) && defined(__x86_64__) -# define X86_64 -# define mach_type_known +# define X86_64 +# define mach_type_known # endif # if defined(FREEBSD) && (defined(i386) || defined(__i386__)) # define I386 @@ -515,9 +515,9 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if defined(bsdi) && (defined(i386) || defined(__i386__)) -# define I386 -# define BSDI -# define mach_type_known +# define I386 +# define BSDI +# define mach_type_known # endif # if !defined(mach_type_known) && defined(__386BSD__) # define I386 @@ -641,8 +641,8 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if defined(__s390__) && defined(LINUX) -# define S390 -# define mach_type_known +# define S390 +# define mach_type_known # endif # if defined(__GNU__) # if defined(__i386__) @@ -650,7 +650,7 @@ EXTERN_C_BEGIN # define HURD # define I386 # define mach_type_known -# endif +# endif # endif # if defined(__TANDEM) /* Nonstop S-series */ @@ -664,8 +664,8 @@ EXTERN_C_BEGIN # define mach_type_known # endif # if defined(__hexagon__) && defined(LINUX) -# define HEXAGON -# define mach_type_known +# define HEXAGON +# define mach_type_known # endif # if defined(__tile__) && defined(LINUX) # ifdef __tilegx__ @@ -1779,24 +1779,24 @@ EXTERN_C_BEGIN # define DATASTART ((ptr_t)0x10000000) # define STACKBOTTOM ((ptr_t)0x7ffff000) # endif -# endif -# ifdef OPENBSD +# endif +# ifdef OPENBSD # define CPP_WORDSZ 64 /* all OpenBSD/mips platforms are 64-bit */ # define ALIGNMENT 8 -# endif -# ifdef FREEBSD -# define ALIGNMENT 4 -# endif -# ifdef NONSTOP -# define OS_TYPE "NONSTOP" -# define CPP_WORDSZ 32 -# define ALIGNMENT 4 -# define DATASTART ((ptr_t)0x08000000) - extern char **environ; -# define DATAEND ((ptr_t)(environ - 0x10)) -# define STACKBOTTOM ((ptr_t)0x4fffffff) # endif -# endif +# ifdef FREEBSD +# define ALIGNMENT 4 +# endif +# ifdef NONSTOP +# define OS_TYPE "NONSTOP" +# define CPP_WORDSZ 32 +# define ALIGNMENT 4 +# define DATASTART ((ptr_t)0x08000000) + extern char **environ; +# define DATAEND ((ptr_t)(environ - 0x10)) +# define STACKBOTTOM ((ptr_t)0x4fffffff) +# endif +# endif /* MIPS */ # ifdef NIOS2 # define MACH_TYPE "NIOS2" @@ -1919,7 +1919,7 @@ EXTERN_C_BEGIN /* Probably breaks if putenv is called before collector */ /* initialization. */ # define STACKBOTTOM ((ptr_t)(((word)(environ) | (getpagesize()-1))+1)) -/* # define HEURISTIC2 */ +/* #define HEURISTIC2 */ /* Normally HEURISTIC2 is too conservative, since */ /* the text segment immediately follows the stack. */ /* Hence we give an upper pound. */ @@ -3071,8 +3071,8 @@ EXTERN_C_BEGIN #if !defined(USE_MARK_BITS) && !defined(USE_MARK_BYTES) \ && defined(PARALLEL_MARK) - /* Minimize compare-and-swap usage. */ -# define USE_MARK_BYTES + /* Minimize compare-and-swap usage. */ +# define USE_MARK_BYTES #endif #if (defined(MSWINCE) && !defined(__CEGCC__) || defined(MSWINRT_FLAVOR)) \ diff --git a/include/private/thread_local_alloc.h b/include/private/thread_local_alloc.h index fb79ae47..71dca571 100644 --- a/include/private/thread_local_alloc.h +++ b/include/private/thread_local_alloc.h @@ -75,7 +75,7 @@ EXTERN_C_BEGIN # define USE_COMPILER_TLS # endif # else -# define USE_CUSTOM_SPECIFIC /* Use our own. */ +# define USE_CUSTOM_SPECIFIC /* Use our own. */ # endif #endif @@ -428,7 +428,7 @@ GC_API GC_ATTR_MALLOC void * GC_CALL GC_malloc_uncollectable(size_t lb) #if defined(REDIRECT_MALLOC) && !defined(REDIRECT_MALLOC_IN_HEADER) # ifndef MSWINCE -# include <errno.h> +# include <errno.h> # endif /* Avoid unnecessary nested procedure calls here, by #defining some */ @@ -454,84 +454,83 @@ static void alloc_mark_stack(size_t); GC_INNER GC_bool GC_mark_some(ptr_t cold_gc_frame) { - GC_bool ret_val; + GC_bool ret_val; # if defined(MSWIN32) || defined(MSWINCE) -# ifndef __GNUC__ - /* Windows 98 appears to asynchronously create and remove */ - /* writable memory mappings, for reasons we haven't yet */ - /* understood. Since we look for writable regions to */ - /* determine the root set, we may try to mark from an */ - /* address range that disappeared since we started the */ - /* collection. Thus we have to recover from faults here. */ - /* This code does not appear to be necessary for Windows */ - /* 95/NT/2000+. Note that this code should never generate */ - /* an incremental GC write fault. */ - /* This code seems to be necessary for WinCE (at least in */ - /* the case we'd decide to add MEM_PRIVATE sections to */ - /* data roots in GC_register_dynamic_libraries()). */ - /* It's conceivable that this is the same issue with */ - /* terminating threads that we see with Linux and */ - /* USE_PROC_FOR_LIBRARIES. */ - - __try { +# ifndef __GNUC__ + /* Windows 98 appears to asynchronously create and remove */ + /* writable memory mappings, for reasons we haven't yet */ + /* understood. Since we look for writable regions to */ + /* determine the root set, we may try to mark from an */ + /* address range that disappeared since we started the */ + /* collection. Thus we have to recover from faults here. */ + /* This code does not appear to be necessary for Windows */ + /* 95/NT/2000+. Note that this code should never generate */ + /* an incremental GC write fault. */ + /* This code seems to be necessary for WinCE (at least in */ + /* the case we'd decide to add MEM_PRIVATE sections to */ + /* data roots in GC_register_dynamic_libraries()). */ + /* It's conceivable that this is the same issue with */ + /* terminating threads that we see with Linux and */ + /* USE_PROC_FOR_LIBRARIES. */ + + __try { ret_val = GC_mark_some_inner(cold_gc_frame); - } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? + } __except (GetExceptionCode() == EXCEPTION_ACCESS_VIOLATION ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { goto handle_ex; - } -# if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) - /* With DllMain-based thread tracking, a thread may have */ - /* started while we were marking. This is logically equivalent */ - /* to the exception case; our results are invalid and we have */ - /* to start over. This cannot be prevented since we can't */ - /* block in DllMain. */ - if (GC_started_thread_while_stopped()) - goto handle_thr_start; -# endif - rm_handler: - return ret_val; - -# else /* __GNUC__ */ + } +# if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) + /* With DllMain-based thread tracking, a thread may have */ + /* started while we were marking. This is logically */ + /* equivalent to the exception case; our results are */ + /* invalid and we have to start over. This cannot be */ + /* prevented since we can't block in DllMain. */ + if (GC_started_thread_while_stopped()) + goto handle_thr_start; +# endif + rm_handler: + return ret_val; - /* Manually install an exception handler since GCC does */ - /* not yet support Structured Exception Handling (SEH) on */ - /* Win32. */ +# else /* __GNUC__ */ - ext_ex_regn er; + /* Manually install an exception handler since GCC does */ + /* not yet support Structured Exception Handling (SEH) on */ + /* Win32. */ + ext_ex_regn er; -# if GC_GNUC_PREREQ(4, 7) || GC_CLANG_PREREQ(3, 3) -# pragma GCC diagnostic push - /* Suppress "taking the address of label is non-standard" warning. */ -# if defined(__clang__) || GC_GNUC_PREREQ(6, 0) -# pragma GCC diagnostic ignored "-Wpedantic" -# else - /* GCC before ~4.8 does not accept "-Wpedantic" quietly. */ -# pragma GCC diagnostic ignored "-pedantic" +# if GC_GNUC_PREREQ(4, 7) || GC_CLANG_PREREQ(3, 3) +# pragma GCC diagnostic push + /* Suppress "taking the address of label is non-standard" warning. */ +# if defined(__clang__) || GC_GNUC_PREREQ(6, 0) +# pragma GCC diagnostic ignored "-Wpedantic" +# else + /* GCC before ~4.8 does not accept "-Wpedantic" quietly. */ +# pragma GCC diagnostic ignored "-pedantic" +# endif + er.alt_path = &&handle_ex; +# pragma GCC diagnostic pop +# elif !defined(CPPCHECK) /* pragma diagnostic is not supported */ + er.alt_path = &&handle_ex; # endif - er.alt_path = &&handle_ex; -# pragma GCC diagnostic pop -# elif !defined(CPPCHECK) /* pragma diagnostic is not supported */ - er.alt_path = &&handle_ex; -# endif - er.ex_reg.handler = mark_ex_handler; - __asm__ __volatile__ ("movl %%fs:0, %0" : "=r" (er.ex_reg.prev)); - __asm__ __volatile__ ("movl %0, %%fs:0" : : "r" (&er)); - ret_val = GC_mark_some_inner(cold_gc_frame); - /* Prevent GCC from considering the following code unreachable */ - /* and thus eliminating it. */ + er.ex_reg.handler = mark_ex_handler; + __asm__ __volatile__ ("movl %%fs:0, %0" : "=r" (er.ex_reg.prev)); + __asm__ __volatile__ ("movl %0, %%fs:0" : : "r" (&er)); + ret_val = GC_mark_some_inner(cold_gc_frame); + /* Prevent GCC from considering the following code unreachable */ + /* and thus eliminating it. */ if (er.alt_path == 0) goto handle_ex; -# if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) - if (GC_started_thread_while_stopped()) - goto handle_thr_start; -# endif - rm_handler: - /* Uninstall the exception handler. */ - __asm__ __volatile__ ("mov %0, %%fs:0" : : "r" (er.ex_reg.prev)); - return ret_val; +# if defined(GC_WIN32_THREADS) && !defined(GC_PTHREADS) + if (GC_started_thread_while_stopped()) + goto handle_thr_start; +# endif + rm_handler: + /* Uninstall the exception handler. */ + __asm__ __volatile__ ("mov %0, %%fs:0" : : "r" (er.ex_reg.prev)); + return ret_val; +# endif /* __GNUC__ */ -# endif /* __GNUC__ */ # else /* !MSWIN32 */ /* Here we are handling the case in which /proc is used for root */ /* finding, and we have threads. We may find a stack for a */ @@ -1878,23 +1877,23 @@ STATIC void GC_push_marked(struct hblk *h, hdr *hhdr) switch(BYTES_TO_GRANULES(sz)) { # if defined(USE_PUSH_MARKED_ACCELERATORS) - case 1: - GC_push_marked1(h, hhdr); - break; -# if !defined(UNALIGNED_PTRS) - case 2: - GC_push_marked2(h, hhdr); - break; -# if GC_GRANULE_WORDS < 4 - case 4: - GC_push_marked4(h, hhdr); - break; -# endif -# endif + case 1: + GC_push_marked1(h, hhdr); + break; +# if !defined(UNALIGNED_PTRS) + case 2: + GC_push_marked2(h, hhdr); + break; +# if GC_GRANULE_WORDS < 4 + case 4: + GC_push_marked4(h, hhdr); + break; +# endif +# endif /* !UNALIGNED_PTRS */ # else - case 1: /* to suppress "switch statement contains no case" warning */ + case 1: /* to suppress "switch statement contains no case" warning */ # endif - default: + default: GC_mark_stack_top_reg = GC_mark_stack_top; for (p = h -> hb_body, bit_no = 0; (word)p <= (word)lim; p += sz, bit_no += MARK_BIT_OFFSET(sz)) { @@ -1924,18 +1924,18 @@ void GC_register_data_segments(void) /* heap sections? */ GC_INNER GC_bool GC_is_heap_base(void *p) { - int i; - -# if defined(USE_WINALLOC) && !defined(REDIRECT_MALLOC) - if (GC_root_size > GC_max_root_size) - GC_max_root_size = GC_root_size; - if (GC_is_malloc_heap_base(p)) - return TRUE; -# endif - for (i = 0; i < (int)GC_n_heap_bases; i++) { - if (GC_heap_bases[i] == p) return TRUE; - } - return FALSE; + int i; + +# if defined(USE_WINALLOC) && !defined(REDIRECT_MALLOC) + if (GC_root_size > GC_max_root_size) + GC_max_root_size = GC_root_size; + if (GC_is_malloc_heap_base(p)) + return TRUE; +# endif + for (i = 0; i < (int)GC_n_heap_bases; i++) { + if (GC_heap_bases[i] == p) return TRUE; + } + return FALSE; } #ifdef MSWIN32 @@ -2060,9 +2060,9 @@ void GC_register_data_segments(void) #ifdef AMIGA -# define GC_AMIGA_DS -# include "extra/AmigaOS.c" -# undef GC_AMIGA_DS +# define GC_AMIGA_DS +# include "extra/AmigaOS.c" +# undef GC_AMIGA_DS #elif defined(OPENBSD) @@ -4706,11 +4706,11 @@ GC_INNER GC_bool GC_dirty_init(void) if (r != KERN_SUCCESS) ABORT("mach_port_insert_right failed (exception port)"); -# if defined(THREADS) - r = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, &GC_ports.reply); - if(r != KERN_SUCCESS) - ABORT("mach_port_allocate failed (reply port)"); -# endif +# if defined(THREADS) + r = mach_port_allocate(me, MACH_PORT_RIGHT_RECEIVE, &GC_ports.reply); + if (r != KERN_SUCCESS) + ABORT("mach_port_allocate failed (reply port)"); +# endif /* The exceptions we want to catch */ mask = EXC_MASK_BAD_ACCESS; @@ -5027,11 +5027,11 @@ GC_API int GC_CALL GC_get_pages_executable(void) #endif #if defined(SPARC) -# if defined(LINUX) -# include <features.h> +# if defined(LINUX) +# include <features.h> # if defined(SAVE_CALL_CHAIN) - struct frame { + struct frame { long fr_local[8]; long fr_arg[6]; struct frame *fr_savfp; @@ -5041,30 +5041,28 @@ GC_API int GC_CALL GC_get_pages_executable(void) # endif long fr_argd[6]; long fr_argx[0]; - }; + }; # endif -# elif defined (DRSNX) -# include <sys/sparc/frame.h> -# elif defined(OPENBSD) -# include <frame.h> -# elif defined(FREEBSD) || defined(NETBSD) -# include <machine/frame.h> -# else -# include <sys/frame.h> -# endif -# if NARGS > 6 -# error We only know how to get the first 6 arguments -# endif +# elif defined (DRSNX) +# include <sys/sparc/frame.h> +# elif defined(OPENBSD) +# include <frame.h> +# elif defined(FREEBSD) || defined(NETBSD) +# include <machine/frame.h> +# else +# include <sys/frame.h> +# endif +# if NARGS > 6 +# error We only know how to get the first 6 arguments +# endif #endif /* SPARC */ #ifdef NEED_CALLINFO /* Fill in the pc and argument information for up to NFRAMES of my */ /* callers. Ignore my frame and my callers frame. */ - -#ifdef LINUX +# ifdef LINUX # include <unistd.h> -#endif - +# endif #endif /* NEED_CALLINFO */ #if defined(GC_HAVE_BUILTIN_BACKTRACE) @@ -5074,7 +5072,7 @@ GC_API int GC_CALL GC_get_pages_executable(void) char** backtrace_symbols(void* const addresses[], int count); EXTERN_C_END # else -# include <execinfo.h> +# include <execinfo.h> # endif #endif /* GC_HAVE_BUILTIN_BACKTRACE */ @@ -5129,17 +5127,17 @@ GC_INNER void GC_save_callers(struct callinfo info[NFRAMES]) #else /* No builtin backtrace; do it ourselves */ #if (defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD)) && defined(SPARC) -# define FR_SAVFP fr_fp -# define FR_SAVPC fr_pc +# define FR_SAVFP fr_fp +# define FR_SAVPC fr_pc #else -# define FR_SAVFP fr_savfp -# define FR_SAVPC fr_savpc +# define FR_SAVFP fr_savfp +# define FR_SAVPC fr_savpc #endif #if defined(SPARC) && (defined(__arch64__) || defined(__sparcv9)) -# define BIAS 2047 +# define BIAS 2047 #else -# define BIAS 0 +# define BIAS 0 #endif GC_INNER void GC_save_callers(struct callinfo info[NFRAMES]) @@ -160,22 +160,22 @@ void (GC_CALLBACK *GC_is_visible_print_proc)(void * p) = #ifndef THREADS /* Could p be a stack address? */ - STATIC GC_bool GC_on_stack(void *p) - { -# ifdef STACK_GROWS_DOWN - if ((word)p >= (word)GC_approx_sp() + STATIC GC_bool GC_on_stack(void *p) + { +# ifdef STACK_GROWS_DOWN + if ((word)p >= (word)GC_approx_sp() && (word)p < (word)GC_stackbottom) { - return(TRUE); - } -# else - if ((word)p <= (word)GC_approx_sp() + return(TRUE); + } +# else + if ((word)p <= (word)GC_approx_sp() && (word)p > (word)GC_stackbottom) { - return(TRUE); - } -# endif - return(FALSE); - } -#endif + return(TRUE); + } +# endif + return(FALSE); + } +#endif /* !THREADS */ /* Check that p is visible */ /* to the collector as a possibly pointer containing location. */ @@ -18,7 +18,7 @@ #include "private/gc_priv.h" #ifdef ENABLE_DISCLAIM -# include "gc/gc_disclaim.h" +# include "gc/gc_disclaim.h" #endif #include <stdio.h> diff --git a/tests/gctest.c b/tests/gctest.c index 5949494f..c0589e62 100644 --- a/tests/gctest.c +++ b/tests/gctest.c @@ -27,7 +27,7 @@ #if (defined(DBG_HDRS_ALL) || defined(MAKE_BACK_GRAPH)) \ && !defined(GC_DEBUG) && !defined(CPPCHECK) -# define GC_DEBUG +# define GC_DEBUG #endif #ifdef DEFAULT_VDB /* specified manually (e.g. passed to CFLAGS) */ @@ -169,9 +169,9 @@ #if defined(TEST_EXPLICIT_GC_INIT) || defined(AIX) || defined(CYGWIN32) \ || defined(DARWIN) || defined(HOST_ANDROID) \ || (defined(MSWINCE) && !defined(GC_WINMAIN_REDIRECT)) -# define GC_OPT_INIT GC_INIT() +# define GC_OPT_INIT GC_INIT() #else -# define GC_OPT_INIT /* empty */ +# define GC_OPT_INIT /* empty */ #endif #define INIT_FIND_LEAK \ @@ -641,7 +641,7 @@ void check_marks_int_list(sexpr x) AO_fetch_and_add1(&collectable_count); } # else -# define p_resumed NULL +# define p_resumed NULL # endif code = pthread_create(&t, NULL, tiny_reverse_test, (void*)p_resumed); if (code != 0) { @@ -1507,11 +1507,11 @@ void run_one_test(void) } } # ifndef ALL_INTERIOR_POINTERS -# if defined(POWERPC) - if (!TEST_FAIL_COUNT(1)) -# else - if (!TEST_FAIL_COUNT(GC_get_all_interior_pointers() ? 1 : 2)) -# endif +# if defined(POWERPC) + if (!TEST_FAIL_COUNT(1)) +# else + if (!TEST_FAIL_COUNT(GC_get_all_interior_pointers() ? 1 : 2)) +# endif { GC_printf( "GC_is_valid_displacement produced wrong failure indication\n"); @@ -2065,81 +2065,81 @@ void enable_incremental_mode(void) # endif # if defined(CPPCHECK) /* Entry points we should be testing, but aren't. */ -# ifndef GC_DEBUG - UNTESTED(GC_debug_generic_or_special_malloc); - UNTESTED(GC_debug_register_displacement); - UNTESTED(GC_post_incr); - UNTESTED(GC_pre_incr); -# ifdef GC_GCJ_SUPPORT - UNTESTED(GC_debug_gcj_malloc); -# endif -# endif -# ifdef AMIGA -# ifdef GC_AMIGA_FASTALLOC - UNTESTED(GC_amiga_get_mem); -# endif -# ifndef GC_AMIGA_ONLYFAST - UNTESTED(GC_amiga_set_toany); -# endif -# endif -# if defined(MACOS) && defined(USE_TEMPORARY_MEMORY) - UNTESTED(GC_MacTemporaryNewPtr); -# endif - UNTESTED(GC_abort_on_oom); - UNTESTED(GC_malloc_explicitly_typed_ignore_off_page); - UNTESTED(GC_debug_strndup); - UNTESTED(GC_deinit); - UNTESTED(GC_strndup); - UNTESTED(GC_posix_memalign); - UNTESTED(GC_new_proc); - UNTESTED(GC_clear_roots); - UNTESTED(GC_exclude_static_roots); - UNTESTED(GC_register_describe_type_fn); - UNTESTED(GC_register_has_static_roots_callback); -# ifdef GC_GCJ_SUPPORT - UNTESTED(GC_gcj_malloc_ignore_off_page); -# endif -# ifndef NO_DEBUGGING - UNTESTED(GC_dump); - UNTESTED(GC_dump_regions); - UNTESTED(GC_is_tmp_root); - UNTESTED(GC_print_free_list); -# endif -# ifdef TRACE_BUF - UNTESTED(GC_print_trace); -# endif -# ifndef GC_NO_FINALIZATION - UNTESTED(GC_debug_register_finalizer_unreachable); - UNTESTED(GC_register_disappearing_link); - UNTESTED(GC_should_invoke_finalizers); -# ifndef JAVA_FINALIZATION_NOT_NEEDED - UNTESTED(GC_finalize_all); -# endif -# ifndef GC_TOGGLE_REFS_NOT_NEEDED - UNTESTED(GC_toggleref_add); -# endif -# endif -# if !defined(OS2) && !defined(MACOS) && !defined(GC_ANDROID_LOG) \ - && !defined(MSWIN32) && !defined(MSWINCE) - UNTESTED(GC_set_log_fd); -# endif -# ifndef REDIRECT_MALLOC_IN_HEADER -# ifdef REDIRECT_MALLOC -# ifndef strndup - UNTESTED(strndup); -# endif -# ifndef strdup - UNTESTED(strdup); -# endif -# endif -# ifdef REDIRECT_REALLOC - UNTESTED(realloc); -# endif -# endif /* !REDIRECT_MALLOC_IN_HEADER */ -# ifdef GC_REQUIRE_WCSDUP - UNTESTED(GC_wcsdup); - UNTESTED(GC_debug_wcsdup); -# endif +# ifndef GC_DEBUG + UNTESTED(GC_debug_generic_or_special_malloc); + UNTESTED(GC_debug_register_displacement); + UNTESTED(GC_post_incr); + UNTESTED(GC_pre_incr); +# ifdef GC_GCJ_SUPPORT + UNTESTED(GC_debug_gcj_malloc); +# endif +# endif +# ifdef AMIGA +# ifdef GC_AMIGA_FASTALLOC + UNTESTED(GC_amiga_get_mem); +# endif +# ifndef GC_AMIGA_ONLYFAST + UNTESTED(GC_amiga_set_toany); +# endif +# endif +# if defined(MACOS) && defined(USE_TEMPORARY_MEMORY) + UNTESTED(GC_MacTemporaryNewPtr); +# endif + UNTESTED(GC_abort_on_oom); + UNTESTED(GC_malloc_explicitly_typed_ignore_off_page); + UNTESTED(GC_debug_strndup); + UNTESTED(GC_deinit); + UNTESTED(GC_strndup); + UNTESTED(GC_posix_memalign); + UNTESTED(GC_new_proc); + UNTESTED(GC_clear_roots); + UNTESTED(GC_exclude_static_roots); + UNTESTED(GC_register_describe_type_fn); + UNTESTED(GC_register_has_static_roots_callback); +# ifdef GC_GCJ_SUPPORT + UNTESTED(GC_gcj_malloc_ignore_off_page); +# endif +# ifndef NO_DEBUGGING + UNTESTED(GC_dump); + UNTESTED(GC_dump_regions); + UNTESTED(GC_is_tmp_root); + UNTESTED(GC_print_free_list); +# endif +# ifdef TRACE_BUF + UNTESTED(GC_print_trace); +# endif +# ifndef GC_NO_FINALIZATION + UNTESTED(GC_debug_register_finalizer_unreachable); + UNTESTED(GC_register_disappearing_link); + UNTESTED(GC_should_invoke_finalizers); +# ifndef JAVA_FINALIZATION_NOT_NEEDED + UNTESTED(GC_finalize_all); +# endif +# ifndef GC_TOGGLE_REFS_NOT_NEEDED + UNTESTED(GC_toggleref_add); +# endif +# endif +# if !defined(OS2) && !defined(MACOS) && !defined(GC_ANDROID_LOG) \ + && !defined(MSWIN32) && !defined(MSWINCE) + UNTESTED(GC_set_log_fd); +# endif +# ifndef REDIRECT_MALLOC_IN_HEADER +# ifdef REDIRECT_MALLOC +# ifndef strndup + UNTESTED(strndup); +# endif +# ifndef strdup + UNTESTED(strdup); +# endif +# endif +# ifdef REDIRECT_REALLOC + UNTESTED(realloc); +# endif +# endif /* !REDIRECT_MALLOC_IN_HEADER */ +# ifdef GC_REQUIRE_WCSDUP + UNTESTED(GC_wcsdup); + UNTESTED(GC_debug_wcsdup); +# endif # endif # if defined(MSWIN32) || defined(MSWINCE) || defined(CYGWIN32) GC_win32_free_heap(); @@ -2365,7 +2365,7 @@ void * thr_run_one_test(void * arg GC_ATTR_UNUSED) } #ifdef GC_DEBUG -# define GC_free GC_debug_free +# define GC_free GC_debug_free #endif int main(void) diff --git a/tools/threadlibs.c b/tools/threadlibs.c index 832b3d13..ddc9da2b 100644 --- a/tools/threadlibs.c +++ b/tools/threadlibs.c @@ -63,12 +63,12 @@ int main(void) printf("-lpthread\n"); # endif # if defined(GC_WIN32_PTHREADS) -# ifdef PTW32_STATIC_LIB - /* assume suffix s for static version of the win32 pthread library */ - printf("-lpthreadGC2s -lws2_32\n"); -# else - printf("-lpthreadGC2\n"); -# endif +# ifdef PTW32_STATIC_LIB + /* assume suffix s for static version of the win32 pthread library */ + printf("-lpthreadGC2s -lws2_32\n"); +# else + printf("-lpthreadGC2\n"); +# endif # endif # if defined(GC_OSF1_THREADS) printf("-pthread -lrt\n"); /* DOB: must be -pthread, not -lpthread */ |