platform/upstream/libgc.git
7 years agoTravis CI: Also test with musl-gcc (Linux)
Ivan Maidanski [Mon, 27 Mar 2017 22:07:10 +0000 (01:07 +0300)]
Travis CI: Also test with musl-gcc (Linux)

7 years agoTravis CI: Run CSA for a 32-bit target on OS X
Ivan Maidanski [Mon, 27 Mar 2017 21:46:20 +0000 (00:46 +0300)]
Travis CI: Run CSA for a 32-bit target on OS X
(fix commits 369d606, e72a7bc)

Note: both C and C++ code is checked (regardless of --enable-cplusplus).

7 years agoTravis CI: Test builds with -D LINT2 without -D CPPCHECK
Ivan Maidanski [Mon, 27 Mar 2017 21:38:01 +0000 (00:38 +0300)]
Travis CI: Test builds with -D LINT2 without -D CPPCHECK

7 years agoTravis CI: Use CSA v4.0 (clang-4.0)
Ivan Maidanski [Mon, 27 Mar 2017 07:44:03 +0000 (10:44 +0300)]
Travis CI: Use CSA v4.0 (clang-4.0)

7 years agoTravis CI: Install gcc-multilib for CSA check with '-m32' option
Ivan Maidanski [Mon, 27 Mar 2017 07:31:55 +0000 (10:31 +0300)]
Travis CI: Install gcc-multilib for CSA check with '-m32' option
(fix commit 369d606)

7 years agoTravis CI: Run CSA once per build configuration
Ivan Maidanski [Fri, 24 Mar 2017 16:56:37 +0000 (19:56 +0300)]
Travis CI: Run CSA once per build configuration
(refactoring of commit 3663fd5)

7 years agoTravis CI: Specify test configurations using 'matrix:include'
Ivan Maidanski [Fri, 24 Mar 2017 15:34:09 +0000 (18:34 +0300)]
Travis CI: Specify test configurations using 'matrix:include'
(code refactoring)

Also, require "sudo" only where needed.

7 years agoUse __int64 instead of 'long long' in LONG_MULT if appropriate
Ivan Maidanski [Thu, 23 Mar 2017 22:20:55 +0000 (01:20 +0300)]
Use __int64 instead of 'long long' in LONG_MULT if appropriate

* include/private/gc_pmark.h [!I386 || !__GNUC__ || NACL] (ULONG_MULT_T):
Define new private macro (to unsigned __int64 or unsigned long long).
* include/private/gc_pmark.h [!I386 || !__GNUC__ || NACL] (LONG_MULT):
Use ULONG_MULT_T instead of unsigned long long.

7 years agoFix finalize.c compilation in 'strict ANSI' mode
Ivan Maidanski [Thu, 23 Mar 2017 20:12:07 +0000 (23:12 +0300)]
Fix finalize.c compilation in 'strict ANSI' mode

This and some other GC .c files include gc_pmark.h directly (not
gc_priv.h), so the compiler complains that sigset_t (used in
gc_pthread_redirects.h) is undefined if 'strict ANSI' mode is on and
_GNU_SOURCE is not defined before including system headers.

* include/private/gc_pmark.h [(__linux__ || __GLIBC__ || __GNU__)
&& GC_PTHREADS && !GC_NO_PTHREAD_SIGMASK] (_GNU_SOURCE): Define (before
including other headers).

7 years agoFix static assertion violation in LONG_MULT for 64-bit targets
Ivan Maidanski [Thu, 23 Mar 2017 19:44:11 +0000 (22:44 +0300)]
Fix static assertion violation in LONG_MULT for 64-bit targets

* include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR):
Cast displ to unsigned32 when passed to LONG_MULT (it is safe because
displ is less than HBLKSIZE).

7 years agoTravis CI: Add _FORTIFY_SOURCE to exclude GC_BUILTIN_ATOMIC build for gcc
Ivan Maidanski [Thu, 23 Mar 2017 19:34:15 +0000 (22:34 +0300)]
Travis CI: Add _FORTIFY_SOURCE to exclude GC_BUILTIN_ATOMIC build for gcc
(fix commit 2897743)

7 years agoDetect sigsetjmp() availability by configure
Ivan Maidanski [Thu, 23 Mar 2017 08:45:31 +0000 (11:45 +0300)]
Detect sigsetjmp() availability by configure

* configure.ac (AC_TRY_LINK(sigsetjmp)): Add (define GC_NO_SIGSETJMP
if sigsetjmp is not available).

7 years agoSupport CFLAGS_EXTRA when checking for inline and dladdr (configure)
Ivan Maidanski [Thu, 23 Mar 2017 08:38:38 +0000 (11:38 +0300)]
Support CFLAGS_EXTRA when checking for inline and dladdr (configure)
(fix commits 0e175f3, 5dedb24)

* configure.ac (AC_C_INLINE, AC_TRY_COMPILE(dladdr)): Add $CFLAGS_EXTRA
to CFLAGS temporarily (restore CFLAGS after the check).

7 years agoTravis CI: Test also with -D _FORTIFY_SOURCE
Ivan Maidanski [Thu, 23 Mar 2017 08:25:52 +0000 (11:25 +0300)]
Travis CI: Test also with -D _FORTIFY_SOURCE

7 years agoUse C11 static_assert if available
Ivan Maidanski [Thu, 23 Mar 2017 08:24:06 +0000 (11:24 +0300)]
Use C11 static_assert if available
(code refactoring)

* include/private/gc_priv.h [static_assert && __STDC_VERSION__>=201112]
(GC_STATIC_ASSERT): Define to static_assert (with an empty message);
update comment.

7 years agoUse longjmp in fault_handler_openbsd if siglongjmp unavailable (OpenBSD)
Ivan Maidanski [Thu, 23 Mar 2017 08:15:45 +0000 (11:15 +0300)]
Use longjmp in fault_handler_openbsd if siglongjmp unavailable (OpenBSD)

* os_dep.c [OPENBSD] (GC_jmp_buf_openbsd): Use JMP_BUF instead of
sigjmp_buf.
* os_dep.c [OPENBSD] (GC_fault_handler_openbsd): Use LONGJMP() instead
of siglongjmp().
* os_dep.c [OPENBSD] (GC_find_limit_openbsd, GC_skip_hole_openbsd): Use
SETJMP(buf) instead of sigsetjmp(buf, 1).

7 years agoUse sigsetjmp() in setjmp_t tool if available
Ivan Maidanski [Thu, 23 Mar 2017 08:09:40 +0000 (11:09 +0300)]
Use sigsetjmp() in setjmp_t tool if available

* tools/setjmp_t.c (main): Replace jmp_buf, setjmp(), longjmp() to
JMP_BUF, SETJMP(), LONGJMP(), respectively; cast result of SETJMP() to
void type.

7 years agoFix typo in comment at GC_setup_temporary_fault_handler declaration
Ivan Maidanski [Thu, 23 Mar 2017 00:24:49 +0000 (03:24 +0300)]
Fix typo in comment at GC_setup_temporary_fault_handler declaration

* include/private/gc_priv.h (GC_setup_temporary_fault_handler): Fix typo
in comment (replace trailing ';' with a dot).

7 years agoFix tools/setjmp_t hang (OS X)
Ivan Maidanski [Thu, 23 Mar 2017 00:16:12 +0000 (03:16 +0300)]
Fix tools/setjmp_t hang (OS X)

* tools/setjmp_t.c (main): Declare "y" static variable as volatile (to
prevent reordering/optimization of y++).

7 years agoTravis CI: Build also cord/de target of Makefile.direct
Ivan Maidanski [Thu, 23 Mar 2017 00:07:36 +0000 (03:07 +0300)]
Travis CI: Build also cord/de target of Makefile.direct

7 years agoRemove EMX_MAKEFILE (add EMX support to Makefile.direct)
Ivan Maidanski [Wed, 22 Mar 2017 22:41:25 +0000 (01:41 +0300)]
Remove EMX_MAKEFILE (add EMX support to Makefile.direct)

* EMX_MAKEFILE: Remove.
* Makefile.am (EXTRA_DIST): Remove EMX_MAKEFILE entity.
* Makefile.direct (OTHER_MAKEFILES): Likewise.
* Makefile.direct (CC, RANLIB): Add comment for EMX target.
* Makefile.direct (EXEEXT): New variable (empty by default).
* Makefile.direct (UTILS, all, cords, test_cpp, check-cpp, c++-t,
dyn_test, cord/cordtest, cord/de, if_mach, threadlibs, if_not_there,
gctest, setjmp_test, check): Add $(EXEEXT) suffix to if_mach,
if_not_there, threadlibs, gctest, cord/cordtest, test_cpp, cord/de,
setjmp_test.

7 years agoRevert 'Remove unnecessary rm commands in Makefile.direct'
Ivan Maidanski [Wed, 22 Mar 2017 23:55:33 +0000 (02:55 +0300)]
Revert 'Remove unnecessary rm commands in Makefile.direct'

This reverts commit 72e01227a4bf011fb28848b752a3cc599cba7224.

Because 'rm' is needed in these Makefile targets to let if_not_there
command work properly in case of the target dependencies are updated.

7 years agoTravis CI: Build check-cpp target of Makefile.direct
Ivan Maidanski [Wed, 22 Mar 2017 08:40:56 +0000 (11:40 +0300)]
Travis CI: Build check-cpp target of Makefile.direct

7 years ago.gitignore: Ignore gctest_* and lib*gc.so produced by Makefile.direct
Ivan Maidanski [Wed, 22 Mar 2017 08:31:16 +0000 (11:31 +0300)]
.gitignore: Ignore gctest_* and lib*gc.so produced by Makefile.direct

7 years agoNew target (check-cpp) to avoid Makefile.direct parallel build issue
Ivan Maidanski [Wed, 22 Mar 2017 08:23:37 +0000 (11:23 +0300)]
New target (check-cpp) to avoid Makefile.direct parallel build issue

* Makefile.direct: Add comment about check-cpp.
* Makefile.direct (test_cpp): Replace dependency on "c++" with
"gc_cpp.o base_lib"; link with gc_cpp.o directly.
* Makefile.direct (check-cpp): New target (same as c++-t but do not
depend on c++ target and pass no arguments to test_cpp).

7 years agoRemove lint-specific code
Ivan Maidanski [Tue, 21 Mar 2017 21:37:06 +0000 (00:37 +0300)]
Remove lint-specific code

Note: cppcheck and CSA replace lint tool.

* Makefile.direct (lint): Remove.
* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES && LINT] (_DYNAMIC):
Remove.
* dyn_load.c [IRIX5 || (USE_PROC_FOR_LIBRARIES && !LINUX)]
(GC_register_dynamic_libraries): Remove comment about a false warning
reported by lint.
* mach_dep.c [ASM_CLEAR_CODE && LINT] (GC_clear_stack_inner): Remove.
* tests/test.c (typed_test): Call GC_make_descriptor unconditionally.
* tests/test.c (run_one_test): Set y to fail_proc1 unconditionally.
* tests/test.c (main): Do not check whether LINT is defined.

7 years agoFix cord/de build in Makefile.direct (Linux)
Ivan Maidanski [Tue, 21 Mar 2017 08:58:30 +0000 (11:58 +0300)]
Fix cord/de build in Makefile.direct (Linux)

As of Ubuntu 14, termlib package is missing and not needed to
build 'de' test application (the required symbols are provided in
libcurses).

* Makefile.direct (CURSES): Remove -ltermlib; add comment about it.
* Makefile.direct [DRSNX, HPUX] (cord/de): Replace $(CURSES) with
"-lcurses -ltermlib".

7 years ago.gitignore: Ignore bsd-libgc.a, bsd-libleak.a
Ivan Maidanski [Mon, 20 Mar 2017 20:10:48 +0000 (23:10 +0300)]
.gitignore: Ignore bsd-libgc.a, bsd-libleak.a

7 years agoFix test_cpp and c++ parallel build in Makefile.direct
Ivan Maidanski [Mon, 20 Mar 2017 08:33:37 +0000 (11:33 +0300)]
Fix test_cpp and c++ parallel build in Makefile.direct

* Makefile.direct (test_cpp): Add dependency on c++ (and remove
dependency on base_lib and gc_cpp.o); do not link with gc_cpp.o
directly (it should be in gc.a).

7 years agoTravis CI: Do not test --enable-redirect with threads on 32-bit and Darwin
Ivan Maidanski [Fri, 17 Mar 2017 13:58:59 +0000 (16:58 +0300)]
Travis CI: Do not test --enable-redirect with threads on 32-bit and Darwin
(fix commit c62abbb)

7 years agoFix BIG definition in gctest (MS VC)
Ivan Maidanski [Fri, 17 Mar 2017 08:53:25 +0000 (11:53 +0300)]
Fix BIG definition in gctest (MS VC)
(fix commit 3bfeb8a)

* tests/test.c [NO_GETCONTEXT] (BIG): Move comment out of defined();
do not define (to 1000) unless UNIX_LIKE.

7 years agoFix GC shared library tests failure (musl)
Ivan Maidanski [Fri, 17 Mar 2017 08:21:13 +0000 (11:21 +0300)]
Fix GC shared library tests failure (musl)

Detect dl_iterate_phdr() presence by configure.

* configure.ac (dl_iterate_phdr): Add AC_CHECK_FUNCS for.
* configure.ac [ac_cv_func_dl_iterate_phdr] (HAVE_DL_ITERATE_PHDR):
AC_DEFINE it.

7 years agoAllow HAVE_DL_ITERATE_PHDR to be defined by client (musl)
Ivan Maidanski [Fri, 17 Mar 2017 08:05:56 +0000 (11:05 +0300)]
Allow HAVE_DL_ITERATE_PHDR to be defined by client (musl)

Do not redefine HAVE_DL_ITERATE_PHDR macro if already defined.

* dyn_load.c [OPENBSD>=200519] (HAVE_DL_ITERATE_PHDR): Do not define
if already defined.
* dyn_load.c [!USE_PROC_FOR_LIBRARIES && (__GLIBC__>=2
|| PLATFORM_ANDROID)] (HAVE_DL_ITERATE_PHDR): Likewise.
* dyn_load.c [!USE_PROC_FOR_LIBRARIES && HAVE_DL_ITERATE_PHDR
&& !DL_ITERATE_PHDR_STRONG] (dl_iterate_phdr): Define as weak symbol
(even if HAVE_DL_ITERATE_PHDR is defined outside this file).

7 years agoFix gctest thread stack overflow (musl-gcc)
Ivan Maidanski [Fri, 17 Mar 2017 07:39:57 +0000 (10:39 +0300)]
Fix gctest thread stack overflow (musl-gcc)

* tests/test.c (BIG): Remove commented out defined(MSWIN32); define
to 1000 if NO_GETCONTEXT; update comment.

7 years agoTravis CI: Test also -D DBG_HDRS_ALL -D SHORT_DBG_HDRS
Ivan Maidanski [Fri, 17 Mar 2017 07:25:58 +0000 (10:25 +0300)]
Travis CI: Test also -D DBG_HDRS_ALL -D SHORT_DBG_HDRS

7 years agoTravis CI: Remove -D DEBUG_DISCLAIM_DESTRUCT, add -D GC_LOG_TO_FILE_ALWAYS
Ivan Maidanski [Fri, 17 Mar 2017 07:21:37 +0000 (10:21 +0300)]
Travis CI: Remove -D DEBUG_DISCLAIM_DESTRUCT, add -D GC_LOG_TO_FILE_ALWAYS
(fix commit 19db2c6)

Otherwise Travis log is overflowed.

7 years agoWorkaround 'WinMain() is never used' cppcheck false warning (de_win)
Ivan Maidanski [Thu, 16 Mar 2017 22:20:11 +0000 (01:20 +0300)]
Workaround 'WinMain() is never used' cppcheck false warning (de_win)

* cord/tests/de_win.c (WinMain): Call GC_noop1(&WinMain) if CPPCHECK.

7 years agoFix gctest failure for Darwin if CPPCHECK is defined
Ivan Maidanski [Thu, 16 Mar 2017 22:10:41 +0000 (01:10 +0300)]
Fix gctest failure for Darwin if CPPCHECK is defined
(fix commits c5d4ef9, 857bb8a)

* tests/test.c [TEST_FORK_WITHOUT_ATFORK] (NO_TEST_HANDLE_FORK):
Define even if CPPCHECK (i.e., CPPCHECK should not imply testing of
HANDLE_FORK).
* tests/test.c [GC_PTHREADS && CPPCHECK] (main): Remove duplicate check
for GC_PTHREADS.
* tests/test.c [GC_PTHREADS && CPPCHECK && NO_TEST_HANDLE_FORK] (main):
Call UNTESTED() for GC_atfork_child, GC_atfork_parent,
GC_atfork_prepare, GC_set_handle_fork, GC_start_mark_threads.

7 years agoTravis CI: Test also --enable-redirect-malloc
Ivan Maidanski [Thu, 16 Mar 2017 21:42:52 +0000 (00:42 +0300)]
Travis CI: Test also --enable-redirect-malloc

7 years agoTravis CI: Test also -D POINTER_MASK
Ivan Maidanski [Thu, 16 Mar 2017 08:33:49 +0000 (11:33 +0300)]
Travis CI: Test also -D POINTER_MASK

7 years agoTravis CI: Test also ENABLE_TRACE and other misc macros
Ivan Maidanski [Thu, 16 Mar 2017 08:31:48 +0000 (11:31 +0300)]
Travis CI: Test also ENABLE_TRACE and other misc macros

7 years agoTravis CI: Test also various -D DEBUG_x
Ivan Maidanski [Thu, 16 Mar 2017 08:18:58 +0000 (11:18 +0300)]
Travis CI: Test also various -D DEBUG_x

7 years agoRemove unnecessary 'rm' commands in Makefile.direct
Ivan Maidanski [Thu, 16 Mar 2017 08:05:18 +0000 (11:05 +0300)]
Remove unnecessary 'rm' commands in Makefile.direct
(code refactoring)

A makefile target is executed only if the target file is not created
yet thus removal of the target file ("rm -f <target>") is a no-op.

* Makefile.direct (test_cpp, mach_dep.o, mark_rts.o, cord/cordtest,
cord/de, gctest): Remove deletion of the target file.

7 years agoRun test_cpp only if requested (Makefile.direct)
Ivan Maidanski [Thu, 16 Mar 2017 07:53:28 +0000 (10:53 +0300)]
Run test_cpp only if requested (Makefile.direct)

* Makefile.direct (c++-t): Add dependency on test_cpp target.
* Makefile.direct (c++): Remove dependency on test_cpp target; do not
execute test_cpp.

7 years agoFix parallel build in Makefile.direct
Ivan Maidanski [Thu, 16 Mar 2017 07:45:09 +0000 (10:45 +0300)]
Fix parallel build in Makefile.direct

* Makefile.direct (all, cord/cordtest, cord/de, gctest): Depend on
base_lib instead of gc.a target.
* Makefile.direct (base_lib): Generate "base_lib" file after
"runlib gc.a".
* Makefile.direct (cords, c++): Add dependency on base_lib target.

7 years agoEliminate 'ISO C forbids object to function pointer conversion' warning
Ivan Maidanski [Thu, 16 Mar 2017 07:22:29 +0000 (10:22 +0300)]
Eliminate 'ISO C forbids object to function pointer conversion' warning

* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES
&& SUNOS53_SHARED_LIB] (GC_FirstDLOpenedLinkMap): Cast result of dlsym()
to word type before casting it to a function pointer.
* pthread_support.c [GC_USE_DLOPEN_WRAP] (GC_init_real_syms): Likewise.

7 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 16 Mar 2017 07:11:15 +0000 (10:11 +0300)]
Update AUTHORS file

7 years agoconfigure: match uclinux pattern
Romain Naour [Sat, 6 Aug 2016 21:24:35 +0000 (23:24 +0200)]
configure: match uclinux pattern

BDWGC does not recognize "uclinux" as a valid OS part of the target
tuple which is used by some arm cortex-M toolchains.

* configure.ac [$THREADS=pthreads] (GC_LINUX_THREADS, _REENTRANT): Define
for hosts matching "*-*-*linux*" (instead of "*-*-linux*").

7 years agoEliminate 'type defaults to int in declaration' warning (REDIRECT_MALLOC)
Ivan Maidanski [Wed, 15 Mar 2017 22:02:12 +0000 (01:02 +0300)]
Eliminate 'type defaults to int in declaration' warning (REDIRECT_MALLOC)

* os_dep.c [REDIRECT_MALLOC] (GC_in_save_callers): Add missing type
(GC_bool) of the declared variable.

7 years agoUse AC_DEFINE for defining NO_GETCONTEXT in configure
Ivan Maidanski [Wed, 15 Mar 2017 21:49:22 +0000 (00:49 +0300)]
Use AC_DEFINE for defining NO_GETCONTEXT in configure
(code refactoring of commit 7c13fb8)

* configure.ac [!ac_cv_func_getcontext]: Use AC_DEFINE(NO_GETCONTEXT)
instead of directly adding -D NO_GETCONTEXT to CFLAGS.

7 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 15 Mar 2017 21:41:11 +0000 (00:41 +0300)]
Update AUTHORS file

7 years agoconfigure.ac: add check for NO_GETCONTEXT definition
Samuel Martin [Wed, 15 Mar 2017 21:39:37 +0000 (00:39 +0300)]
configure.ac: add check for NO_GETCONTEXT definition

* configure.ac: Add AC_CHECK_FUNCS(getcontext); add -DNO_GETCONTEXT to
CFLAGS if $ac_cv_func_getcontext is "no".

7 years agoFix GC_SIZE_MAX definition (Linux/musl-gcc)
Ivan Maidanski [Tue, 14 Mar 2017 22:58:41 +0000 (01:58 +0300)]
Fix GC_SIZE_MAX definition (Linux/musl-gcc)

* include/private/gc_priv.h [SIZE_MAX && !CPPCHECK] (GC_SIZE_MAX): Cast
SIZE_MAX to size_t explicitly (to workaround incorrect definition
of SIZE_MAX - e.g. it is defined as ~0ULL in musl-tools which is not
correct for a 32-bit target).

7 years agoRefine configure messages when checking for compiler option support
Ivan Maidanski [Tue, 14 Mar 2017 22:45:16 +0000 (01:45 +0300)]
Refine configure messages when checking for compiler option support

* configure.ac (AC_MSG_CHECKING): Refine message when checking for
a compiler option support (replace "gcc" with "compiler").

7 years agoTravis CI: Test also build system based on Makefile.direct
Ivan Maidanski [Tue, 14 Mar 2017 08:57:14 +0000 (11:57 +0300)]
Travis CI: Test also build system based on Makefile.direct

7 years agoTravis CI: Test MARK_BIT_PER_OBJ and SMALL_CONFIG in separate builds
Ivan Maidanski [Tue, 14 Mar 2017 06:56:51 +0000 (09:56 +0300)]
Travis CI: Test MARK_BIT_PER_OBJ and SMALL_CONFIG in separate builds
(fix commit 817ea6f)

Perform MARK_BIT_PER_OBJ testing only in 32-bit mode (for now).
Also test -D NO_GETENV.

7 years agoTravis CI: Test also compilation of PROC_VDB code
Ivan Maidanski [Tue, 14 Mar 2017 06:50:09 +0000 (09:50 +0300)]
Travis CI: Test also compilation of PROC_VDB code

7 years agoAllow compilation of PROC_VDB code on Linux host (GC_NO_SYS_FAULT_H)
Ivan Maidanski [Tue, 14 Mar 2017 06:43:28 +0000 (09:43 +0300)]
Allow compilation of PROC_VDB code on Linux host (GC_NO_SYS_FAULT_H)

This is to check that PROC_VDB code compilation is ok.  The code will
not work on a non-Solaris host, of course, because of lack of "pagedata"
file, so -D NO_INCREMENTAL should be additionally specified to avoid
abort during GC initialization (in gctest).

* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H]: Do not include sys/fault.h
and sys/procfs.h.
* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H] (PG_MODIFIED,
struct prpageheader, struct prasmap): Define explicitly.
* os_dep.c [PROC_VDB && GC_NO_SYS_FAULT_H && CPPCHECK] (GC_read_dirty):
Call GC_noop1 for dummy fields of prpageheader and prasmap.

7 years agoFix 'ISO C90 forbids mixed declarations/code' compiler warning (gc_pmark)
Ivan Maidanski [Mon, 13 Mar 2017 21:31:08 +0000 (00:31 +0300)]
Fix 'ISO C90 forbids mixed declarations/code' compiler warning (gc_pmark)

* include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR):
Declare "obj_displ" local variable at the beginning of the block (not
after GC_STATIC_ASSERT).

7 years agoRename 'test' to 'check' target in Makefile.direct
Ivan Maidanski [Mon, 13 Mar 2017 21:08:26 +0000 (00:08 +0300)]
Rename 'test' to 'check' target in Makefile.direct

This is to match the target name in Makefile generated by configure.

* Makefile.direct: Update comment about testing (rename "test" target
to "check").
* Makefile.direct (check): Renamed from "test".
* Makefile.direct (test): Depend on check; add comment.
* README.QUICK (INSTALLATION): Leave information only about the recent
GC version.
* README.QUICK (INSTALLATION): Replace "make test" with "make check".
* README.md (Installation and Portability): Likewise.

7 years agoTravis CI: Test also -D CHECKSUMS, -D SMALL_CONFIG -D MARK_BIT_PER_OBJ
Ivan Maidanski [Fri, 10 Mar 2017 21:54:45 +0000 (00:54 +0300)]
Travis CI: Test also -D CHECKSUMS, -D SMALL_CONFIG -D MARK_BIT_PER_OBJ

7 years agoRemove Makefile KandRtest target (that supported K&R C compiler)
Ivan Maidanski [Fri, 10 Mar 2017 16:13:52 +0000 (19:13 +0300)]
Remove Makefile KandRtest target (that supported K&R C compiler)

* Makefile.direct (test): Execute setjmp_test, gctest directly (instead
of depending on KandRtest).
* Makefile.direct (KandRtest): Remove (with the comment about K&R C
compiler).

7 years agoRemove notes that K&R C compiler is unsupported
Ivan Maidanski [Fri, 10 Mar 2017 16:04:46 +0000 (19:04 +0300)]
Remove notes that K&R C compiler is unsupported

* README.QUICK: Remove a note that ANSI C compiler is required/assumed
(not a K&R C compiler).
* doc/README.cords: Likewise.
* doc/README.macros (GC_GCJ_SUPPORT): Likewise.
* include/gc_backptr.h: Likewise.
* pcr_interface.c [PCR]: Likewise.
* tools/if_not_there.c: Likewise.

7 years agoTravis CI: Put a space after '-D', '-U' for cppcheck, clang, gcc
Ivan Maidanski [Fri, 10 Mar 2017 08:33:45 +0000 (11:33 +0300)]
Travis CI: Put a space after '-D', '-U' for cppcheck, clang, gcc
(refactoring of commits bf2625a, c207f02, 44f5cce, 9ddd327, 9718222)

7 years agoTravis CI: Do not use atomic intrinsics on Linux/gcc-4.6
Ivan Maidanski [Fri, 10 Mar 2017 07:18:19 +0000 (10:18 +0300)]
Travis CI: Do not use atomic intrinsics on Linux/gcc-4.6
(fix commit 9ddd327)

GCC v4.6 does not support atomic intrinsics.

7 years agoUse __thread keyword for Android NDK r12b+ Clang (arm)
Ivan Maidanski [Thu, 9 Mar 2017 22:03:05 +0000 (01:03 +0300)]
Use __thread keyword for Android NDK r12b+ Clang (arm)

* include/private/gcconfig.h (GC_CLANG_PREREQ_FULL): New macro (to check
the required patch_level of Clang).
* include/private/thread_local_alloc.h [PLATFORM_ANDROID && ARM32]
(USE_COMPILER_TLS): Define for clang-3.8.256229 or later.

7 years agoWorkaround '32-bit value shift by >31 bits is undefined' cppcheck warnings
Ivan Maidanski [Thu, 9 Mar 2017 20:48:45 +0000 (23:48 +0300)]
Workaround '32-bit value shift by >31 bits is undefined' cppcheck warnings

* include/private/gcconfig.h [CPPCHECK] (CPP_WORDSZ): Undefine
(platform-specific explicit value) and redefine to __SIZEOF_POINTER__*8.

7 years agoTravis CI: Test also with GC built-in atomic primitives
Ivan Maidanski [Thu, 9 Mar 2017 20:36:33 +0000 (23:36 +0300)]
Travis CI: Test also with GC built-in atomic primitives

7 years agoEliminate 'non-reentrant function strtok called' cppcheck warning (POSIX)
Ivan Maidanski [Thu, 9 Mar 2017 06:57:56 +0000 (09:57 +0300)]
Eliminate 'non-reentrant function strtok called' cppcheck warning (POSIX)

* tests/test_cpp.cc [(MSWIN32 && !__MINGW32__ || MSWINCE)
&& !NO_WINMAIN_ENTRY] (WinMain): Manually inline strtok(); add comment.

7 years agoFix 'token not a valid binary' error during initsecondarythread compilation
Ivan Maidanski [Wed, 8 Mar 2017 03:23:24 +0000 (06:23 +0300)]
Fix 'token not a valid binary' error during initsecondarythread compilation
(fix commit 4f98587)

* include/private/gc_priv.h (GC_CLANG_PREREQ): Remove.
* include/private/gcconfig.h (GC_CLANG_PREREQ): Define (moved from
gc_priv.h).

7 years agoFix 'expected end of line in preprocessor' compilation error in gc_priv.h
Ivan Maidanski [Tue, 7 Mar 2017 21:39:30 +0000 (00:39 +0300)]
Fix 'expected end of line in preprocessor' compilation error in gc_priv.h
(fix commit 4f98587)

* include/private/gc_priv.h [CANCEL_SAFE && GC_ASSERTIONS]: Remove
extra ')' in "#if" expression.

7 years agoTravis CI: Also test --enable-large-config in 32-bit mode (Linux)
Ivan Maidanski [Tue, 7 Mar 2017 16:53:30 +0000 (19:53 +0300)]
Travis CI: Also test --enable-large-config in 32-bit mode (Linux)

7 years agoIncrease MAX_HEAP_SECTS (10 times) for large-config
Thomas Linder Puls [Mon, 6 Mar 2017 10:55:56 +0000 (11:55 +0100)]
Increase MAX_HEAP_SECTS (10 times) for large-config

This enables heaps larger than 128 GB on 64-bit targets.

* include/private/gc_priv.h [!MAX_HEAP_SECTS && LARGE_CONFIG]
(MAX_HEAP_SECTS): Increase value 10 times (from 8192 to 81920 if
64-bit target, from 768 to 7680 otherwise); remove comments.

7 years agoWorkaround 'memory leak: result' cppcheck false error (POSIX)
Ivan Maidanski [Tue, 7 Mar 2017 16:23:49 +0000 (19:23 +0300)]
Workaround 'memory leak: result' cppcheck false error (POSIX)

The report is a false positive because result (returned by mmap) should
be equal to start_addr (passed to mmap).

* os_dep.c [USE_MUNMAP && !USE_WINALLOC] (GC_unmap, GC_unmap_gap): Call
GC_noop1(result) if CPPCHECK (same as for LINT2).
* os_dep.c [USE_MUNMAP && !USE_WINALLOC && NACL] (GC_remap): Likewise.

7 years agoWorkaround 'obsolescent usleep called' cppcheck warning (POSIX)
Ivan Maidanski [Tue, 7 Mar 2017 16:03:00 +0000 (19:03 +0300)]
Workaround 'obsolescent usleep called' cppcheck warning (POSIX)

* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL]: Include time.h.
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_world):
Use nanosleep() instead of usleep() if CPPCHECK.

7 years agoWorkaround 'obsolescent bcopy, bzero called' cppcheck warnings (POSIX)
Ivan Maidanski [Tue, 7 Mar 2017 15:52:08 +0000 (18:52 +0300)]
Workaround 'obsolescent bcopy, bzero called' cppcheck warnings (POSIX)

* include/private/gc_priv.h (BCOPY, BZERO): Define to memcpy/set if
CPPCHECK (regardless of BCOPY_EXISTS).

7 years agoEliminate 'scope of variable can be reduced' cppcheck warnings (Win32)
Ivan Maidanski [Tue, 7 Mar 2017 15:41:13 +0000 (18:41 +0300)]
Eliminate 'scope of variable can be reduced' cppcheck warnings (Win32)

* os_dep.c [MSWIN32] (GC_register_root_section): Move "protect" local
variable declaration to the inner scope where the variable is actually
used.
* win32_threads.c [!MSWINCE && !CYGWIN32] (GC_CreateThread): Move
"thread_h" local variable declaration to the inner scope.

7 years agoTravis CI: Test also --enable-large-config --enable-munmap (Linux)
Ivan Maidanski [Tue, 7 Mar 2017 15:27:57 +0000 (18:27 +0300)]
Travis CI: Test also --enable-large-config --enable-munmap (Linux)

7 years agoTravis CI: Output gctest.log content
Ivan Maidanski [Tue, 7 Mar 2017 15:24:23 +0000 (18:24 +0300)]
Travis CI: Output gctest.log content

7 years agoDefine CLANG/GNUC_PREREQ macros to check gcc/clang minimum version
Ivan Maidanski [Tue, 7 Mar 2017 15:19:29 +0000 (18:19 +0300)]
Define CLANG/GNUC_PREREQ macros to check gcc/clang minimum version
(code refactoring)

* cord/cordxtra.c (CORD_ATTR_UNUSED): Use GC_GNUC_PREREQ() instead of
direct use of __GNUC[_MINOR]__.
* gc_cpp.cc (GC_NEW_DELETE_NEED_THROW): Likewise.
* include/gc_config_macros.h (GC_API, GC_ATTR_MALLOC, GC_ATTR_ALLOC_SIZE,
GC_ATTR_NONNULL, GC_ATTR_DEPRECATED, GC_RETURN_ADDR,
GC_RETURN_ADDR_PARENT, GC_PTHREAD_EXIT_ATTRIBUTE): Likewise.
* include/gc_cpp.h (GC_NO_OPERATOR_NEW_ARRAY): Likewise.
* include/gc_inline.h (GC_EXPECT, GC_PREFETCH_FOR_WRITE): Likewise.
* include/new_gc_alloc.h: Likewise.
* include/private/gc_priv.h (GC_INNER, GC_ATTR_UNUSED, EXPECT, GC_INLINE,
GC_ATTR_NOINLINE, GC_API_OSCALL, GC_ATTR_FORMAT_PRINTF,
NONNULL_ARG_NOT_NULL): Likewise.
* include/private/gc_priv.h [CANCEL_SAFE] (GC_cancel_disable_count):
Likewise.
* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT, PREFETCH,
GC_PREFETCH_FOR_WRITE): Likewise.
* include/private/gcconfig.h [I386 && LINUX && __ELF__]
(GC_NO_SIGSETJMP): Likewise.
* include/private/gcconfig.h [X86_64 && MSWIN32] (MPROTECT_VDB):
Likewise.
* include/private/thread_local_alloc.h [CYGWIN32] (USE_PTHREAD_SPECIFIC):
Likewise.
* include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32
|| PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Likewise.
* mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise.
* mark_rts.c (GC_approx_sp): Likewise.
* tests/test_cpp.cc (ATTR_UNUSED): Likewise.
* tools/setjmp_t.c (nested_sp): Likewise.
* include/gc_config_macros.h (GC_GNUC_PREREQ): New macro (not for
public use).
* include/private/gc_priv.h (GC_CLANG_PREREQ): New private macro.
* include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Refine comment.
* include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32
|| PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Use
GC_CLANG_PREREQ() instead of direct use of __clang_major__ and
__clang_minor__.
* mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise.

7 years agoEliminate 'condition ret==NULL always true' cppcheck style warning (Amiga)
Ivan Maidanski [Sun, 5 Mar 2017 05:22:39 +0000 (08:22 +0300)]
Eliminate 'condition ret==NULL always true' cppcheck style warning (Amiga)

* extra/AmigaOS.c [GC_AMIGA_FASTALLOC && !GC_AMIGA_ONLYFAST
&& GC_AMIGA_GC] (GC_amiga_allocwrapper_any): Do not check ret==NULL
twice.
* extra/AmigaOS.c [GC_AMIGA_FASTALLOC && GC_AMIGA_GC]
(GC_amiga_allocwrapper_fast): Likewise.
* extra/AmigaOS.c [GC_AMIGA_GC] (GC_amiga_realloc): Likewise.

7 years agoTravis CI: Also test with Unexpected behavior sanitizer (UBSan)
Ivan Maidanski [Fri, 3 Mar 2017 15:24:43 +0000 (18:24 +0300)]
Travis CI: Also test with Unexpected behavior sanitizer (UBSan)

7 years agoFix 'overriding commands for target check-without-...' Makefile warnings
Ivan Maidanski [Fri, 3 Mar 2017 14:53:10 +0000 (17:53 +0300)]
Fix 'overriding commands for target check-without-...' Makefile warnings
(fix commit 8f20303)

Makefile.am includes cord.am and tests.am, so check-without-test-driver
should be defined only at one place.

* cord/cord.am (check-without-test-driver): Remove.
* tests/tests.am (check-without-test-driver): Add ./cordtest$(EXEEXT)
execution.

7 years agoUpdate AUTHORS file
Ivan Maidanski [Thu, 2 Mar 2017 21:42:01 +0000 (00:42 +0300)]
Update AUTHORS file

7 years agoFix 'size of tv is unknown' error in brief_async_signal_safe_sleep (musl)
Mikael Djurfeldt [Sun, 26 Feb 2017 19:09:56 +0000 (20:09 +0100)]
Fix 'size of tv is unknown' error in brief_async_signal_safe_sleep (musl)
(fix commits 62097c3, 9f48082)

Include <sys/time.h> to get struct timeval defined and select() declared.

* pthread_stop_world.c [GC_ENABLE_SUSPEND_THREAD]: Include sys/time.h
before GC_brief_async_signal_safe_sleep definition.

7 years agoAdd Makefile target to run all tests without test-driver
Ivan Maidanski [Wed, 1 Mar 2017 23:23:32 +0000 (02:23 +0300)]
Add Makefile target to run all tests without test-driver

This could be used to catch errors reported by MemorySanitizer
(the traditional "make check" shows the tests with MSan errors as
skipped, so it does not lead to a non-zero exit code of make itself).

* cord/cord.am (check-without-test-driver): New phony target (to
compile, link and execute the tests not using test-driver).
* tests/tests.am (check-without-test-driver): Likewise.

7 years agoFix missing .exe for disclaim test filenames in Makefile (MinGW)
Ivan Maidanski [Wed, 1 Mar 2017 23:03:11 +0000 (02:03 +0300)]
Fix missing .exe for disclaim test filenames in Makefile (MinGW)
(fix commit 6c1a924)

Also add 4 blank lines to improve tests.am readability.

* tests/tests.am [ENABLE_DISCLAIM] (TESTS): Add $(EXEEXT) suffix to
disclaim_test, disclaim_bench.

7 years agoUpdate shared libraries version info to differentiate against v7.6
Ivan Maidanski [Wed, 1 Mar 2017 22:10:29 +0000 (01:10 +0300)]
Update shared libraries version info to differentiate against v7.6

There are no API/implementation changes in libcord and libgccpp against
release-7_6 for now, so the corresponding version info is made the same.

There some implementation changes in libgc (without API changes) against
release-7_6, so the version info is made not the same (although there
are no API changes, 4:x:2 is already in use/reserved for release-7_6).

* Makefile.am (LIBGC_VER_INFO): Change version info to 5:0:3
(release-7_6 is supposed to use 4:x:2).
* Makefile.am (LIBGCCPP_VER_INFO): Change version info to 4:0:3
(the same one as release-7_6 uses at present).
* cord/cord.am (LIBCORD_VER_INFO): Likewise.

7 years agoMove libraries version info to the beginning of Makefile.am
Ivan Maidanski [Wed, 1 Mar 2017 08:10:00 +0000 (11:10 +0300)]
Move libraries version info to the beginning of Makefile.am
(code refactoring)

* Makefile.am (LIBGC_VER_INFO, LIBGCCPP_VER_INFO): New variable; add
comment about the version update rule.
* cord/cord.am (LIBCORD_VER_INFO): Likewise.
* Makefile.am (libgc_la_LDFLAGS, libgccpp_la_LDFLAGS): Use
LIBGC[CPP]_VER_INFO instead the direct hard-coding of version info.
* cord/cord.am (libcord_la_LDFLAGS): Likewise.

7 years agoUpdate AUTHORS file
Max Mouratov [Wed, 1 Mar 2017 03:12:14 +0000 (08:12 +0500)]
Update AUTHORS file

7 years agoEliminate 'checking unsigned variable < 0' cppcheck warning in gc_inline
Ivan Maidanski [Tue, 28 Feb 2017 22:25:34 +0000 (01:25 +0300)]
Eliminate 'checking unsigned variable < 0' cppcheck warning in gc_inline

* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Replace
(word)my_entry<=num_direct with (signed_word)my_entry-num_direct<=0
to avoid "checking unsigned var < 0" warning if num_direct==0
(no overflow is expected in (signed_word)my_entry-num_direct as it is
guaranteed that (word)my_entry<=num_direct+GC_TINY_FREELISTS+1).

7 years agoFix name typos in GC_FAST_MALLOC_GRANS comment
Ivan Maidanski [Tue, 28 Feb 2017 21:45:45 +0000 (00:45 +0300)]
Fix name typos in GC_FAST_MALLOC_GRANS comment

* include/gc_inline.h (GC_FAST_MALLOC_GRANS): Fix typos in names in
comment ("num_direct", "generic_malloc").

7 years agoDefine GC_ASSERT(x) as C assert(x) for external clients of gc_inline.h
Ivan Maidanski [Tue, 28 Feb 2017 21:25:51 +0000 (00:25 +0300)]
Define GC_ASSERT(x) as C assert(x) for external clients of gc_inline.h

* include/gc_inline.h [!GC_ASSERT && !NDEBUG] (GC_ASSERT): Define as
assert(x); include assert.h.

7 years agoDocument GC_BUILTIN_ATOMIC macro (and gc_atomic_ops private header file)
Ivan Maidanski [Tue, 28 Feb 2017 21:12:32 +0000 (00:12 +0300)]
Document GC_BUILTIN_ATOMIC macro (and gc_atomic_ops private header file)

* doc/README.macros (GC_BUILTIN_ATOMIC): Document.
* doc/porting.html (atomic_ops): Replace GC7+ with GC v7; remove note
that libatomic_ops contains more primitives than needed by GC; remove
note about GC_test_and_set of older GC versions (pre-v7); add note
about gc_atomic_ops.h file (optional replacement of libatomic_ops).

7 years agoDefine GC_PREFETCH_FOR_WRITE to __builtin_prefetch in gc_inline.h (GCC)
Ivan Maidanski [Tue, 28 Feb 2017 20:41:03 +0000 (23:41 +0300)]
Define GC_PREFETCH_FOR_WRITE to __builtin_prefetch in gc_inline.h (GCC)

Also add GC_ prefix to NO_PREFETCH_FOR_WRITE.

* include/gc_inline.h [!GC_PREFETCH_FOR_WRITE] (GC_PREFETCH_FOR_WRITE):
Copy the definition from gcconfig.h.
* include/private/gcconfig.h (NO_PREFETCH_FOR_WRITE): Rename to
GC_NO_PREFETCH_FOR_WRITE.

7 years agoEliminate 'label not used' cppcheck false warnings in GC_mark_X
Ivan Maidanski [Tue, 28 Feb 2017 20:02:55 +0000 (23:02 +0300)]
Eliminate 'label not used' cppcheck false warnings in GC_mark_X
(code refactoring of PUSH_CONTENTS[_HDR] to eliminate 'goto' statement)

* include/private/gc_hdrs.h (HC_GET_HDR): Remove exit_label argument;
replace goto with break; remove do-while(0) (as break is now used to
pass control to some place of the caller).
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Likewise.
* include/private/gc_pmark.h [!USE_MARK_BYTES] (OR_WORD_EXIT_IF_SET):
Likewise.
* include/private/gc_pmark.h (PUSH_CONTENTS, PUSH_CONTENTS_HDR):
Remove exit_label argument (and the comment about it).
* include/private/gc_pmark.h (SET_MARK_BIT_EXIT_IF_SET): Refine comment
about the exit.
* mark.c (GC_mark_from): Remove PUSH_CONTENTS exit<N> argument.
* typd_mlc.c (GC_typed_mark_proc): Likewise.
* mark.c (GC_mark_and_push, GC_mark_and_push_stack): Remove
PUSH_CONTENTS_HDR label argument and the label itself.

7 years agoTravis CI: Output config.h content
Ivan Maidanski [Mon, 27 Feb 2017 21:38:51 +0000 (00:38 +0300)]
Travis CI: Output config.h content

7 years agoTravis CI: Move cppcheck to parent (home) folder
Ivan Maidanski [Mon, 27 Feb 2017 21:32:50 +0000 (00:32 +0300)]
Travis CI: Move cppcheck to parent (home) folder
(fix commit b89b137e)

7 years agoTravis CI: Reformat 'env' section (describe each configuration in a line)
Ivan Maidanski [Mon, 27 Feb 2017 21:26:00 +0000 (00:26 +0300)]
Travis CI: Reformat 'env' section (describe each configuration in a line)
(fix commits 9a3ca02a7f2956795d52904e)

7 years agoFix typo in GC_AMIGA_GC documentation in README
Ivan Maidanski [Mon, 20 Feb 2017 21:32:49 +0000 (00:32 +0300)]
Fix typo in GC_AMIGA_GC documentation in README

* doc/README.amiga (GC_AMIGA_GC): Fix a typo ("very").