From aceb12679057abd0e15b7fa3fce8539cda36d2d2 Mon Sep 17 00:00:00 2001 From: hboehm Date: Sat, 17 Dec 2005 01:24:28 +0000 Subject: [PATCH] 2005-12-16 Hans Boehm - Changed a test for LINUX in config_macros.h to one for __linux__. - Use #elif in the definitions of GET_MEM. - Fix typo in DARWIN section of gcconfig.h. --- doc/README.changes | 4 +++ include/gc_config_macros.h | 2 +- include/private/gcconfig.h | 70 +++++++++++++++++++--------------------------- 3 files changed, 33 insertions(+), 43 deletions(-) diff --git a/doc/README.changes b/doc/README.changes index 2d01b02..8a9b2af 100644 --- a/doc/README.changes +++ b/doc/README.changes @@ -2254,6 +2254,7 @@ Since 6.6: his fault.) - Remove spurious gc:: qualifier for operator delete[] in gc_cpp.h. (Thanks to Hanno Boeck.) + - Changed a test for LINUX in config_macros.h to one for __linux__. Since gc6.7: - Remove GC_PROTO, VOLATILE, GC_PTR, and GC_CONST. Assume ANSI C compiler @@ -2445,6 +2446,9 @@ Since gc7.0alpha5 - Add --enable-large-config, which just defines the LARGE_CONFIG macro. - Make GlobalAlloc address alignment a bit more intuitive. (Thanks to Charles Mills.) + - Use #elif in the definitions of GET_MEM. + - Overhaul porting.html. Remove corresponding text from README. + - Fix typo in DARWIN section of gcconfig.h. To do: - REDIRECT_MALLOC and threads combination is getting closer, but currently diff --git a/include/gc_config_macros.h b/include/gc_config_macros.h index f3b5ef4..2b8ced7 100644 --- a/include/gc_config_macros.h +++ b/include/gc_config_macros.h @@ -65,7 +65,7 @@ # define GC_LINUX_THREADS # define GC_PTHREADS # endif -# if !defined(LINUX) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ +# if !defined(__linux__) && (defined(_PA_RISC1_1) || defined(_PA_RISC2_0) \ || defined(hppa) || defined(__HPPA)) # define GC_HPUX_THREADS # define GC_PTHREADS diff --git a/include/private/gcconfig.h b/include/private/gcconfig.h index f16252b..5d66b0a 100644 --- a/include/private/gcconfig.h +++ b/include/private/gcconfig.h @@ -699,7 +699,7 @@ # endif # if defined(POWERPC) -# defined MACH_TYPE "POWERPC" +# define MACH_TYPE "POWERPC" # ifdef MACOS # define ALIGNMENT 2 /* Still necessary? Could it be 4? */ # ifndef __LOWMEM__ @@ -2116,58 +2116,44 @@ /* though we should perhaps take advantage of the case in which */ /* does. */ struct hblk; /* See gc_priv.h. */ -# ifdef PCR - char * real_malloc(); +# if defined(PCR) + char * real_malloc(); # define GET_MEM(bytes) HBLKPTR(real_malloc((size_t)bytes + GC_page_size) \ + GC_page_size-1) -# else -# ifdef OS2 - void * os2_alloc(size_t bytes); -# define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \ +# elif defined(OS2) + void * os2_alloc(size_t bytes); +# define GET_MEM(bytes) HBLKPTR((ptr_t)os2_alloc((size_t)bytes \ + GC_page_size) \ + GC_page_size-1) -# else -# if defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \ +# elif defined(NEXT) || defined(DOS4GW) || defined(NONSTOP) || \ (defined(AMIGA) && !defined(GC_AMIGA_FASTALLOC)) || \ (defined(SUNOS5) && !defined(USE_MMAP)) -# define GET_MEM(bytes) HBLKPTR((size_t) \ - calloc(1, (size_t)bytes + GC_page_size) \ - + GC_page_size-1) -# else -# ifdef MSWIN32 - extern ptr_t GC_win32_get_mem(); -# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes) -# else -# ifdef MACOS -# if defined(USE_TEMPORARY_MEMORY) - extern Ptr GC_MacTemporaryNewPtr(size_t size, - Boolean clearMemory); -# define GET_MEM(bytes) HBLKPTR( \ +# define GET_MEM(bytes) HBLKPTR((size_t) calloc(1, (size_t)bytes + GC_page_size) \ + + GC_page_size-1) +# elif defined(MSWIN32) + extern ptr_t GC_win32_get_mem(); +# define GET_MEM(bytes) (struct hblk *)GC_win32_get_mem(bytes) +# elif defined(MACOS) +# if defined(USE_TEMPORARY_MEMORY) + extern Ptr GC_MacTemporaryNewPtr(size_t size, Boolean clearMemory); +# define GET_MEM(bytes) HBLKPTR( \ GC_MacTemporaryNewPtr(bytes + GC_page_size, true) \ + GC_page_size-1) -# else -# define GET_MEM(bytes) HBLKPTR( \ +# else +# define GET_MEM(bytes) HBLKPTR( \ NewPtrClear(bytes + GC_page_size) + GC_page_size-1) -# endif -# else -# ifdef MSWINCE - extern ptr_t GC_wince_get_mem(); -# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) -# else -# if defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) - extern void *GC_amiga_get_mem(size_t size); -# define GET_MEM(bytes) HBLKPTR((size_t) \ +# endif +# elif defined(MSWINCE) + extern ptr_t GC_wince_get_mem(); +# define GET_MEM(bytes) (struct hblk *)GC_wince_get_mem(bytes) +# elif defined(AMIGA) && defined(GC_AMIGA_FASTALLOC) + extern void *GC_amiga_get_mem(size_t size); +# define GET_MEM(bytes) HBLKPTR((size_t) \ GC_amiga_get_mem((size_t)bytes + GC_page_size) \ + GC_page_size-1) -# else - extern ptr_t GC_unix_get_mem(); -# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) -# endif -# endif -# endif -# endif -# endif -# endif +# else + extern ptr_t GC_unix_get_mem(); +# define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) # endif #endif /* GC_PRIVATE_H */ -- 2.7.4