platform/upstream/libgc.git
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").

7 years agoUpdate AUTHORS file
Ivan Maidanski [Mon, 20 Feb 2017 21:25:29 +0000 (00:25 +0300)]
Update AUTHORS file

7 years agoFix various typos in comments and printed messages
Klemens Zwischenbrugger [Mon, 20 Feb 2017 21:17:57 +0000 (00:17 +0300)]
Fix various typos in comments and printed messages

This patch contains some spelling fixes (just in comments and C strings
passed to printf) as found by bot (https://github.com/ka7/misspell_fixer).

* SMakefile.amiga: Fix typo in comment ("don't").
* WCC_MAKEFILE (SYSTEM): Fix typo in comment ("uncomment").
* configure.ac [!GCC] (gc_cflags): Fix typo in comment ("actually").
* configure.ac (NO_CLOCK): Fix typo in comment ("targeting").
* doc/README.amiga: Fix typos in documentation ("there's", "compliant",
"documentation").
* extra/AmigaOS.c [GC_AMIGA_PRINTSTATS] (GC_amiga_free_all_mem): Fix
typos in printed messages ("succeeded", "succeeding").
* include/gc.h (GC_get_heap_size): Fix typo in comment ("below").
* tools/setjmp_t.c (main): Fix typo in printed message ("won't").

7 years agoDo not specify version info for test libraries (Automake)
Ivan Maidanski [Wed, 15 Feb 2017 21:55:15 +0000 (00:55 +0300)]
Do not specify version info for test libraries (Automake)

* tests/tests.am (libstaticrootslib_test_la_LDFLAGS,
libstaticrootslib2_test_la_LDFLAGS): Remove -version-info option.

7 years ago.gitignore: Ignore *.sancov (generated by ASan)
Ivan Maidanski [Wed, 15 Feb 2017 21:42:22 +0000 (00:42 +0300)]
.gitignore: Ignore *.sancov (generated by ASan)

7 years agoFix typo in Makefile.am comment
Ivan Maidanski [Wed, 15 Feb 2017 08:56:06 +0000 (11:56 +0300)]
Fix typo in Makefile.am comment

* Makefile.am (SUBDIRS): Fix typo in comment ("to be").

7 years agoTravis CI: Add source check by cppcheck
Ivan Maidanski [Tue, 14 Feb 2017 19:53:56 +0000 (22:53 +0300)]
Travis CI: Add source check by cppcheck

7 years agoTravis CI: Test -D LINT2 in Linux/x86 builds, not during test coverage
Ivan Maidanski [Tue, 14 Feb 2017 19:31:28 +0000 (22:31 +0300)]
Travis CI: Test -D LINT2 in Linux/x86 builds, not during test coverage
(fix commit a373d52)

7 years agoTravis CI: fix -D KEEP_BACK_PTRS option passed to clang in CSA_CHECK
Ivan Maidanski [Tue, 14 Feb 2017 18:59:28 +0000 (21:59 +0300)]
Travis CI: fix -D KEEP_BACK_PTRS option passed to clang in CSA_CHECK
(fix commit 3663fd5)

7 years agoTravis CI: fix 'bits/predefs.h not found' in CSA_CHECK build
Ivan Maidanski [Tue, 14 Feb 2017 18:42:02 +0000 (21:42 +0300)]
Travis CI: fix 'bits/predefs.h not found' in CSA_CHECK build
(fix commit 3663fd5)

7 years agoTravis CI: fix missing "fi" in the script
Ivan Maidanski [Tue, 14 Feb 2017 18:23:35 +0000 (21:23 +0300)]
Travis CI: fix missing "fi" in the script
(fix commit 3663fd5)

7 years agoEliminate 'value of GC_INLINE unknown' cppcheck info message
Ivan Maidanski [Tue, 14 Feb 2017 10:44:34 +0000 (13:44 +0300)]
Eliminate 'value of GC_INLINE unknown' cppcheck info message
(fix commit 46a2411)

* include/private/gc_atomic_ops.h (AO_INLINE): Check GC_PRIVATE_H is
defined instead of "ifdef GC_INLINE".

7 years agoTravis CI: Pass -D LINT2 to CFLAGS during test coverage check
Ivan Maidanski [Tue, 14 Feb 2017 10:34:53 +0000 (13:34 +0300)]
Travis CI: Pass -D LINT2 to CFLAGS during test coverage check

7 years agoTravis CI: Add source check by Clang Static Analyzer
Ivan Maidanski [Tue, 14 Feb 2017 10:28:56 +0000 (13:28 +0300)]
Travis CI: Add source check by Clang Static Analyzer

7 years agoWorkaround '!GC_page_size is always false' cppcheck style warning
Ivan Maidanski [Tue, 14 Feb 2017 08:24:18 +0000 (11:24 +0300)]
Workaround '!GC_page_size is always false' cppcheck style warning

* os_dep.c [!MSWIN32] (GC_setpagesize): Do not check that GC_page_size
is non-zero if CPPCHECK.

7 years agoUpdate ChangeLog file
Ivan Maidanski [Fri, 10 Feb 2017 13:11:44 +0000 (16:11 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Fri, 10 Feb 2017 12:52:36 +0000 (15:52 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 10 Feb 2017 11:18:00 +0000 (14:18 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoTravis CI: Test --disable-static --disable-threads
Ivan Maidanski [Thu, 2 Feb 2017 19:47:52 +0000 (22:47 +0300)]
Travis CI: Test --disable-static --disable-threads

7 years agoTravis CI: Test --enable-gc-assertions (only with -m32 and gcov)
Ivan Maidanski [Thu, 2 Feb 2017 19:38:54 +0000 (22:38 +0300)]
Travis CI: Test --enable-gc-assertions (only with -m32 and gcov)

7 years agoTravis CI: Test --enable-munmap only once (for gcov only)
Ivan Maidanski [Thu, 2 Feb 2017 19:26:27 +0000 (22:26 +0300)]
Travis CI: Test --enable-munmap only once (for gcov only)

7 years agoTravis CI: Test also --disable-gc-debug and --enable-large-config
Ivan Maidanski [Thu, 2 Feb 2017 19:13:42 +0000 (22:13 +0300)]
Travis CI: Test also --disable-gc-debug and --enable-large-config

7 years agoTravis CI: Do not apply gcov to gc-debug code
Ivan Maidanski [Thu, 2 Feb 2017 18:20:37 +0000 (21:20 +0300)]
Travis CI: Do not apply gcov to gc-debug code

7 years agoAdd Coveralls (test coverage status) badge to README
Ivan Maidanski [Thu, 2 Feb 2017 17:59:51 +0000 (20:59 +0300)]
Add Coveralls (test coverage status) badge to README

7 years agoTravis CI: Fix base directory for lcov
Ivan Maidanski [Thu, 2 Feb 2017 17:49:36 +0000 (20:49 +0300)]
Travis CI: Fix base directory for lcov
(fix commit 8270bf2)

7 years agoTravis CI: Fix gcov exclude matrix and fix lcov usage
Ivan Maidanski [Wed, 1 Feb 2017 19:41:47 +0000 (22:41 +0300)]
Travis CI: Fix gcov exclude matrix and fix lcov usage
(fix commit 8270bf2)

7 years agoTravis CI: Report test coverage for Linux/x64 (single-obj-compilation)
Ivan Maidanski [Wed, 1 Feb 2017 17:33:27 +0000 (20:33 +0300)]
Travis CI: Report test coverage for Linux/x64 (single-obj-compilation)

7 years agoTravis CI: Refactoring (rename ENABLE_CPP variable to CONF_CPP)
Ivan Maidanski [Wed, 1 Feb 2017 17:24:16 +0000 (20:24 +0300)]
Travis CI: Refactoring (rename ENABLE_CPP variable to CONF_CPP)
(fix commit 6c48bae)

7 years agoTravis CI: Refactoring (CFLAGS_EXTRA_M, wrap long lines)
Ivan Maidanski [Wed, 1 Feb 2017 09:02:26 +0000 (12:02 +0300)]
Travis CI: Refactoring (CFLAGS_EXTRA_M, wrap long lines)

7 years agoFix enable_parallel_mark condition in CMake script
Ivan Maidanski [Tue, 31 Jan 2017 23:30:18 +0000 (02:30 +0300)]
Fix enable_parallel_mark condition in CMake script

* CMakeLists.txt [enable_parallel_mark] (ADD_DEFINITIONS): Add
-DPARALLEL_MARK; remove ADD_DEFINITIONS("-DPARALLEL_MARK") in other
places; remove ${} for enable_parallel_mark in IF.

7 years agoFix MS VC warning about compiling unused checksums and thread_local_alloc
Ivan Maidanski [Tue, 31 Jan 2017 23:21:22 +0000 (02:21 +0300)]
Fix MS VC warning about compiling unused checksums and thread_local_alloc

* CMakeLists.txt (SRC): Remove checksums.c (to avoid MS VC warning
about unused file).
* CMakeLists.txt (SRC): Do not add thread_local_alloc.c unless
ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") present.

7 years ago.gitignore: Ignore coverage.info (generated by lcov)
Ivan Maidanski [Tue, 31 Jan 2017 21:43:43 +0000 (00:43 +0300)]
.gitignore: Ignore coverage.info (generated by lcov)

7 years ago.gitignore: Ignore all *.gc.log and *.tlog (generated by CMake)
Ivan Maidanski [Tue, 31 Jan 2017 18:25:59 +0000 (21:25 +0300)]
.gitignore: Ignore all *.gc.log and *.tlog (generated by CMake)
(fix commit f4047f9)

7 years agoTravis CI: Fix linux/i686 build; set language to C++
Ivan Maidanski [Tue, 31 Jan 2017 08:59:23 +0000 (11:59 +0300)]
Travis CI: Fix linux/i686 build; set language to C++
(fix commit caa4a79)

Note: libgccpp and test_cpp are disabled for 32-bit builds currently.

7 years agoFix a typo in comment of GC_mark_some
Ivan Maidanski [Tue, 31 Jan 2017 07:38:22 +0000 (10:38 +0300)]
Fix a typo in comment of GC_mark_some
(fix commit 84c0313)

* mark.c [(MSWIN32 || MSWINCE) && !__clang__ && __GNUC__>=4]
(GC_mark_some): Fix typo in comment ("pedantic").

7 years agoFix 'zero-size array is extension' Clang warning in os_dep (Linux/x86)
Ivan Maidanski [Mon, 30 Jan 2017 03:51:12 +0000 (06:51 +0300)]
Fix 'zero-size array is extension' Clang warning in os_dep (Linux/x86)

* os_dep.c [I386 && LINUX && SAVE_CALL_CHAIN] (struct frame): Do not
declare fr_arg[NARGS] field if NARGS is zero.

7 years agoTravis CI: compile both for x86 and x64
Ivan Maidanski [Sun, 29 Jan 2017 05:51:30 +0000 (08:51 +0300)]
Travis CI: compile both for x86 and x64

7 years agoTravis CI: Exclude osx/gcc builds
Ivan Maidanski [Sun, 29 Jan 2017 05:39:43 +0000 (08:39 +0300)]
Travis CI: Exclude osx/gcc builds
(gcc is an alias to clang on OS X)

7 years agoFix AO_compiler_barrier definition in gc_atomic_ops private header
Ivan Maidanski [Thu, 26 Jan 2017 08:01:08 +0000 (11:01 +0300)]
Fix AO_compiler_barrier definition in gc_atomic_ops private header
(fix commit 46a2411)

See AO_compiler_barrier definition in gcc/generic.h of libatomic_ops.

* include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC]
(AO_compiler_barrier): Use __atomic_signal_fence(__ATOMIC_SEQ_CST)
instead of atomic_thread_fence.

7 years agoAppveyor CI: build/test with GCJ support
Ivan Maidanski [Thu, 26 Jan 2017 07:53:32 +0000 (10:53 +0300)]
Appveyor CI: build/test with GCJ support

7 years agoFix GCJ support in CMake build script
Ivan Maidanski [Wed, 25 Jan 2017 20:52:53 +0000 (23:52 +0300)]
Fix GCJ support in CMake build script

* CMakeLists.txt [enable_gcj_support] (SRC): Add gcj_mlc.c.
* CMakeLists.txt [enable_gcj_support] (ADD_DEFINITIONS):
Add -DGC_ENABLE_SUSPEND_THREAD only if enable_threads.

7 years agoAdd AO primitives implementation to GC based on C11 atomic intrinsic
Ivan Maidanski [Wed, 25 Jan 2017 09:16:56 +0000 (12:16 +0300)]
Add AO primitives implementation to GC based on C11 atomic intrinsic

* Makefile.direct (SRCS): Add include/private/gc_atomic_ops.h.
* include/include.am (dist_noinst_HEADERS): Likewise.
* include/private/gc_atomic_ops.h: New file; define needed AO entities
if GC_BUILTIN_ATOMIC, otherwise include atomic_ops.h.
* include/private/gc_locks.h [THREADS && GC_PTHREADS
&& !GC_WIN32_THREADS]: Include gc_atomic_ops.h instead of atomic_ops.h.
* include/private/gc_priv.h [PARALLEL_MARK || THREADS && MPROTECT_VDB]:
Likewise.
* include/private/specific.h: Likewise.
* pthread_stop_world.c: Include private/gc_atomic_ops.h instead of
atomic_ops.h.
* tests/subthread_create.c: Likewise.
* thread_local_alloc.c [THREAD_LOCAL_ALLOC && GC_GCJ_SUPPORT]: Likewise.
* typd_mlc.c [GC_FORCE_INCLUDE_ATOMIC_OPS || GC_BUILTIN_ATOMIC]:
Likewise.
* win32_threads.c [GC_DLL && !GC_NO_THREADS_DISCOVERY && !MSWINCE]:
Likewise.