]> granicus.if.org Git - gc/log
gc
7 years agoFix gctest crash if configure --enable-handle-fork on Darwin
Ivan Maidanski [Wed, 28 Jun 2017 22:04:35 +0000 (01:04 +0300)]
Fix gctest crash if configure --enable-handle-fork on Darwin
(Cherry-pick commits 6bfc840b9ecb3a from 'master' branch.)

* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_incremental):
Refine comment.
* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL]
(GC_dirty_maintained): Remove variable declaration.
* include/private/gc_priv.h [!GC_DISABLE_INCREMENTAL] (GC_dirty_init):
Change return type from void to GC_bool; update comment.
* mark.c [!GC_DISABLE_INCREMENTAL || CHECKSUMS] (GC_initiate_gc):
Replace GC_dirty_maintained with GC_incremental.
* mark.c [!GC_DISABLE_INCREMENTAL && PROC_VDB] (GC_push_conditional):
Likewise.
* mark.c [!GC_DISABLE_INCREMENTAL] (GC_push_next_marked_dirty): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Likewise.
* os_dep.c [MPROTECT_VDB] (GC_remove_protection): Likewise.
* pthread_support.c [CAN_HANDLE_FORK && GC_DARWIN_THREADS
&& MPROTECT_VDB] (GC_atfork_prepare): Likewise.
* win32_threads.c [MPROTECT_VDB] (UNPROTECT_THREAD): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL] (GC_init): Set GC_incremental value
to the result of GC_dirty_init().
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Likewise.
* misc.c [!GC_DISABLE_INCREMENTAL && !KEEP_BACK_PTRS]
(GC_enable_incremental): Set GC_incremental to true just before GC_init
call (to indicate the intention to turn on GC incremental mode).
* os_dep.c [!GC_DISABLE_INCREMENTAL] (GC_dirty_maintained): Remove
global variable.
* os_dep.c [GWW_VDB && !MPROTECT_VDB] (GC_gww_dirty_init): Define macro
to GC_dirty_init.
* os_dep.c [GWW_VDB && !MPROTECT_VDB] (GC_dirty_init): Remove function.
* os_dep.c [DEFAULT_VDB || MANUAL_VDB || MPROTECT_VDB || PCR_VDB]
(GC_dirty_init): Change return type to GC_bool; return true; remove
assignment of GC_dirty_maintained.
* os_dep.c [PROC_VDB] (GC_dirty_init): Replace ABORT with WARN and
return false if "pagedata" file open failed.
* os_dep.c [MPROTECT_VDB && DARWIN && CAN_HANDLE_FORK]
(GC_dirty_init): Replace GC_COND_LOG_PRINTF() with WARN()
which is called before return; refine WARN message.
* os_dep.c [MPROTECT_VDB && DARWIN] (GC_dirty_init): Return false if
GC_handle_fork; add TODO item to replace ABORT with WARN (and return
false).

7 years agoDo not produce .tar.bz2 distribution file (configure)
Ivan Maidanski [Fri, 9 Jun 2017 08:05:00 +0000 (11:05 +0300)]
Do not produce .tar.bz2 distribution file (configure)

* configure.ac (AM_INIT_AUTOMAKE): Remove dist-bzip2.

7 years agoAdd minimal testing of GC_set_bit (gctest)
Ivan Maidanski [Tue, 20 Jun 2017 21:42:44 +0000 (00:42 +0300)]
Add minimal testing of GC_set_bit (gctest)

* tests/test.c (typed_test): Initialize bm3, bm2 local variables to zero;
call GC_set_bit to setup bm3 and bm2 (instead of direct hard-coding of
bm3 and bm2 values during their initialization).

7 years agoBetter document minimum value of size argument for typed allocations
Ivan Maidanski [Tue, 20 Jun 2017 22:07:12 +0000 (01:07 +0300)]
Better document minimum value of size argument for typed allocations

* include/gc_typed.h (GC_make_descriptor): Provide a better argument
name (in comment).
* include/gc_typed.h (GC_malloc_explicitly_typed,
GC_calloc_explicitly_typed): Explicitly state in comment that the
size of the object in words should not be less than the number of
significant bits in the specified descriptor.

7 years agoMake GC_INIT optional for clients even if thread-local allocations enabled
Ivan Maidanski [Fri, 23 Jun 2017 11:06:11 +0000 (14:06 +0300)]
Make GC_INIT optional for clients even if thread-local allocations enabled

* tests/test.c (GC_OPT_INIT): Do not define to GC_INIT() even if
THREAD_LOCAL_ALLOC; force define to GC_INIT() if TEST_EXPLICIT_GC_INIT
macro defined.
* thread_local_alloc.c [USE_PTHREAD_SPECIFIC || USE_WIN32_SPECIFIC]
(GC_malloc_kind): Check keys_initialized before GC_getspecific call
(fall back to GC_malloc_kind_global if keys_initialized is false).

7 years agoEnsure GC initialized when atfork_prepare is called by client
Ivan Maidanski [Fri, 23 Jun 2017 06:13:15 +0000 (09:13 +0300)]
Ensure GC initialized when atfork_prepare is called by client

Otherwise, if THREAD_LOCAL_ALLOC, GC_remove_all_threads_but_me would
not find the current thread descriptor in GC_threads.

* pthread_support.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Call GC_init
if not GC_is_initialized.
* win32_threads.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Likewise.

7 years agoFix compilation error in get_main_stack_base (Emscripten)
Ivan Maidanski [Tue, 20 Jun 2017 18:22:53 +0000 (21:22 +0300)]
Fix compilation error in get_main_stack_base (Emscripten)

Issue #163 (bdwgc).

* os_dep.c [!BEOS && !AMIGA && !OS2 && !MSWIN32 && !MSWINCE && !CYGWIN32
&& !GC_OPENBSD_THREADS && !STACKBOTTOM && !HEURISTIC1 && !HEURISTIC2
&& !LINUX_STACKBOTTOM && !FREEBSD_STACKBOTTOM] (GC_get_main_stack_base):
Set result to null if STACK_NOT_SCANNED (instead of #error).

7 years agoPrevent abort in register_data_segments for Symbian and Emscripten
Ivan Maidanski [Tue, 20 Jun 2017 14:05:20 +0000 (17:05 +0300)]
Prevent abort in register_data_segments for Symbian and Emscripten

Issue #163 (bdwgc).

DATASTART is tested to have a non-null value in GC_register_data_segments,
so the macro should not be defined to null even if it is not really
used (null value typically means that the corresponding weak symbol
is not resolved).

* include/private/gcconfig.h [SYMBIAN || __EMSCRIPTEN__] (DATASTART,
DATAEND): Change to a non-null value (ALIGNMENT).

7 years agoFix configure --disable-munmap handling
Ivan Maidanski [Thu, 29 Jun 2017 18:19:33 +0000 (21:19 +0300)]
Fix configure --disable-munmap handling
(Cherry-pick commit cb66553 from 'master' branch.)

* configure.ac (USE_MUNMAP, MUNMAP_THRESHOLD): Do not define if
enable_munmap is "no" (or a blank value).

7 years agoFix gctest failure if PARALLEL_MARK (musl)
Peter Wang [Thu, 22 Jun 2017 21:25:41 +0000 (00:25 +0300)]
Fix gctest failure if PARALLEL_MARK (musl)

Issue #159 (bdwgc).

The default stack size of threads in musl is not large enough for
GC with parallel markers enabled.  This commit increases the stack
of the created threads to the required minimum.

* include/private/gcconfig.h [PARALLEL_MARK && (HPUX
|| GC_DGUX386_THREADS || NO_GETCONTEXT)] (DEFAULT_STACK_MAYBE_SMALL):
New macro; add TODO item.
* include/private/gcconfig.h [PARALLEL_MARK || THREADS] (MIN_STACK_SIZE):
New macro.
* pthread_support.c (MIN_STACK_SIZE): Do not define.
* pthread_support.c (GC_start_mark_threads_inner): Check
DEFAULT_STACK_MAYBE_SMALL macro instead of HPUX or GC_DGUX386_THREADS.
* pthread_support.c [DEFAULT_STACK_MAYBE_SMALL]
(GC_start_mark_threads_inner): Do not set stack size if old_size is 0.
* pthread_support.c [GC_ASSERTIONS] (WRAP_FUNC(pthread_create)): Use
MIN_STACK_SIZE in GC_ASSERT.
* tests/test.c [GC_PTHREADS && DEFAULT_STACK_MAYBE_SMALL]
(fork_a_thread): Set stack size of the created thread to MIN_STACK_SIZE.
* tests/test.c [GC_PTHREADS] (main): Set size of the created thread
also if DEFAULT_STACK_MAYBE_SMALL is defined.

7 years agoUpdate AUTHORS file (add Hamayama)
Ivan Maidanski [Tue, 20 Jun 2017 08:58:15 +0000 (11:58 +0300)]
Update AUTHORS file (add Hamayama)

7 years agoFix typed_test to prevent fails in malloc_explicitly_typed (64-bit)
Hamayama [Tue, 20 Jun 2017 21:30:24 +0000 (00:30 +0300)]
Fix typed_test to prevent fails in malloc_explicitly_typed (64-bit)

Issue #166 (bdwgc).

* tests/test.c (typed_test): Pass 320*sizeof(word)+some_number instead
of 2000 to GC_malloc_explicitly_typed, so that to satisfy the size
argument requirement of the latter regardless of word size).

7 years agoFix null dereference in reclaim_block if DONT_ADD_BYTE_AT_END
Hamayama [Tue, 20 Jun 2017 08:56:20 +0000 (11:56 +0300)]
Fix null dereference in reclaim_block if DONT_ADD_BYTE_AT_END

Issue #167 (bdwgc).

* reclaim.c (GC_reclaim_block): If ok->ok_reclaim_list is null then
do not update hhdr->hb_next (and *rlh).

7 years agoFix ALL_INTERIOR_POINTERS name in comments and documentation
Ivan Maidanski [Fri, 16 Jun 2017 15:16:07 +0000 (18:16 +0300)]
Fix ALL_INTERIOR_POINTERS name in comments and documentation

* doc/gcdescr.html (Mark phase): Replace ALL_INTERIOR_PTRS with
ALL_INTERIOR_POINTERS.
* doc/tree.html: Likewise.
* include/private/gc_hdrs.h (HC_GET_HDR): Replace GC_all_interior_ptrs
with GC_all_interior_pointers in comment.

7 years agoConsistently use 'msec' instead of 'ms' in comments in pthread_support
Ivan Maidanski [Fri, 16 Jun 2017 14:48:37 +0000 (17:48 +0300)]
Consistently use 'msec' instead of 'ms' in comments in pthread_support

* pthread_support.c [USE_SPIN_LOCK] (GC_lock): Replace "ms" with "msecs"
in comment; put a space between number and "msec" (in comment).

7 years agoUpdate bdwgc mailing list online archive link in documentation
Ivan Maidanski [Fri, 16 Jun 2017 08:24:35 +0000 (11:24 +0300)]
Update bdwgc mailing list online archive link in documentation

* README.md (Feedback, Contribution, Questions and Notifications):
Update information about accessing the mailing list archive (add link
to that at Narkive site).
* doc/overview.html (Contacts and new release announcements): Replace
link to the mailing list archive at Gmane.org to that at Narkive.

7 years agoUpdate GCJ link in documentation
Ivan Maidanski [Fri, 16 Jun 2017 07:45:02 +0000 (10:45 +0300)]
Update GCJ link in documentation

* doc/gcdescr.html: Replace http://gcc.gnu.org/java link (which now
points to GCC itself) with https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcj/
one.
* doc/overview.html: Likewise.

7 years agoDocument GWW_VDB in gcdescr.html
Ivan Maidanski [Fri, 16 Jun 2017 07:39:16 +0000 (10:39 +0300)]
Document GWW_VDB in gcdescr.html

* doc/gcdescr.html (Generational Collection and Dirty Bits): Document
GWW_VDB.

7 years agoUpdate Download information in GC overview document
Ivan Maidanski [Tue, 13 Jun 2017 18:31:52 +0000 (21:31 +0300)]
Update Download information in GC overview document

* doc/overview.html: Change Download page link to that on GitHub; add
BDWGC acronym; remove link to gc.tar.gz; recommend to download
"recent stable" version; remove link to ancient boehm-gc in gcc;
provide link to the list of changes (for each version).

7 years ago.gitignore: Ignore test_atomic_ops
Ivan Maidanski [Wed, 14 Jun 2017 07:57:15 +0000 (10:57 +0300)]
.gitignore: Ignore test_atomic_ops

7 years agoFix pthread_start compilation if single-obj-compilation (Linux)
Ivan Maidanski [Thu, 8 Jun 2017 08:40:36 +0000 (11:40 +0300)]
Fix pthread_start compilation if single-obj-compilation (Linux)
(Cherry-pick commits 8240ed0b45d96b from 'master' branch.)

* Makefile.am [SINGLE_GC_OBJ && PTHREAD_START_STANDALONE] (AM_CPPFLAGS):
Add -DGC_PTHREAD_START_STANDALONE.
* Makefile.am [SINGLE_GC_OBJ && PTHREAD_START_STANDALONE]
(libgc_la_SOURCES): Add pthread_start.c entry.
* Makefile.am: Add bank lines (to improve readability).
* configure.ac (pthread_start_standalone): New variable.
* configure.ac [*-*-*linux* && THREADS=posix] (pthread_start_standalone):
Set to yes (instead of AM_CONDITIONAL(PTHREAD_START_STANDALONE) directly).
* configure.ac (PTHREAD_START_STANDALONE): AM_CONDITIONAL if
pthread_start_standalone.

7 years agoFix PCR-Makefile by removing compilation of a missing file
Ivan Maidanski [Thu, 8 Jun 2017 08:09:55 +0000 (11:09 +0300)]
Fix PCR-Makefile by removing compilation of a missing file

* PCR-Makefile (COBJ): Remove solaris_threads.o entry.
* PCR-Makefile (CSRC): Remove solaris_threads.c entry.

7 years agoEliminate 'unused variable' compiler warning in remove_all_threads_but_me
Ivan Maidanski [Wed, 7 Jun 2017 07:18:28 +0000 (10:18 +0300)]
Eliminate 'unused variable' compiler warning in remove_all_threads_but_me
(fix commit 0fc61f2)

* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Declare "res" local variable only if THREAD_LOCAL_ALLOC and
not USE_CUSTOM_SPECIFIC.

7 years agoRemove extraneous semicolons after AC_MSG_WARN (configure)
Ivan Maidanski [Tue, 6 Jun 2017 22:14:16 +0000 (01:14 +0300)]
Remove extraneous semicolons after AC_MSG_WARN (configure)
(Cherry-pick commit e86915e from 'master' branch.)

* configure.ac (AC_MSG_WARN): Remove trailing ';' symbol.

7 years agoFix broken external links in documentation
Ivan Maidanski [Tue, 6 Jun 2017 22:00:26 +0000 (01:00 +0300)]
Fix broken external links in documentation

* doc/gcdescr.html: Replace broken URLs to external document with
working ones.
* doc/overview.html: Likewise.

7 years agoUpdate documentation about bugs reporting and new releases notification
Ivan Maidanski [Tue, 6 Jun 2017 07:30:50 +0000 (10:30 +0300)]
Update documentation about bugs reporting and new releases notification
(Cherry-pick commits e3456e461fd9da from 'master' branch.)

* README.md (Download): Add link to BDWGC Download page on GitHub.
* README.md (Overview): Change link (for the further information) from
hboehm.info/gc to doc/overview.html.
* README.md (Bugs): Remove information about bugs reporting from this
section.
* README.md (Feedback, Contribution, Questions and Notifications): New
section.
* configure.ac (AC_INIT): Change URI for reporting bugs.
* doc/gc.man (SEE ALSO): Add link to the BDWGC main page on GitHub.
* doc/gcdescr.html: Remove information how to provide feedback.
* doc/overview.html (Contacts and Mailing List): Update information
(recommend use of GitHub and Stack Overflow, provide links to the
archives of the former mailing lists).

7 years agoUpdate several email addresses in AUTHORS file
Ivan Maidanski [Thu, 1 Jun 2017 19:14:09 +0000 (22:14 +0300)]
Update several email addresses in AUTHORS file

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Wed, 31 May 2017 18:10:07 +0000 (21:10 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Wed, 31 May 2017 17:27:58 +0000 (20:27 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoFix external libatomic_ops pkg-config-based detection
Ivan Maidanski [Mon, 29 May 2017 07:51:44 +0000 (10:51 +0300)]
Fix external libatomic_ops pkg-config-based detection

Fall back to AC_CHECK_HEADER-based detection of libatomic_ops library
if PKG_CHECK_MODULES failed to find the library.

* configure.ac [missing_libatomic_ops=true]: Call
AC_CHECK_HEADER(atomic_ops.h) and set missing_libatomic_ops=false if
atomic_ops.h is found; add comment.

7 years agoDo not require libatomic_ops for single-threaded builds (configure)
Ivan Maidanski [Mon, 29 May 2017 07:37:12 +0000 (10:37 +0300)]
Do not require libatomic_ops for single-threaded builds (configure)

* configure.ac [with_libatomic_ops!=no]: Do not call
PKG_CHECK_MODULES(ATOMIC_OPS) if THREADS = none
* configure.ac [with_libatomic_ops!=no] (which libatomic_ops to use):
Report "none" if if THREADS = none.

7 years agoImprove detection of internal libatomic_ops (configure)
Ivan Maidanski [Mon, 29 May 2017 07:22:39 +0000 (10:22 +0300)]
Improve detection of internal libatomic_ops (configure)

* configure.ac [with_libatomic_ops=no]: Check presence of
libatomic_ops/src/atomic_ops.h file instead of libatomic_ops/src
folder.

7 years agoUpdate AUTHORS file (add Bernd Kuhls)
Ivan Maidanski [Mon, 29 May 2017 06:39:10 +0000 (09:39 +0300)]
Update AUTHORS file (add Bernd Kuhls)

7 years agoFix 'missing libc-version.h' build error (uClibc/x86[_64])
Bernd Kuhls [Sun, 28 May 2017 18:21:09 +0000 (20:21 +0200)]
Fix 'missing libc-version.h' build error (uClibc/x86[_64])
(fix commit 3d34255)

uClibc defines __GLIBC__ but does not contain libc-version.h file.

* include/private/gcconfig.h [(I386 || X86_64) && LINUX && __GLIBC__]
(GLIBC_2_19_TSX_BUG): Do not define (and do not include
gnu/libc-version.h) if __UCLIBC__.

7 years agoFix typo in configure help message
Ivan Maidanski [Wed, 24 May 2017 21:37:01 +0000 (00:37 +0300)]
Fix typo in configure help message

* ChangeLog: Fix a typo ("an").
* configure.ac (libatomic-ops): Fix a typo ("an") in help message.

7 years agoEliminate 'conditional expression is always true' code defect in GC_init
Ivan Maidanski [Tue, 23 May 2017 07:17:12 +0000 (10:17 +0300)]
Eliminate 'conditional expression is always true' code defect in GC_init

* misc.c (GC_init): Move ALIGNMENT>GC_DS_TAGS expression from
"if" statement to #if.

7 years agoWorkaround 'int shift by negative amount' false code defect in finalize
Ivan Maidanski [Tue, 16 May 2017 21:40:33 +0000 (00:40 +0300)]
Workaround 'int shift by negative amount' false code defect in finalize
(Cherry-pick commits d46fbe059e156e from 'master' branch.)

* finalize.c (GC_register_disappearing_link_inner,
GC_register_finalizer_inner): Replace GC_ASSERT (for log_size) with
a conditional ABORT if LINT2.
* finalize.c [GC_ASSERTIONS || LINT2] (GC_finalize): Replace GC_ASSERT
(for curr_fo and log_fo_table_size) with a conditional ABORT.

7 years agoWorkaround 'comparison of identical expressions' false code defects
Ivan Maidanski [Tue, 23 May 2017 06:23:54 +0000 (09:23 +0300)]
Workaround 'comparison of identical expressions' false code defects

* thread_local_alloc.c [THREAD_LOCAL_ALLOC] (GC_init_thread_local):
New local variable (res); save result of GC_setspecific and
GC_key_create to res; replace res!=0 with COVERT_DATAFLOW(res)!=0.
* pthread_support.c [CAN_HANDLE_FORK] (GC_remove_all_threads_but_me):
Likewise.

7 years agoWorkaround 'array compared to 0', 'untrusted loop bound' false defects
Ivan Maidanski [Mon, 22 May 2017 22:01:08 +0000 (01:01 +0300)]
Workaround 'array compared to 0', 'untrusted loop bound' false defects
(Cherry-pick commit 36038e1 from 'master' branch.)

* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES]
(GC_FirstDLOpenedLinkMap): Wrap access to dynStructureAddr (which value
obtained from a weak symbol) into COVERT_DATAFLOW() in comparison to 0.
* dyn_load.c [HAVE_DL_ITERATE_PHDR && !DL_ITERATE_PHDR_STRONG]
(GC_register_main_static_data): Wrap access to dl_iterate_phdr weak
symbol into COVERT_DATAFLOW() in comparison to 0.
* dyn_load.c [HAVE_DL_ITERATE_PHDR] (GC_FirstDLOpenedLinkMap): Wrap
access to _DYNAMIC weak symbol into COVERT_DATAFLOW() in comparison to 0.
* include/private/gc_priv.h (TRUSTED_STRING): Pass the argument through
COVERT_DATAFLOW.
* include/private/gcconfig.h (COVERT_DATAFLOW): New macro.
* os_dep.c [SEARCH_FOR_DATA_START] (GC_init_linux_data_start): Wrap
access to __data_start and GC_data_start into COVERT_DATAFLOW() in
comparison to 0.
* tests/disclaim_bench.c: Update comment for include gc_priv.h.
* tests/disclaim_bench.c (main): Pass the integer value obtained from
command-line argument (and which is used as a loop boundary) through
COVERT_DATAFLOW().
* tests/test_cpp.cc (main): Likewise.

7 years agoWorkaround 'waiting while holding lock' code defect in stop_world (Unix)
Ivan Maidanski [Thu, 18 May 2017 09:00:45 +0000 (12:00 +0300)]
Workaround 'waiting while holding lock' code defect in stop_world (Unix)

* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && LINT2]
(GC_stop_world): Redefine WAIT_UNIT to 1; call sched_yield() instead
of usleep(); add comment.

7 years agoCompile thread_local_alloc only if multi-threaded build (Makefile.am)
Ivan Maidanski [Thu, 4 May 2017 21:26:31 +0000 (00:26 +0300)]
Compile thread_local_alloc only if multi-threaded build (Makefile.am)

* Makefile.am (libgc_la_SOURCES): Remove thread_local_alloc.c.
* Makefile.am [WIN32_THREADS || PTHREADS] (libgc_la_SOURCES): Add
thread_local_alloc.c.

7 years agoEliminate 'possible loss of data' MS VC warning in disclaim_and_reclaim
Ivan Maidanski [Fri, 21 Apr 2017 21:28:35 +0000 (00:28 +0300)]
Eliminate 'possible loss of data' MS VC warning in disclaim_and_reclaim

* reclaim.c [ENABLE_DISCLAIM] (GC_disclaim_and_reclaim): Change type
of bit_no local variable from int to word (matching that in other
GC_reclaim_* functions).

7 years agoEliminate 'possible loss of data' compiler warnings in cord (MS VC)
Ivan Maidanski [Thu, 20 Apr 2017 08:50:03 +0000 (11:50 +0300)]
Eliminate 'possible loss of data' compiler warnings in cord (MS VC)

* cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_from_fn_inner):
Add explicit cast in assignment of result->depth, result->len.
* cord/cordbscs.c (CORD_substr_checked): Change type of "j", "lim"
local variables from int to size_t.
* cord/cordbscs.c (CORD_init_min_len): Add explicit cast (to int) in
assignment of CORD_max_len.
* cord/cordxtra.c (CORD_ncmp): Add explicit cast (to long) when "avail"
local variable is updated.
* cord/cordxtra.c (CORD_chr, CORD_rchr, CORD_from_file_eager): Add
explicit cast to char (from int) for "c" local variable in assignment
of d.target and in CORD_ec_append call.
* cord/cordxtra.c (refill_cache): Add explicit cast to long (from
size_t) for line_start in fseek call.
* cord/tests/de.c (line_pos, fix_pos, do_command): Add explicit cast to
int in assignment of *c, line, col.
* cord/tests/de.c (do_command): Reset line, col and file_pos variables
(of different types) in separate statements.
* cord/tests/de_win.c (WinMain): Add explicit cast of msg.wParam to int
in return statement.

7 years agoEliminate 'incompatible function pointer' warning in mark_some (MinGW/x86)
Ivan Maidanski [Thu, 13 Apr 2017 16:19:00 +0000 (19:19 +0300)]
Eliminate 'incompatible function pointer' warning in mark_some (MinGW/x86)

* include/private/gc_priv.h [__MINGW32__ && __i386__ && GC_EXTERN]
(__MINGW_EXCPT_DEFINE_PSDK): Define (before any system header include);
this macro definition is needed only when extra/gc.c is compiled.
* mark.c [__MINGW32__ && __i386__] (__MINGW_EXCPT_DEFINE_PSDK): Define
(before include gc_pmark.h).

7 years agoEliminate 'unused formal parameter' compiler warnings in C++ code (MS VC)
Ivan Maidanski [Thu, 20 Apr 2017 08:17:20 +0000 (11:17 +0300)]
Eliminate 'unused formal parameter' compiler warnings in C++ code (MS VC)
(Cherry-pick commit 442bcbf from 'master' branch.)

* include/gc_allocator.h (GC_ATTR_UNUSED): Remove.
* tests/test_cpp.cc (ATTR_UNUSED): Likewise.
* include/gc_allocator.h (gc_allocator::deallocate,
gc_allocator_ignore_off_page::deallocate,
traceable_allocator::deallocate): Comment out unused argument name
instead of using GC_ATTR_UNUSED.
* include/gc_cpp.h [_MSC_VER && !GC_DEBUG] (operator new): Comment out
unused argument names.
* tests/test_cpp.cc [(MSWIN32 && !__MINGW32__ || MSWINCE)
&& !NO_WINMAIN_ENTRY] (WinMain): Comment out unused argument names
instead of using ATTR_UNUSED.

7 years agoEliminate 'locally defined symbol imported' MS linker warnings (cord)
Ivan Maidanski [Thu, 20 Apr 2017 21:54:16 +0000 (00:54 +0300)]
Eliminate 'locally defined symbol imported' MS linker warnings (cord)

* NT_X64_THREADS_MAKEFILE (.c.obj): Add -DCORD_NOT_DLL option.
* include/cord.h [GC_DLL] (CORD_API): Define to "extern" if CORD_NOT_DLL.

7 years agoSuppress MS VC warnings about unused param, const condition (NT_MAKEFILE)
Ivan Maidanski [Thu, 20 Apr 2017 21:15:14 +0000 (00:15 +0300)]
Suppress MS VC warnings about unused param, const condition (NT_MAKEFILE)

* NT_X64_STATIC_THREADS_MAKEFILE (.c.obj): Add /wd4100 /wd4127 options
(to suppress "unreferenced formal parameter" and
"conditional expression is constant" compiler warnings).
* NT_X64_THREADS_MAKEFILE (.c.obj): Likewise.

7 years agoPrevent multiple 'Caught ACCESS_VIOLATION in marker' per collection
Ivan Maidanski [Thu, 20 Apr 2017 21:22:10 +0000 (00:22 +0300)]
Prevent multiple 'Caught ACCESS_VIOLATION in marker' per collection

* mark.c [WRAP_MARK_SOME] (GC_mark_some): Do not call WARN() about
ACCESS_VIOLATION more than once per garbage collection.

7 years agoMove README.QUICK from DOC_FILES to OTHER_FILES in Makefile.direct
Ivan Maidanski [Thu, 11 May 2017 08:55:39 +0000 (11:55 +0300)]
Move README.QUICK from DOC_FILES to OTHER_FILES in Makefile.direct
(code refactoring)

README.QUICK file is not a part of installed libgc documentation.

* Makefile.direct (DOC_FILES): Remove README.QUICK item.
* Makefile.direct (OTHER_FILES): Add README.QUICK item.

7 years agoRemove all generated files by NT_X64_THREADS_MAKEFILE 'clean' target
Ivan Maidanski [Thu, 20 Apr 2017 09:05:29 +0000 (12:05 +0300)]
Remove all generated files by NT_X64_THREADS_MAKEFILE 'clean' target

* NT_X64_THREADS_MAKEFILE (clean): Delete also .exe, .log, .pdb, .exp,
.lib, .obj, .rbj, .res, *.dll, test_cpp.cpp files in cord, cord\tests,
extra, tests folders; redirect stderr for "del" utility to nul.

7 years agoRemove unused ALIGN_DOUBLE macro (TILE-Gx/Pro)
Ivan Maidanski [Thu, 18 May 2017 21:44:29 +0000 (00:44 +0300)]
Remove unused ALIGN_DOUBLE macro (TILE-Gx/Pro)
(fix commits e35a4171240658)

* doc/porting.html (ALIGN_DOUBLE): Remove documentation for the macro.
* include/private/gcconfig.h [TILEPRO, TILEGX] (ALIGN_DOUBLE): Remove
macro (no longer needed).

7 years agoRemove unused USE_GENERIC_PUSH_REGS macro definition (TILE-Gx/Pro)
Ivan Maidanski [Sat, 22 Apr 2017 14:31:10 +0000 (17:31 +0300)]
Remove unused USE_GENERIC_PUSH_REGS macro definition (TILE-Gx/Pro)
(fix commit 1240658)

* include/private/gcconfig.h [TILEPRO, TILEGX] (USE_GENERIC_PUSH_REGS):
Remove macro (not used).

7 years agoUse same style of include gc.h in documentation
Ivan Maidanski [Fri, 12 May 2017 14:11:38 +0000 (17:11 +0300)]
Use same style of include gc.h in documentation

* doc/README.darwin (Important usage notes): Include "gc.h" instead of
include <gc/gc.h>.

7 years agoRemove non-existent configure option in simple_example.html
Ivan Maidanski [Fri, 5 May 2017 08:07:34 +0000 (11:07 +0300)]
Remove non-existent configure option in simple_example.html

* doc/simple_example.html (Threads): Remove --enable-thread-local-alloc
option (for configure).

7 years agoRefine Makefile.direct comment about multi-threaded GC build
Ivan Maidanski [Mon, 17 Apr 2017 07:32:32 +0000 (10:32 +0300)]
Refine Makefile.direct comment about multi-threaded GC build

* Makefile.direct (CFLAGS): Refine comment how to build multi-threaded
collector in a general case.

7 years ago.gitignore: Ignore cord/tests/de_win.rbj
Ivan Maidanski [Sat, 22 Apr 2017 06:58:56 +0000 (09:58 +0300)]
.gitignore: Ignore cord/tests/de_win.rbj

7 years ago.gitignore: Ignore auto-generated test_cpp.cpp
Ivan Maidanski [Wed, 19 Apr 2017 21:17:55 +0000 (00:17 +0300)]
.gitignore: Ignore auto-generated test_cpp.cpp

7 years agoExpand tabs to spaces in de_win.rc (tests)
Ivan Maidanski [Wed, 19 Apr 2017 08:27:47 +0000 (11:27 +0300)]
Expand tabs to spaces in de_win.rc (tests)

* cord/tests/de_win.rc: Expand tabs to spaces; remove duplicate blank
lines.

7 years agoFix various typos in doc/README and .html files
Ivan Maidanski [Thu, 18 May 2017 22:52:59 +0000 (01:52 +0300)]
Fix various typos in doc/README and .html files
(Cherry-pick commit 6afeb18 from 'master' branch.)

* doc/README.Mac: Fix a typo ("command-line").
* doc/README.amiga: Fix typos ("recommendation", "compiling",
"favorably").
* doc/README.cords: Fix a typo ("and").
* doc/README.macros: Fix a typo ("canceled").
* doc/README.sgi: Fix a typo ("related").
* doc/README.solaris2: Fix a typo ("offset").
* doc/leak.html: Fix a typo ("e.g.").
* doc/overview.html: Fix a typo ("December").
* doc/porting.html: Fix typos ("not supported yet", "signaled",
"not defined yet").
* doc/scale.html: Fix typos ("free", "busy-waiting").
* doc/simple_example.html: Fix a typo ("have not yet").
* tests/test_cpp.cc (main): Fix a typo ("command line") in comment.

7 years agoFix unpaired quote symbol in README.Mac
Ivan Maidanski [Fri, 12 May 2017 14:21:19 +0000 (17:21 +0300)]
Fix unpaired quote symbol in README.Mac

* doc/README.Mac: Fix a typo (remove unpaired double-quote).

7 years agoFix typo in README.hp
Ivan Maidanski [Fri, 12 May 2017 07:05:59 +0000 (10:05 +0300)]
Fix typo in README.hp

* doc/README.hp: Fix typo ("recently") in documentation.

7 years agoFix typos in README.DGUX386
Ivan Maidanski [Fri, 5 May 2017 16:46:43 +0000 (19:46 +0300)]
Fix typos in README.DGUX386

* doc/README.DGUX386: Fix typos ("version", "x86", "parallel") in
documentation.

7 years agoFix 'doc' files installation folder
Andy Li [Tue, 9 May 2017 01:54:19 +0000 (09:54 +0800)]
Fix 'doc' files installation folder

Docs are dist_doc_DATA.  They should be installed to /usr/share/doc.

* doc/doc.am (dist_pkgdata_DATA): Move all items to dist_doc_DATA.

7 years agoFix OSF1 host pattern in CMakeLists.txt
Ivan Maidanski [Thu, 4 May 2017 21:49:53 +0000 (00:49 +0300)]
Fix OSF1 host pattern in CMakeLists.txt

* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && osf]: Replace ".*-.*-osf*"
pattern ".*-.*-osf.*" (a missing "." before "*" is added).

7 years agoFix missing win32_threads.c compilation for Cygwin (CMake)
Ivan Maidanski [Wed, 3 May 2017 08:09:50 +0000 (11:09 +0300)]
Fix missing win32_threads.c compilation for Cygwin (CMake)

* CMakeLists.txt [CMAKE_USE_PTHREADS_INIT && *-*-cygwin*] (SRC): Add
win32_threads.c.
* CMakeLists.txt (win32_threads): Remove commented out variable
definition.

7 years agoFix AO_SRC_DIR target name in NT_*_MAKEFILE
Ivan Maidanski [Tue, 18 Apr 2017 08:42:06 +0000 (11:42 +0300)]
Fix AO_SRC_DIR target name in NT_*_MAKEFILE

* NT_STATIC_THREADS_MAKEFILE (AO_SCR_DIR): Rename target to
$(AO_SRC_DIR).
* NT_X64_STATIC_THREADS_MAKEFILE (AO_SCR_DIR): Likewise.
* NT_X64_THREADS_MAKEFILE (AO_SCR_DIR): Likewise.

7 years agoFix a typo in comment in NT_MAKEFILE
Ivan Maidanski [Tue, 18 Apr 2017 08:37:26 +0000 (11:37 +0300)]
Fix a typo in comment in NT_MAKEFILE

* NT_MAKEFILE (gctest.exe): Fix typo ("application") in comment.
* NT_STATIC_THREADS_MAKEFILE (gctest.exe): Likewise.
* NT_X64_STATIC_THREADS_MAKEFILE (gctest.exe): Likewise.
* NT_X64_THREADS_MAKEFILE (gctest.exe): Likewise.

7 years agoUpdate AUTHORS file (add Ryan Gonzalez)
Ivan Maidanski [Thu, 13 Apr 2017 15:33:20 +0000 (18:33 +0300)]
Update AUTHORS file (add Ryan Gonzalez)

7 years agoFix crash in FirstDLOpenedLinkMap if app linked statically (Alpine Linux)
Ryan Gonzalez [Thu, 13 Apr 2017 15:31:00 +0000 (18:31 +0300)]
Fix crash in FirstDLOpenedLinkMap if app linked statically (Alpine Linux)

Issue #154 (bdwgc).

* dyn_load.c [SOLARISDL && !USE_PROC_FOR_LIBRARIES]
(GC_FirstDLOpenedLinkMap): Do not dereference d_un.d_ptr if it is null.
* dyn_load.c [(SCO_ELF || DGUX || HURD || LINUX || FREEBSD || NACL
|| NETBSD || OPENBSD) && !USE_PROC_FOR_LIBRARIES]
(GC_FirstDLOpenedLinkMap): Likewise.

7 years agoEliminate 'signed/unsigned mismatch' compiler warning in gctest (MS VC)
Ivan Maidanski [Thu, 20 Apr 2017 08:26:11 +0000 (11:26 +0300)]
Eliminate 'signed/unsigned mismatch' compiler warning in gctest (MS VC)
(fix commit 014d92d)

* tests/test.c (bm_huge): Add explicit casts of GC_signed_word values
to GC_word.

7 years agoUpdate ChangeLog file (v7.6 changes only)
Ivan Maidanski [Wed, 12 Apr 2017 22:07:27 +0000 (01:07 +0300)]
Update ChangeLog file (v7.6 changes only)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Wed, 12 Apr 2017 07:15:05 +0000 (10:15 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

7 years agoChangeLog: remove trailing dots
Ivan Maidanski [Wed, 5 Apr 2017 08:01:48 +0000 (11:01 +0300)]
ChangeLog: remove trailing dots
(Cherry-pick commit 1784ac2 from 'master' branch.)

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
(Cherry-pick commit 4dfe88e from 'master' branch.)

* 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 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 0e175f35dedb24)

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

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
(Cherry-pick commit 4fad4e5 from 'master' branch.)

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 agoUpdate shared libraries version info to differentiate against v7.4
Ivan Maidanski [Thu, 6 Apr 2017 09:13:03 +0000 (12:13 +0300)]
Update shared libraries version info to differentiate against v7.4

There are no API changes in libcord and libgccpp against release-7_4
but some implementation changes exist, 3:*:* version info is reserved
for release-7_4, so the version info for libcord and libgccpp is
now 4:0:3.

There some API changes in libgc against release-7_4, so the "current"
number of the version info is incremented, thus the full version info
is now 4:0:2.

* Makefile.am (LIBGC_VER_INFO): Change version info to 4:0:2
(release-7_4 is supposed to use 3:x:1).
* Makefile.am (LIBGCCPP_VER_INFO): Change version info to 4:0:3
(release-7_4 is supposed to use 3:x:2).
* cord/cord.am (LIBCORD_VER_INFO): Likewise.

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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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)
(Cherry-pick commit ded6139 from 'master' branch.)

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 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
(Cherry-pick commit 41db6f8 from 'master' branch.)

* 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 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.