Ivan Maidanski [Sat, 6 Jul 2019 05:57:41 +0000 (08:57 +0300)]
Support enable_werror option in CMake script
Issue #281 (bdwgc).
* CMakeLists.txt (enable_werror): New option (OFF by default).
* CMakeLists.txt: Specify add_compile_options to report all warnings;
add TODO about pedantic.
* CMakeLists.txt [enable_werror]: Specify add_compile_options to treat
all warnings as errors.
* CMakeLists.txt [enable_werror && APPLE]: Specify add_compile_options
to ignore deprecated declarations, e.g.
_dyld_bind_fully_image_containing_address.
Ivan R [Fri, 14 Jun 2019 09:24:47 +0000 (11:24 +0200)]
Fix 'ISO C++17 does not allow dynamic exception spec' clang-8 error
Issue #287 (bdwgc).
Before this patch, clang 8 (and -std=c++1z) fails for gc_cpp.cc.
The error message produced is: ISO C++17 does not allow dynamic
exception specifications.
The "dynamic exception" syntax was declared deprecated in C++11 and
removed in C++17.
Ivan Maidanski [Fri, 21 Jun 2019 20:47:47 +0000 (23:47 +0300)]
Fix 'while clause does not guard' GCC warning in GC_parse_map_entry
* os_dep.c [DYNAMIC_LOADING && USE_PROC_FOR_LIBRARIES || IA64
|| INCLUDE_LINUX_THREAD_DESCR || REDIRECT_MALLOC] (GC_parse_map_entry):
Fix "while" statements indentation; place just one "while" statement on
a line.
Ivan Maidanski [Fri, 21 Jun 2019 20:33:32 +0000 (23:33 +0300)]
Fix fread failure after enable_incremental if malloc is redirected (Linux)
The failure is observed in cord refill_cache() executed by cordtest,
fread() fails with EFAULT. The fix is to disable MPROTECT_VDB on Linux
when REDIRECT_MALLOC is defined.
* include/private/gcconfig.h [(M68K || I386 || ALPHA || IA64 || AARCH64
|| ARM32 || X86_64 || HEXAGON) && LINUX] (MPROTECT_VDB): Do not define
if REDIRECT_MALLOC.
Ivan Maidanski [Fri, 21 Jun 2019 09:24:26 +0000 (12:24 +0300)]
Do not use Manual VDB mode if C malloc is redirected
(fix of commit 06009b0a0)
* misc.c [!GC_DISABLE_INCREMENTAL && (REDIRECT_MALLOC
|| REDIRECT_MALLOC_IN_HEADER)] (GC_init, GC_enable_incremental):
Do not set GC_manual_vdb to true.
Ivan Maidanski [Tue, 18 Jun 2019 08:46:32 +0000 (11:46 +0300)]
Build gc as a shared library by default (CMake)
Issue #281 (bdwgc).
* CMakeLists.txt (BUILD_SHARED_LIBS): Document option and set default to ON.
* CMakeLists.txt: Remove commented out ADD_LIBRARY for atomic_ops.
* CMakeLists.txt [BUILD_SHARED_LIBS] (SRC): Override to extra/gc.c.
* CMakeLists.txt [BUILD_SHARED_LIBS] (GC_DLL): Define macro.
* CMakeLists.txt [!BUILD_SHARED_LIBS] (GC_NOT_DLL): Define macro not only
for tests but also for gc library.
* CMakeLists.txt (gc): Remove STATIC in add_library specification.
Ivan Maidanski [Fri, 14 Jun 2019 07:12:47 +0000 (10:12 +0300)]
Restrict CMake project to C-only language unless enable_cplusplus
Issue #281 (bdwgc).
* CMakeLists.txt (enable_cplusplus): Move option to above project
command.
* CMakeLists.txt [!enable_cplusplus] (project): Specify C as the only
project language.
Maya Rashish [Thu, 6 Jun 2019 02:43:51 +0000 (05:43 +0300)]
Get rid of some non-ELF ifdefs
(code refactoring)
Issue #283 (bdwgc).
Linux started switching to ELF in 1995 (Linux-2.0), due to the previous
a.out being really bad.
NetBSD has used ELF since 2002 (NetBSD 1.6), it's OK to let it go now.
FreeBSD switched to ELF in FreeBSD 3.0 (1998).
Victor Romero [Thu, 6 Jun 2019 07:24:28 +0000 (10:24 +0300)]
Do not build the tests by default (CMake)
Issue #281 (bdwgc).
build_cord and build_tests options are introduced in the CMake script.
* CMakeLists.txt (build_cord): Add option (on by default); add comment.
* CMakeLists.txt (build_tests): Add option (off by default).
* CMakeLists.txt (cord): Specify add_subdirectory only if build_cord.
* CMakeLists.txt (tests): Specify add_subdirectory only if build_tests.
* cord/CMakeLists.txt: Skip cordtest and de tests unless build_tests.
Ivan Maidanski [Wed, 5 Jun 2019 06:53:15 +0000 (09:53 +0300)]
Turn off C++ API in CMake script by default
Issue #281 (bdwgc).
This is to match the behavior of configure script.
Now, -Denable_cplusplus=ON should be passed to cmake to enable C++ API.
* CMakeLists.txt (enable_cplusplus): Add option (off by default);
remove TODO.
* CMakeLists.txt (SRC): Add gc_cpp.cc only if enable_cplusplus.
* tests/CMakeLists.txt (leak_test.c, test.c): Set CXX langunage
property only if enable_cplusplus.
* tests/CMakeLists.txt [enable_cplusplus]: Add TODO to add test_cpp as
a test.
Ivan Maidanski [Thu, 30 May 2019 20:57:46 +0000 (23:57 +0300)]
Fix 'GC_old_bus_handler defined but not used' compiler warning
* os_dep.c [!DARWIN && !MSWIN32 && !MSWINCE] (GC_old_bus_handler):
Define variable only if FREEBSD or HPUX, or HURD, or LINUX.
* os_dep.c [!DARWIN && !MSWIN32 && !MSWINCE && (HPUX || HURD
|| FREEBSD)] (GC_dirty_init): Do not set GC_old_bus_handler_used_si
to FALSE (because it is already initialized to FALSE).
Ivan Maidanski [Wed, 29 May 2019 08:16:04 +0000 (11:16 +0300)]
Fix 'unused function GC_lock' compiler warning
* include/private/gc_locks.h [GC_PTHREADS && !USE_SPIN_LOCK] (GC_lock):
Declare only if USE_PTHREAD_LOCKS and (GC_ASSERTIONS or
not NO_PTHREAD_TRYLOCK).
* pthread_support.c [!USE_SPIN_LOCK] (GC_lock): Define only if
USE_PTHREAD_LOCKS and (not NO_PTHREAD_TRYLOCK or GC_ASSERTIONS).
Ivan Maidanski [Mon, 27 May 2019 19:00:59 +0000 (22:00 +0300)]
Use lowercase naming of commands in CMake scripts
(code refactoring)
* CMakeLists.txt: Convert all commands from uppercase to lowercase.
* tests/CMakeLists.txt: Likewise.
* CMakeLists.txt: Reformat the whole file (indent is 2 spaces).
Ivan Maidanski [Mon, 29 Apr 2019 06:44:42 +0000 (09:44 +0300)]
Fix first_thread stack_base initialzation if custom GC_stackbottom (Win32)
Stack bottom value of the primordial thread should be obtained from
GC_stackbottom.
* win32_threads.c [GC_ASSERTIONS] (GC_thr_init): Remove sb_result local
variable.
* win32_threads.c (GC_thr_init): Initalize sb mem_base and reg_base
fields with GC_stackbottom and GC_register_stackbottom, respectively;
do not call GC_get_stack_base().
Ivan Maidanski [Fri, 26 Apr 2019 16:03:42 +0000 (19:03 +0300)]
Replace 'stack base' with 'stack bottom' in the documentation
* README.md (The C Interface to the Allocator): Outline that stack base
means its bottom; remove a note that client should set GC_stackbottom
on HP PA machines manually.
* doc/README.macros (USE_GET_STACKBASE_FOR_MAIN): Rename "stack base"
to "stack bottom".
* doc/porting.md (Adding Platforms to gcconfig.h): Likewise.
* doc/porting.md (Adding Platforms to gcconfig.h): Rename
"cool end of the stack" to "cold end of the stack"; refine
documentation about STACKBOTTOM.
* include/private/gcconfig.h (STACKBOTTOM): Rename "cool end" to
"cold end" in comment.
* include/gc.h (GC_stackbottom): Likewise.
* include/private/gcconfig.h (LINUX_STACKBOTTOM): Rename "stack base"
to "stack bottom" in comment.
* include/gc.h (GC_stack_base, GC_call_with_stack_base): Likewise.
* include/gc.h [GC_THREADS] (GC_register_my_thread): Likewise.
* misc.c [!THREADS] (GC_call_with_gc_active): Likewise.
* os_dep.c [LINUX_STACKBOTTOM] (GC_linux_main_stack_base): Likewise.
* os_dep.c (GC_get_stack_base): Likewise.
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_call_with_gc_active): Likewise.
Ivan Maidanski [Thu, 25 Apr 2019 07:28:40 +0000 (10:28 +0300)]
Refine do_blocking() documentation in gc.h
* include/gc.h (GC_do_blocking): Refine comment (copy part of comment
from misc.c, add information that GC should be initialized and the
current thread should be registered).
* misc.c (GC_do_blocking): Remove title comment (as it duplicates the
one in gc.h).
Ivan Maidanski [Thu, 25 Apr 2019 06:54:13 +0000 (09:54 +0300)]
Check real-symbols are already initialized in pthread_join/detach
* pthread_support.c (ASSERT_SYMS_INITIALIZED): New macro (checks either
GC_syms_initialized or parallel_initialized depending on
GC_USE_DLOPEN_WRAP).
* pthread_support.c [!SN_TARGET_ORBIS && !SN_TARGET_PSP2] (pthread_join,
pthread_detach): Call ASSERT_SYMS_INITIALIZED() instead of
INIT_REAL_SYMS().