Ivan Maidanski [Thu, 22 Aug 2019 20:30:34 +0000 (23:30 +0300)]
Refactoring of CMake script to use ANDROID/APPLE/CYGWIN/MSYS variables
* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT]: Replace
"HOST MATCHES .*-.*-android.*", "HOST MATCHES .*-.*-cygwin.*",
"HOST MATCHES .*-.*-darwin.*", "HOST MATCHES .*-.*-msys.*" with
ANDROID, CYGWIN, APPLE and MSYS variables, respectively; add comment
that ANDROID is defined only starting from cmake-3.7.0; remove
commented out darwin_threads variable assignment.
Ivan Maidanski [Wed, 21 Aug 2019 21:48:30 +0000 (00:48 +0300)]
Fix HOST determination in CMake script
As per the configure script, HOST variable value should identify the
target, not build host.
* CMakeLists.txt (HOST): Set variable before find_package(Threads);
change message type to STATUS; report ${HOST} value as "TARGET".
* CMakeLists.txt (_HOST): Use CMAKE_SYSTEM_PROCESSOR instead
of CMAKE_HOST_SYSTEM_PROCESSOR; specify vendor as "unknown" (instead
of empty string); remove FIXME.
Ivan Maidanski [Wed, 21 Aug 2019 08:31:52 +0000 (11:31 +0300)]
Fix subexpression widening in memhash() of disclaim_weakmap_test
(fix of commit 0cc2c0e7e)
It would be more correct to widen the argument (from unsigned to
GC_word) of multiply operation instead of implicit widening of the
result.
* tests/disclaim_weakmap_test.c (memhash): Cast acc to GC_word before
multiplying by 2003; cast the whole expression to unsigned type (before
assigning it to acc).
Ivan Maidanski [Fri, 2 Aug 2019 18:21:59 +0000 (21:21 +0300)]
Fix 'wrong finalization data' gctest failure on Windows
(fix of commit aefc738c1)
Issue #289 (bdwgc).
This commit workarounds some bug in MS compiler for x86 (v19.10.25017,
as of now) which causes generation of an incorrect code for
GC_normal_finalize_mark_proc() if code optimizations are on.
Ivan Maidanski [Tue, 30 Jul 2019 23:01:57 +0000 (02:01 +0300)]
Fix passing CFLAGS_EXTRA to compiler in CMake script
(fix of commit b6ac6a5a4)
The previous solution does not work for MS VC target.
* CMakeLists.txt [CFLAGS_EXTRA] (CMAKE_C_FLAGS, CMAKE_CXX_FLAGS): Do
not set.
* CMakeLists.txt [CFLAGS_EXTRA]: Pass $(CFLAGS_EXTRA) to
add_compile_options.
Ivan Maidanski [Fri, 26 Jul 2019 18:24:18 +0000 (21:24 +0300)]
Pass -D GC_DLL -fvisibility=hidden if default configure build is requested
(fix of commit c9964cfc0)
If --disable-shared and --enable-static are not passed to configure
then build generates only shared libraries, thus the internal symbols
visibility could be restricted.
Ivan Maidanski [Wed, 24 Jul 2019 21:55:22 +0000 (00:55 +0300)]
Compile gc.c unless building static libraries (NT_MAKEFILE, WCC_MAKEFILE)
This is to match the behavior of CMake and configure scripts.
* NT_MAKEFILE [!ENABLE_STATIC] (OBJS): Set to extra\gc.obj,
extra\msvc_dbg.obj.
* WCC_MAKEFILE (OBJS): Define only if ENABLE_STATIC.
* WCC_MAKEFILE [!ENABLE_STATIC] (gc.obj): New target.
* WCC_MAKEFILE [!ENABLE_STATIC] (gc.dll): Depend on and append gc.obj
instead of $(OBJS) elements.
Ivan Maidanski [Fri, 19 Jul 2019 17:42:38 +0000 (20:42 +0300)]
Build gccpp library by Makefile.direct, NT_MAKEFILE and WCC_MAKEFILE
* Makefile.direct: Update header comment about all, gc.a (base_lib),
c++, check, check-cpp targets.
* Makefile.direct (CXX): Refine comment.
* Makefile.direct (all): Depend also on c++.
* Makefile.direct (bsd-libgccpp.a): New target (duplicates bsd-libgc.a
one).
* Makefile.direct (bsd-libgc.a): Add a rename of gccpp.a to
bsd-libgccpp.a.
* Makefile.direct (BSD-pkg-install): Copy bsd-libgccpp.a file to
libgccpp.a, install the latter one.
* Makefile.direct (test_cpp): Depend on c++ instead of gc_cpp.o; pass
gccpp.a (instead of gc_cpp.o) to $(CXX).
* Makefile.direct (gccpp.a): New target (duplicates c++ one).
* Makefile.direct (c++): Do not depend on gc_cpp.h and base_lib;
create gccpp.a instead of updating gc.a.
* Makefile.direct (clean): Delete *.a files instead of gc.a.
* Makefile.direct (check): Depend also on test_cpp$(EXEEXT); run also
test_cpp.
* NT_MAKEFILE (LINK_GC, LINK_DLL_FLAGS): Remove variable.
* NT_MAKEFILE (OBJS): Remove gc_cpp.obj.
* NT_MAKEFILE (all, test_cpp.exe): Depend also on gccpp.lib.
* WCC_MAKEFILE (all, test_cpp.exe): Likewise.
* NT_MAKEFILE (gccpp.lib): New target (depending on gc_cpp.obj).
* WCC_MAKEFILE (gccpp.lib): Likewise.
* WCC_MAKEFILE [MAKE_AS_DLL] (gccpp.dll): Likewise.
* NT_MAKEFILE (test_cpp.exe): Pass gccpp.lib to $(link).
* WCC_MAKEFILE [MAKE_AS_LIB] (MAKE_AS_LIB): Set to -DGC_NOT_DLL.
* WCC_MAKEFILE (gc.lib): Do not depend gc_cpp.obj.
* WCC_MAKEFILE [MAKE_AS_DLL] (gc.lib): Do not add gc_cpp.obj to gc.lib.
* WCC_MAKEFILE [MAKE_AS_DLL] (gc.dll): Specify "op case".
Ivan Maidanski [Wed, 17 Jul 2019 08:52:26 +0000 (11:52 +0300)]
Update README.cmake regarding Unix, C++ and tests
Issue #105 (bdwgc).
* doc/README.cmake: Mention that Unix targets are also supported;
remove not that support is not yet complete; update the list of
supported targets (that CMake is able to generate for); use Visual
Studio 9 instead of Visual Studio 8 in the examples; document
enable_cplusplus and build_tests options; provide an example with
--config option; change "build" artifacts folder to "out" one in
the example.
Ivan Maidanski [Wed, 17 Jul 2019 08:39:26 +0000 (11:39 +0300)]
Remove gc.mak script (MS VC)
Issue #105 (bdwgc).
CMake script or NT_MAKEFILE should be used instead of gc.mak.
* ChangeLog (8.1.0): Remove item about gc.mak.
* Makefile.am (EXTRA_DIST): Remove gc.mak.
* gc.mak: Remove file.
* doc/README.win32 (Threads): Remove gc.mak usage information; mention
that CMake script is the preferred way of building for Windows.
Ivan Maidanski [Sun, 7 Jul 2019 12:56:12 +0000 (15:56 +0300)]
Do not build tests by default (Makefile.direct and other Makefiles)
This is to match the behavior of configure-based Makefile and the
CMake script. Tests are built and executed now by `make check`.
* BCC_MAKEFILE (all): Depend on gc.lib only (instead of gctest, de
and test_cpp).
* OS2_MAKEFILE (all): Likewise.
* BCC_MAKEFILE (check): New target to build and run the tests (de is
not executed).
* NT_MAKEFILE (check): Likewise.
* Makefile.direct (all): Remove dependency on gctest.
* NT_MAKEFILE (all): Remove dependency on gctest, de and test_cpp; add
dependency on gc.lib.
* OS2_MAKEFILE (check): New target to build and run gctest and
cordtest.
* README.QUICK (INSTALLATION): Change "make test" to "make check".
* README.md (Installation and Portability): Likewise.
* doc/README.arm.cross: Likewise.
* SMakefile.amiga (all): Depend on gc.lib and cord.lib only (instead
of gctest, setjmp_t, cordtest).
* SMakefile.amiga (test): Rename to "check".
* WCC_MAKEFILE (all): Remove dependency on gctest and test_cpp.
* digimars.mak (targets): Likewise.
* WCC_MAKEFILE (check): New symbolic target to build and run gctest
and test_cpp.
* digimars.mak (check): Likewise.
* digimars.mak (gc.lib): New target (depend on gc.dll target).
* doc/README.win32 (Watcom compiler): Remove information that wmake
compiles the tests by default.
* doc/README.win64: Update information about tests building.
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.