summaryrefslogtreecommitdiff
path: root/extra
Commit message (Collapse)AuthorAgeFilesLines
* Fix 'totalMemoryUsed is assigned but never used' cppcheck warn in MacOS.cIvan Maidanski2023-03-201-6/+0
| | | | | | | | (fix of commit 5871f287e) * extra/MacOS.c [USE_TEMPORARY_MEMORY && !SHARED_LIBRARY_BUILD] (GC_MacFreeTemporaryMemory): Remove totalMemoryUsed local variable; do not call GetHandleSize().
* Define GC_print_stats as GC_INNERIvan Maidanski2023-03-161-9/+0
| | | | | | | | | | | | | | (refactoring) * extra/MacOS.c [USE_TEMPORARY_MEMORY && !SHARED_LIBRARY_BUILD] (GC_MacFreeTemporaryMemory): Do not use GC_print_stats (assume it is always zero). * include/private/gc_priv.h [!NO_CLOCK || !SMALL_CONFIG] (GC_print_stats): Declared as GC_EXTERN; refine comment. * misc.c [!NO_CLOCK || !SMALL_CONFIG] (GC_print_stats): Define as GC_INNER. * tests/gctest.c [!GC_PRINT_VERBOSE_STATS && !GCTEST_PRINT_VERBOSE] (GC_print_stats): Update comment.
* Fix typos in comments and documentation (regarding 'it is')Ivan Maidanski2023-01-171-1/+1
| | | | | | | | | | | | * ChangeLog (4.3): Fix typo ("it's"). * doc/platforms/README.amiga (GC_AMIGA_GC): Likewise. * extra/AmigaOS.c (GC_amiga_allocwrapper_any): Fix typo in comment ("it's"). * malloc.c (GC_free): Likewise. * new_hblk.c (GC_build_fl): Likewise. * os_dep.c [DATASTART_USES_BSDGETDATASTART] (GC_FreeBSDGetDataStart): Likewise. * reclaim.c (GC_start_reclaim): Likewise.
* Include gc_inline.h from gc_priv.hIvan Maidanski2022-10-111-1/+0
| | | | | | | | | | | | | | | | | | | (refactoring) Also, use EXPECT(FALSE) for GC_ASSERT. * extra/gc.c: Do not include gc_inline.h. * fnlz_mlc.c [ENABLE_DISCLAIM]: Likewise. * include/private/thread_local_alloc.h [THREAD_LOCAL_ALLOC]: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * pthread_support.c: Likewise. * reclaim.c: Likewise. * typd_mlc.c: Likewise. * include/private/gc_priv.h: Move GC_ASSERT definition upper; include gc_inline.h (after GC_ASSERT); define PTRFREE and NORMAL to GC_I_PTRFREE and GC_I_NORMAL, respectively. * include/private/gc_priv.h [GC_ASSERTIONS] (GC_ASSERT): Use EXPECT().
* Adjust naming of Win32/64 and x86/64 words in comments and documentationIvan Maidanski2022-09-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ChangeLog: Replace i386 and X86 to x86; replace x86_64 and amd64 to x64; replace "Win32 pthreads" to pthreads-win32; lower case win32s, x86, x64; replace win32 to Win32; replace "MS Windows" to Windows (in documentation and comments). * NT_MAKEFILE: Likewise. * README.md: Likewise. * configure.ac: Likewise. * cord/tests/de_win.c: Likewise. * doc/README.macros: Likewise. * doc/README.solaris2: Likewise. * doc/README.win32: Likewise. * doc/README.win64: Likewise. * doc/debugging.md: Likewise. * doc/leak.md: Likewise. * doc/overview.md: Likewise. * doc/porting.md: Likewise. * extra/msvc_dbg.c: Likewise. * finalize.c: Likewise. * include/gc/cord.h: Likewise. * include/gc/gc.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * mach_dep.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * os_dep.c: Likewise. * tools/threadlibs.c: Likewise. * win32_threads.c: Likewise. * cord/tests/de.c (WIN32): Remove misleading comment. * misc.c (GC_enable_incremental): Change comment about win32s to TODO item.
* Include gc/gc[_cpp].h directly except for cord and testsIvan Maidanski2022-09-141-1/+1
| | | | | | | | | | | | | | | (refactoring) * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER]: Include "gc/gc.h" instead of "gc.h". * gc_badalc.cc: Likewise. * gc_cpp.cc: Likewise. * include/private/gc_alloc_ptrs.h: Likewise. * include/private/gc_atomic_ops.h [GC_BUILTIN_ATOMIC]: Likewise. * include/private/gc_priv.h [!GC_H]: Likewise. * gc_cpp.cc: Include "gc/gc_cpp.h" instead of "gc_cpp.h". * include/private/gcconfig.h: Change include gc.h to include gc/gc.h in comment.
* Remove extra space after comma in license termsIvan Maidanski2022-05-014-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (reformatting) * CMakeLists.txt: Remove an extra space after comma in license header comment. * Makefile.am: Likewise. * allchblk.c: Likewise. * alloc.c: Likewise. * backgraph.c: Likewise. * blacklst.c: Likewise. * checksums.c: Likewise. * configure.ac: Likewise. * cord/cordbscs.c: Likewise. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * cord/tests/cordtest.c: Likewise. * cord/tests/de.c: Likewise. * cord/tests/de_cmds.h: Likewise. * cord/tests/de_win.c: Likewise. * cord/tests/de_win.h: Likewise. * cord/tests/de_win.rc: Likewise. * darwin_stop_world.c: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * extra/gc.c: Likewise. * extra/msvc_dbg.c: Likewise. * extra/pcr_interface.c: Likewise. * extra/real_malloc.c: Likewise. * finalize.c: Likewise. * fnlz_mlc.c: Likewise. * gc_badalc.cc: Likewise. * gc_cpp.cc: Likewise. * gc_dlopen.c: Likewise. * gcj_mlc.c: Likewise. * headers.c: Likewise. * include/gc/cord.h: Likewise. * include/gc/cord_pos.h: Likewise. * include/gc/ec.h: Likewise. * include/gc/gc.h: Likewise. * include/gc/gc_backptr.h: Likewise. * include/gc/gc_config_macros.h: Likewise. * include/gc/gc_disclaim.h: Likewise. * include/gc/gc_gcj.h: Likewise. * include/gc/gc_inline.h: Likewise. * include/gc/gc_mark.h: Likewise. * include/gc/gc_pthread_redirects.h: Likewise. * include/gc/gc_tiny_fl.h: Likewise. * include/gc/gc_typed.h: Likewise. * include/gc/gc_version.h: Likewise. * include/gc/javaxfc.h: Likewise. * include/gc/leak_detector.h: Likewise. * include/include.am: Likewise. * include/private/darwin_semaphore.h: Likewise. * include/private/darwin_stop_world.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_alloc_ptrs.h: Likewise. * include/private/gc_atomic_ops.h: Likewise. * include/private/gc_hdrs.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/pthread_stop_world.h: Likewise. * include/private/pthread_support.h: Likewise. * include/private/specific.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * m4/gc_set_version.m4: Likewise. * mach_dep.c: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * mark.c: Likewise. * mark_rts.c: Likewise. * misc.c: Likewise. * new_hblk.c: Likewise. * obj_map.c: Likewise. * os_dep.c: Likewise. * pthread_start.c: Likewise. * pthread_stop_world.c: Likewise. * pthread_support.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * specific.c: Likewise. * tests/atomicops.c: Likewise. * tests/cpp.cc: Likewise. * tests/disclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/gctest.c: Likewise. * tests/tests.am: Likewise. * tests/weakmap.c: Likewise. * thread_local_alloc.c: Likewise. * tools/setjmp_t.c: Likewise. * tools/threadlibs.c: Likewise. * typd_mlc.c: Likewise. * win32_threads.c: Likewise. * LICENSE: Remove an extra space after comma in license terms.
* Remove extra parentheses in return statementIvan Maidanski2022-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) Also, replace 0 to NULL where appropriate. * allchblk.c (setup_header, GC_get_first_part, GC_allochblk_nth): Remove outermost parentheses in the expression of return statement. * alloc.c (GC_never_stop_func, GC_timeout_stop_func, GC_adj_bytes_allocd, GC_try_to_collect_inner, GC_collect_a_little, GC_stopped_mark, GC_try_to_collect_general, GC_expand_hp_inner, GC_collect_or_expand, GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed, GC_number_stack_black_listed, total_stack_black_listed): Likewise. * checksums.c (GC_checksum): Likewise. * cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_len, CORD_index_access_fn, CORD_apply_access_fn, CORD_substr_checked, CORD_substr, CORD_iter5, CORD_iter, CORD_riter4, CORD_riter, CORD_concat_forest, CORD_balance, CORD__pos_fetch, CORD__prev, CORD_prev, CORD_pos_to_cord, CORD_pos_valid): Likewise. * cord/cordprnt.c (extract_conv_spec, CORD_vsprintf, CORD_sprintf, CORD_fprintf, CORD_vfprintf, CORD_printf, CORD_vprintf): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_catn, CORD_fill_proc, CORD_batched_fill_proc, CORD_cmp, CORD_ncmp, CORD_to_char_star, CORD_from_char_star, CORD_to_const_char_star, CORD_fetch, CORD_put_proc, CORD_batched_put_proc, CORD_put, CORD_chr_proc, CORD_rchr_proc, CORD_batched_chr_proc, CORD_chr, CORD_rchr, CORD_str, CORD_from_file_eager, CORD_lf_func, CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Likewise. * cord/tests/cordtest.c (test_fn, id_cord_fn, test_basics): Likewise. * cord/tests/de.c (line_pos, add_hist, retrieve_line, beep): Likewise. * cord/tests/de_win.c (WinMain, plain_chars, control_chars, WndProc): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc, GC_debug_realloc, GC_make_closure): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * extra/real_malloc.c (real_malloc): Likewise. * finalize.c (GC_register_disappearing_link, GC_unregister_disappearing_link): Likewise. * gc_dlopen.c (dlopen): Likewise. * gcj_mlc.c (maybe_finalize, GC_debug_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * headers.c (GC_find_header, alloc_hdr, get_index, GC_install_header, GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc): Likewise. * mallocx.c (GC_realloc, GC_generic_malloc_ignore_off_page): Likewise. * mark.c (GC_collection_in_progress, GC_mark_some, GC_signal_mark_stack_overflow, GC_block_was_dirty, GC_push_next_marked, GC_push_next_marked_dirty, GC_push_next_marked_uncollectable): Likewise. * mark_rts.c (GC_is_static_root, rt_hash, GC_roots_present, GC_remove_tmp_roots, GC_approx_sp): Likewise. * misc.c (GC_default_oom_fn, GC_clear_stack_inner, GC_base, GC_write, GC_get_warn_proc, GC_call_with_alloc_lock): Likewise. * new_hblk.c (GC_build_fl_clear2, GC_build_fl_clear4, GC_build_fl2, GC_build_fl4, GC_build_fl): Likewise. * obj_map.c (GC_register_displacement_inner): Likewise. * os_dep.c (GC_find_limit_openbsd, GC_skip_hole_openbsd, GC_get_writable_length, GC_get_writable_length, GC_get_main_stack_base, GC_FreeBSDGetDataStart, GC_unix_mmap_get_mem, GC_unix_sbrk_get_mem, os2_alloc, GC_wince_get_mem, GC_win32_get_mem, GC_push_thread_stack, GC_push_old_obj, GC_write_fault_handler, catch_exception_raise_state, catch_exception_raise_state_identity): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread, GC_get_nprocs, pthread_sigmask, pthread_create): Likewise. * ptr_chck.c (GC_same_obj, GC_default_is_visible_print_proc, GC_default_is_valid_displacement_print_proc, GC_is_visible, GC_pre_incr, GC_post_incr): Likewise. * reclaim.c (GC_block_empty, GC_reclaim_uninit, GC_n_set_marks, GC_reclaim_all): Likewise. * tests/cpp.cc (main): Likewise. * tests/gctest.c (fake_gcj_mark_proc, reverse1, reverse, ints, gcj_reverse1, gcj_reverse, gcj_ints, uncollectable_ints, mktree, alloc8bytes, main, test): Likewise. * tools/if_mach.c (main): Likewise. * tools/if_not_there.c (main): Likewise. * tools/setjmp_t.c (getpagesize, main, g): Likewise. * typd_mlc.c (GC_add_ext_descriptor, GC_add_ext_descriptor, GC_double_descr, GC_make_array_descriptor, GC_make_sequence_descriptor, GC_typed_mark_proc, GC_descr_obj_size, GC_push_complex_descriptor, GC_array_mark_proc, GC_make_descriptor, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner, GC_get_stack_min, GC_pthread_create, GC_pthread_start_inner): Likewise. * allchblk.c (GC_get_first_part, GC_allochblk_nth): Replace 0 to NULL where appropriate. * alloc.c (GC_allocobj): Likewise. * blacklst.c (GC_is_black_listed): Likewise. * cord/cordbscs.c (CORD_from_fn_inner, CORD_substr_checked): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_to_char_star, CORD_from_char_star, CORD_lf_func, CORD_from_file_lazy_inner): Likewise. * dbg_mlc.c (store_debug_info, GC_debug_generic_malloc, GC_debug_generic_malloc): Likewise. * dyn_load.c (GC_FirstDLOpenedLinkMap): Likewise. * gcj_mlc.c (GC_debug_gcj_malloc): Likewise. * headers.c (GC_next_block, GC_prev_block): Likewise. * malloc.c (GC_generic_malloc, strdup): Likewise. * mallocx.c (GC_realloc): Likewise. * misc.c (GC_default_oom_fn, GC_base): Likewise. * os_dep.c (GC_get_main_stack_base, os2_alloc, GC_win32_get_mem): Likewise. * pthread_support.c (GC_new_thread, GC_lookup_thread): Likewise. * ptr_chck.c (GC_same_obj, GC_is_visible, GC_default_is_valid_displacement_print_proc): Likewise. * tests/gctest.c (mktree): Likewise. * typd_mlc.c (GC_make_array_descriptor, GC_push_complex_descriptor, GC_array_mark_proc, GC_calloc_explicitly_typed): Likewise. * win32_threads.c (GC_new_thread, GC_lookup_thread_inner): Likewise. * alloc.c (GC_never_stop_func, GC_timeout_stop_func): Replace 0 and 1 (in return statement) to FALSE and TRUE, respectively. * include/private/gcconfig.h: Remove outermost parentheses in the expression of return statement in comment.
* Adjust indentation in C preprocessor directivesIvan Maidanski2022-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | (reformatting) * cord/tests/de.c: Adjust indentation in directives. * cord/tests/de_win.c: Likewise. * dbg_mlc.c: Likewise. * dyn_load.c: Likewise. * extra/AmigaOS.c: Likewise. * include/gc/ec.h: Likewise. * include/gc/gc_tiny_fl.h: Likewise. * include/private/gc_locks.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/gcconfig.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * malloc.c: Likewise. * mark.c: Likewise. * os_dep.c: Likewise. * ptr_chck.c: Likewise. * reclaim.c: Likewise. * tests/gctest.c: Likewise. * tools/threadlibs.c: Likewise.
* Move public header files to include/gc in source treeIvan Maidanski2021-11-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, include/extra public header files (for the redirection) are moved to include directory. This is have the same directories structure of public headers in the source tree as that of the installed "include" directory. * doc/finalization.md: Remove "include/" prefix for cord.h. * LICENSE: Rename include/gc_allocator.h to gc/gc_allocator.h. * Makefile.direct (CORD_SRCS, CORD_INCLUDE_FILES): Add "gc/" prefix for cord.h, ec.h, cord_pos.h. * CMakeLists.txt [install_headers]: Likewise. * cord/cord.am (pkginclude_HEADERS): Likewise. * Makefile.direct (SRCS, tests/test.o, dyn_load.o, dyn_load_sunos53.o, mark.o, typd_mlc.o, finalize.o, ptr_chck.o, specific.o, alloc.o, pthread_support.o, thread_local_alloc.o, win32_threads.o): Add "gc/" prefix for gc_typed.h, gc_tiny_fl.h, gc_version.h, gc_inline.h, gc_mark.h, gc_disclaim.h, gc_allocator.h, javaxfc.h, gc_backptr.h, gc_gcj.h, leak_detector.h, gc_pthread_redirects.h, gc_config_macros.h. * NT_MAKEFILE (test.obj): Add gc\ prefix for gc_mark.h, gc_disclaim.h. * NT_MAKEFILE (cord\tests\de.obj, cord\tests\de_win.obj): Add gc\ prefix for cord.h, cord_pos.h. * OS2_MAKEFILE (cord\cordbscs.obj, cord\cordxtra.obj, cord\cordprnt.obj, cordtest.exe): Likewise. * cord/cordbscs.c: Add "gc/" prefix in include for cord.h, ec.h; reorder includes. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * cord/tests/cordtest.c: Likewise. * cord/tests/de.c: Likewise. * cord/tests/de_win.c: Likewise. * extra/gc.c: Add "gc/" prefix in include for gc_inline.h, gc_pthread_redirects.h, javaxfc.h, gc_disclaim.h, gc_gcj.h, gc_backptr.h, gc_mark.h, gc_tiny_fl.h, leak_detector.h., gc_typed.h. * finalize.c: Likewise. * fnlz_mlc.c: Likewise. * gcj_mlc.c: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * include/private/thread_local_alloc.h: Likewise. * malloc.c: Likewise. * mallocx.c: Likewise. * pthread_stop_world.c: Likewise. * pthread_support.c: Likewise. * reclaim.c: Likewise. * tests/disclaim_bench.c: Likewise. * tests/disclaim_test.c: Likewise. * tests/disclaim_weakmap_test.c: Likewise. * tests/leak_test.c: Likewise. * tests/staticrootstest.c: Likewise. * tests/test.c: Likewise. * tests/thread_leak_test.c: Likewise. * tests/trace_test.c: Likewise. * thread_local_alloc.c: Likewise. * typd_mlc.c: Likewise. * tests/test_cpp.cc: Add "gc/" prefix in include for gc_allocator.h. * include/extra/gc.h: Move to include folder; replace include<> to include "". * include/extra/gc_cpp.h: Likewise. * include/cord.h: Move to include/gc folder. * include/cord_pos.h: Likewise. * include/ec.h: Likewise. * include/gc.h: Likewise. * include/gc_allocator.h: Likewise. * include/gc_backptr.h: Likewise. * include/gc_config_macros.h: Likewise. * include/gc_cpp.h: Likewise. * include/gc_disclaim.h: Likewise. * include/gc_gcj.h: Likewise. * include/gc_inline.h: Likewise. * include/gc_mark.h: Likewise. * include/gc_pthread_redirects.h: Likewise. * include/gc_tiny_fl.h: Likewise. * include/gc_typed.h: Likewise. * include/gc_version.h: Likewise. * include/javaxfc.h: Likewise. * include/leak_detector.h: Likewise. * include/include.am (pkginclude_HEADERS): Add "gc/" prefix for gc.h, gc_backptr.h, gc_config_macros.h, gc_inline.h, gc_mark.h, gc_tiny_fl.h, gc_typed.h, gc_version.h, javaxfc.h, leak_detector.h, gc_disclaim.h, gc_gcj.h, gc_pthread_redirects.h, gc_allocator.h, gc_cpp.h. * CMakeLists.txt [install_headers]: Likewise. * include/include.am (include_HEADERS): Remove "extra/" prefix for gc_cpp.h, gc.h. * CMakeLists.txt [install_headers]: Likewise.
* Fix 'unresolved __imp__wsprintfA' linker error in msvc_dbg.c (MSVC)Ivan Maidanski2021-11-231-4/+8
| | | | | | | | | | | | | _snprintf does not require linking with user32.lib, unlike wsprintf. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER]: Include stdio.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GC_SNPRINTF): Define macro (to _snprintf). * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetDescriptionFromAddress): Reduce str size from 128 to 20; call GC_SNPRINTF() instead of wsprintf(); ensure trailing '\0' in str after GC_SNPRINTF().
* Remove msvc_dbg.h fileIvan Maidanski2021-11-231-3/+16
| | | | | | | | | | | | | | | | | | (refactoring) * NT_MAKEFILE (tests\test.obj): Remove msvc_dbg.h from dependencies. * README.md (Copyright & Warranty): Do not mention msvc_dbg.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER]: Do not include msvc_dbg.h; include stdlib.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (backtrace, backtrace_symbols): Declare (as extern C). * os_dep.c [GC_HAVE_BUILTIN_BACKTRACE && _MSC_VER] (backtrace, backtrace_symbols): Likewise. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (backtrace_symbols): Match argument types in the definition to those in the declaration. * include/include.am (EXTRA_DIST): Do not add msvc_dbg.h. * include/private/msvc_dbg.h: Remove.
* Eliminate '/GS can not protect parameters' MS VC warning in msvc_dbgIvan Maidanski2021-10-311-0/+4
| | | | * extra/msvc_dbg.c: Add pragma to disable MS warning C4748.
* Make all functions static in msvc_dbg.c except for backtrace[_symbols]Ivan Maidanski2021-10-121-82/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (MAX_SYM_NAME): Move from msvc_dbg.h. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetStackFramesFromContext): Declare before use. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetStackFrames, GetStackFramesFromContext, GetModuleNameFromAddress, GetSymbolNameFromAddress, GetFileLineFromAddress, GetDescriptionFromAddress, GetDescriptionFromStack): Define as static. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetModuleNameFromAddress, GetFileLineFromAddress): Declare local variables at top level. * extra/msvc_dbg.c [!_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (GetModuleNameFromStack, GetSymbolNameFromStack, GetFileLineFromStack): Remove. * include/private/msvc_dbg.h (MSVC_DBG_EXPORT): Always define as empty. * include/private/msvc_dbg.h (HANDLE, CONTEXT, GetStackFrames, GetStackFramesFromContext, GetModuleNameFromAddress, GetModuleNameFromStack, GetSymbolNameFromAddress, GetSymbolNameFromStack, GetFileLineFromAddress, GetFileLineFromStack, GetDescriptionFromAddress, GetDescriptionFromStack): Do not declare. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && _MSC_VER && !_M_ARM && !_M_ARM64 && !_M_X64]: Remove include of msvc_dbg.h. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && !_M_ARM && !_M_ARM64 && !_M_X64 && _MSC_VER] (WinMain): Do not pass GetFileLineFromStack, GetModuleNameFromStack and GetSymbolNameFromStack to UNTESTED().
* Workaround msvc_dbg.c build failure on arm[64] (MSVC)Ivan Maidanski2021-10-121-2/+4
| | | | | | | | | | | | | | | | | | As of now, backtrace() and backtrace_symbols() on Windows are implemented only for x86 (and only if MS VC compiler). * extra/msvc_dbg.c [!_M_X64 && _MSC_VER]: Skip entire file also if _M_ARM or _M_ARM64; add TODO item. * include/gc_config_macros.h [_MSC_VER && _MSC_VER>=1200 && !_AMD64_ && !_M_X64 && !_WIN32_WCE && !GC_HAVE_NO_BUILTIN_BACKTRACE && !GC_HAVE_BUILTIN_BACKTRACE] (GC_HAVE_BUILTIN_BACKTRACE): Do not define if _M_ARM or _M_ARM64. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && _MSC_VER && !_M_ARM && !_M_ARM64 && !_M_X64]: Include msvc_dbg.h. * tests/test.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && !_M_X64 && _MSC_VER] (WinMain): Do not pass GetFileLineFromStack, GetModuleNameFromStack and GetSymbolNameFromStack to UNTESTED() if _M_ARM or _M_ARM64.
* Fix missing GC_quiet declaration in pcr_interface.cIvan Maidanski2021-09-161-0/+2
| | | | * extra/pcr_interface.c (GC_quiet): Declare as extern variable.
* Replace SN_TARGET_ORBIS to PLATFORM_* and GC_NO_* macrosTim Cannell2021-07-141-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (cherry-pick of 6a86542, 366aaf6, f3b34f4 from Unity-Technologies/bdwgc) SN_TARGET_ORBIS macro is replaced (almost) with GC_NO_CAN_CALL_ATFORK, GC_NO_FREEBSD, GC_NO_NOSYS, GC_NO_TYPES, PLATFORM_GC_REG_STORAGE_SIZE, PLATFORM_GETMEM, PLATFORM_MACH_DEP, PLATFORM_STOP_WORLD, PLATFORM_WRITE ones. * alloc.c [!MACOS && !MSWINCE && !SN_TARGET_PSP2]: Test GC_NO_TYPES macro instead of SN_TARGET_ORBIS. * misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG && !NN_PLATFORM_CTR && !NINTENDO_SWITCH && !SN_TARGET_PSP2 && !AMIGA && !MSWIN32 && !MSWIN_XBOX1 && !__CC_ARM]: Likewise. * dyn_load.c [MACOS && !SN_TARGET_PSP2 && !_WIN32_WCE && !__CC_ARM]: Likewise. * extra/gc.c [PLATFORM_MACH_DEP]: Do not include mach_dep.c file. * extra/gc.c [PLATFORM_STOP_WORLD]: Do not include pthread_stop_world.c file. * include/gc_config_macros.h [__DragonFly__ || __FreeBSD_kernel__ || __FreeBSD__]: Do not define GC_FREEBSD_THREADS if GC_NO_FREEBSD. * include/private/gc_locks.h [GC_PTHREADS]: Do not test SN_TARGET_ORBIS macro. * include/private/gc_priv.h [!HBLKSIZE && (LARGE_CONFIG || !SMALL_CONFIG)]: Likewise. * include/private/gcconfig.h [USE_MUNMAP && !MUNMAP_THRESHOLD] (MUNMAP_THRESHOLD): Likewise. * include/private/gcconfig.h [GC_THREADS] (THREADS): Likewise. * include/private/gcconfig.h [(__FreeBSD__ || __DragonFly__ || __FreeBSD_kernel__) && !FREEBSD] (FREEBSD): Test GC_NO_FREEBSD macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [(__arm || __arm__ || __thumb__) && !NACL && !LINUX && !NETBSD && !FREEBSD && !OPENBSD && !DARWIN && !_WIN32 && !__CEGCC__ && !NN_PLATFORM_CTR && !SN_TARGET_PSP2 && !SYMBIAN] (NOSYS): Test GC_NO_NOSYS macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [SN_TARGET_ORBIS && (__amd64__ || __x86_64__)] (X86_64): Do not define. * include/private/gcconfig.h [X86_64]: Test PLATFORM_GETMEM macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM] (OS_TYPE): Update value. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM]: Include pthread.h. * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM]: Declare platform_get_stack_bottom() instead of ps4_get_stack_bottom(). * include/private/gcconfig.h [X86_64 && PLATFORM_GETMEM] (STACKBOTTOM): Use platform_get_stack_bottom(). * include/private/gcconfig.h [CAN_HANDLE_FORK && !CAN_CALL_ATFORK !HOST_TIZEN && !HURD] (CAN_CALL_ATFORK): Test GC_NO_CAN_CALL_ATFORK macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [GC_PRIVATE_H]: Test PLATFORM_GETMEM macro instead of SN_TARGET_ORBIS. * include/private/gcconfig.h [GC_PRIVATE_H && PLATFORM_GETMEM] (platform_get_mem): Declare (instead of ps4_get_mem). * include/private/gcconfig.h [GC_PRIVATE_H && PLATFORM_GETMEM] (GET_MEM): Use platform_get_mem(). * include/private/pthread_stop_world.h [!GC_OPENBSD_UTHREADS && !NACL && !SN_TARGET_PSP2] (thread_stop_info.last_stop_count): Test PLATFORM_STOP_WORLD macro instead of SN_TARGET_ORBIS. * pthread_stop_world.c [GC_PTHREADS && !GC_WIN32_THREADS && !GC_DARWIN_THREADS]: Likewise. * include/private/pthread_stop_world.h [!NACL]: Test PLATFORM_HAVE_GC_REG_STORAGE_SIZE macro instead of SN_TARGET_ORBIS. * include/private/pthread_stop_world.h [!NACL && PLATFORM_HAVE_GC_REG_STORAGE_SIZE] (ORBIS_GC_REG_STORAGE_SIZE): Do not define. * include/private/pthread_stop_world.h [!NACL && PLATFORM_HAVE_GC_REG_STORAGE_SIZE] (thread_stop_info.registers): Use PLATFORM_GC_REG_STORAGE_SIZE instead of ORBIS_GC_REG_STORAGE_SIZE. * mach_dep.c [!SN_TARGET_PSP2]: Test PLATFORM_MACH_DEP macro instead of SN_TARGET_ORBIS. * misc.c [THREADS && !PCR && !SN_TARGET_PSP2] (GC_allocate_ml): Test GC_DEFN_ALLOCATE_ML macro instead of SN_TARGET_ORBIS. * misc.c [!MSWIN32 && !MSWINCE && !OS2 && !MACOS && !GC_ANDROID_LOG && !NN_PLATFORM_CTR && !NINTENDO_SWITCH] (GC_write): Test PLATFORM_WRITE macro instead of SN_TARGET_ORBIS.
* Eliminate 'Consecutive return is unnecessary' cppcheck style warningIvan Maidanski2021-06-131-1/+5
| | | | | | * extra/MacOS.c (GC_MacGetDataStart): Skip return if CPPCHECK; add comment. * extra/MacOS.c [far_data] (GC_MacGetDataEnd): Likewise.
* Fix a typo in msvc_dbg.c comment (machine)Tim Gates2021-06-101-1/+1
| | | | | | | Issue #340 (bdwgc). * extra/msvc_dbg.c [!_M_X64 && _MSC_VER]: Fix a typo ("machine") in comment.
* Move GC state non-pointer variables into GC_arraysIvan Maidanski2020-07-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (code refactoring) This commit is intended to simplify GC reinitialization. * alloc.c (GC_n_heap_sects, GC_fo_entries): Remove variable definition. * alloc.c [USE_PROC_FOR_LIBRARIES] (GC_n_memory): Likewise. * finalize.c [!GC_NO_FINALIZATION] (GC_log_fo_table_size): Likewise. * finalize.c [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED] (GC_toggleref_array_size, GC_toggleref_array_capacity): Likewise. * fnlz_mlc.c [ENABLE_DISCLAIM] (GC_finalized_kind): Likewise. * mark.c (GC_mark_stack_size, GC_mark_state, GC_mark_stack_too_small, GC_objects_are_marked): Likewise. * mark.c [PARALLEL_MARK] (GC_first_nonempty): Likewise. * mark.c [TRACE_BUF] (GC_trace_buf_ptr): Likewise. * mark_rts.c (n_root_sets, GC_roots_were_cleared, GC_excl_table_entries): Likewise. * os_dep.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_n_heap_bases): Likewise. * typd_mlc.c (GC_ed_size, GC_avail_descr, GC_explicit_typing_initialized): Likewise. * extra/MacOS.c (GC_fo_entries): Remove variable declaration. * include/private/gc_pmark.h (GC_mark_stack_size, GC_mark_stack_too_small, GC_mark_state): Likewise. * include/private/gc_priv.h (GC_n_heap_sects, GC_fo_entries): Likewise. * include/private/gc_priv.h [USE_PROC_FOR_LIBRARIES] (GC_n_memory): Likewise. * include/private/gc_pmark.h (mark_state_t): Move typedef to gc_priv.h. * include/private/gc_priv.h (_GC_arrays._scratch_end_ptr, _GC_arrays._scratch_last_end_ptr): Document. * include/private/gc_priv.h [PARALLEL_MARK] (_GC_arrays): Add _first_nonempty field. * include/private/gc_priv.h (_GC_arrays): Add _mark_stack_size, _mark_state, _mark_stack_too_small, _objects_are_marked, _n_heap_sects, _n_memory, _fo_entries, _n_root_sets, _excl_table_entries, _roots_were_cleared, _explicit_typing_initialized, _ed_size, _avail_descr fields. * include/private/gc_priv.h [USE_PROC_FOR_LIBRARIES] (_GC_arrays): Add _n_memory field. * include/private/gc_priv.h [MSWIN32 || MSWINCE || CYGWIN32] (_GC_arrays): Add _n_heap_bases field. * include/private/gc_priv.h [!GC_NO_FINALIZATION] (_GC_arrays): Add _log_fo_table_size field. * include/private/gc_priv.h [!GC_NO_FINALIZATION && !GC_TOGGLE_REFS_NOT_NEEDED] (_GC_arrays): Add _toggleref_array_size, _toggleref_array_capacity fields. * include/private/gc_priv.h [TRACE_BUF] (_GC_arrays): Add _trace_buf_ptr field. * include/private/gc_priv.h [ENABLE_DISCLAIM] (_GC_arrays): Add _finalized_kind field. * include/private/gc_priv.h (GC_first_nonempty, GC_mark_stack_size, GC_mark_state, GC_mark_stack_too_small, GC_objects_are_marked, GC_n_heap_sects, GC_n_memory, GC_n_heap_bases, GC_fo_entries, GC_log_fo_table_size, GC_toggleref_array_size, GC_toggleref_array_capacity, GC_trace_buf_ptr, GC_finalized_kind, n_root_sets, GC_excl_table_entries, GC_roots_were_cleared, GC_explicit_typing_initialized, GC_ed_size, GC_avail_descr): Define macro.
* Workaround 'argument to function is always 1' cppcheck false positivesIvan Maidanski2019-09-111-1/+1
| | | | | | | | | | | | | | | | | * allchblk.c (GC_print_hblkfreelist): Replace "while(p!=0)" with "while(p)"; add a marker that the change is for cppcheck. * allchblk.c (GC_free_block_ending_at, GC_add_to_fl, GC_split_block, GC_allochblk_nth, GC_freehblk): Replace "if(p!=0)" with "if(p)". * alloc.c (GC_set_fl_marks): Likewise. * extra/MacOS.c (GC_MacFreeTemporaryMemory): Likewise. * mallocx.c (GC_generic_malloc_many): Likewise. * allchblk.c (GC_allochblk_nth): Replace "if(0==p)" with "if(p){}else". * malloc.c (GC_free): Likewise. * malloc.c (GC_generic_malloc_uncollectable): Replace "if(0==p)return 0;<code>;return p;" with "if(p){<code>}return p;". * mallocx.c (GC_generic_malloc_many): Replace "p+=v;while((p2=*p)!=0)" with "for(p+=v;(p2=*p)!=0;)". * reclaim.c (GC_continue_reclaim, GC_reclaim_all): Likewise.
* Replace _M_AMD64 macro with _M_X64Ivan Maidanski2019-07-221-7/+6
| | | | | | | | | | | (code refactoring) Also, adjust strcat_s usage in msvc_dbg.c. * extra/msvc_dbg.c [_MSC_VER]: Check _M_X64 instead of _M_AMD64. * tests/test.c [CPPCHECK && _MSC_VER] (main): Likewise. * extra/msvc_dbg.c [_M_X64 && _MSC_VER<1200] (GetModuleBase): Use strcat() instead of strcat_s().
* Workaround 'var reassigned before old value use' cppcheck false positiveIvan Maidanski2018-11-291-0/+3
| | | | | | | | | | * extra/AmigaOS.c [!GC_AMIGA_ONLYFAST && CPPCHECK] (GC_amiga_allocwrapper_any): Add a dummy read of GC_amiga_dontalloc global variable; add comment. * pthread_support.c [CPPCHECK] (GC_do_blocking_inner): Add a dummy read of thread_blocked field of GC_thread. * pthread_support.c [CPPCHECK] (GC_call_with_gc_active): Add a dummy read of traced_stack_sect field of GC_thread.
* Workaround 'nonlocal var will use ptr to local var' cppcheck false positiveIvan Maidanski2018-11-221-4/+7
| | | | | | | | * extra/msvc_dbg.c (sym_namebuf_u): New union type. * extra/msvc_dbg.c (GetSymbolNameFromAddress): Use sym_namebuf_u instead of anonymous union. * os_dep.c [MPROTECT_VDB && DARWIN] (mp_reply_s, mp_msg_s): Move struct type definition out of GC_mprotect_thread (adding mp_ prefix).
* Eliminate 'unreferenced formal parameter' compiler warning in msvc_dbgIvan Maidanski2018-11-071-2/+3
| | | | | | | * extra/msvc_dbg.c (GetDescriptionFromAddress): Cast format argument to void. * extra/msvc_dbg.c (GetDescriptionFromStack): Pass format argument to GetDescriptionFromAddress (instead of NULL).
* Workaround 'pointer addition with NULL pointer' cppcheck error in msvc_dbgIvan Maidanski2018-11-071-8/+8
| | | | | | | * extra/msvc_dbg.c (GetDescriptionFromStack): Change type of begin, end, buffer local variables from char* to GC_ULONG_PTR; do not update size local variable value; do not store elements to description[] if description is NULL (instead of checking of size is non-zero).
* Remove strlen calls with a constant string argument in msvc_dbgIvan Maidanski2018-11-071-2/+2
| | | | | | | (code refactoring) * extra/msvc_dbg.c (GetDescriptionFromAddress): Replace strlen(<literal_str>) to sizeof(<literal_str>)-1.
* Workaround 'identical inner return condition always true' cppcheck warningIvan Maidanski2018-10-191-1/+1
| | | | | * extra/msvc_dbg.c (GetModuleBase): Change if(dwAddrBase) to if(dwAddrBase!=0).
* Update copyright information in alloc.c and gc.cIvan Maidanski2018-07-261-0/+1
| | | | | | | | | (fix of commit 3bd265a) * README.md (Copyright & Warranty): Adjust copyright date. * alloc.c: Update header copyright (add Ivan Maidanski). * extra/gc.c: Likewise. * alloc.c (GC_copyright): Update copyright string value.
* Consistently define WIN32_LEAN_AND_MEAN/NOSERVICE before include windows.hIvan Maidanski2018-06-201-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | (code refactoring) Note: these macros are not (and should not be) defined in the public headers (gc.h). * cord/tests/de.c [WIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Define macro before include windows.h. * cord/tests/de_win.c (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * extra/msvc_dbg.c (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/initsecondarythread.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/subthread_create.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/test.c [MSWIN32 || MSWINCE] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/test_cpp.cc [MSWIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tests/thread_leak_test.c [!GC_PTHREADS] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * tools/setjmp_t.c [MSWIN32 || MSWINCE || CYGWIN32] (WIN32_LEAN_AND_MEAN, NOSERVICE): Likewise. * cord/tests/de_win.c: Replace include "windows.h" to include <windows.h>.
* Remove stubborn.c fileIvan Maidanski2018-05-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (code refactoring) * BCC_MAKEFILE (XXXOBJS): Remove XXXstubborn.obj entry. * CMakeLists.txt (SRC): Remove stubborn.c entry. * Makefile.am (libgc_la_SOURCES): Likewise. * Makefile.direct (CSRCS): Likewise. * PCR-Makefile (CSRC): Likewise. * build/s60v3/libgc.mmp (SOURCE): Likewise. * doc/README.Mac (Files to build the GC libraries): Likewise. * Makefile.direct (OBJS): Remove stubborn.o entry. * PCR-Makefile (COBJ): Likewise. * SMakefile.amiga (OBJS): Likewise. * digimars.mak (OBJS): Likewise. * NT_MAKEFILE (OBJS): Remove stubborn.obj entry. * OS2_MAKEFILE (OBJS): Likewise. * WCC_MAKEFILE (OBJS): Likewise. * SMakefile.amiga (stubborn.o): Remove rule. * digimars.mak (stubborn.obj): Likewise. * extra/gc.c: Do not include stubborn.c. * gc.mak: Remove rules for stubborn.obj and stubborn.sbr. * mallocx.c [MANUAL_VDB] (GC_dirty): Move the function declaration from stubborn.c. * mallocx.c (GC_malloc_stubborn, GC_change_stubborn, GC_end_stubborn_change): Move the function implementation from stubborn.c. * stubborn.c: Delete file.
* Fix null pointer dereference in get_private_path_and_zero_file (Symbian)Ivan Maidanski2018-04-061-1/+2
| | | | | | | | | * extra/symbian.cpp (GC_get_private_path_and_zero_file): Do not call memcpy() if allocation of copyChar is failed. * os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON] (zero_fd): Initialize global variable to -1 (instead of 0). * os_dep.c [MMAP_SUPPORTED && !USE_MMAP_ANON && SYMBIAN] (GC_unix_mmap_get_mem): Do not call open() and free() if path is NULL.
* Eliminate 'there is pointer arithmetic with NULL' cppcheck warningIvan Maidanski2018-04-061-3/+7
| | | | | | | | * extra/msvc_dbg.c (GetDescriptionFromStack): Compare size to 0 instead of comparing description to NULL; mark format argument as used. * extra/msvc_dbg.c (backtrace_symbols): Do not call GetDescriptionFromStack if symbols (description) is NULL but size is non-zero.
* Include malloc.c in extra/gc.c after include gc_inline.hIvan Maidanski2018-03-231-1/+1
| | | | | | (code refactoring) * extra/gc.c: Move include malloc.c to be near include mallocx.c.
* Remove a redundant check of __cplusplus in Symbian-specific .cpp filesIvan Maidanski2018-02-284-41/+20
| | | | | | | | | | | | (code refactoring) * extra/symbian.cpp: Remove "#ifdef __cplusplus" as the latter should be defined (by default) in case of .cpp file. * extra/symbian/global_end.cpp: Likewise. * extra/symbian/global_start.cpp: Likewise. * extra/symbian/init_global_static_roots.cpp: Likewise. * extra/symbian/init_global_static_roots.cpp (GC_init_global_static_roots): Adjust indentation.
* Fiddle with linkage to make extra/gc.c valid C++ codeJay Krell2018-02-261-3/+6
| | | | | | | | | | | Issue #206 (bdwgc). Specifically: int i; int i = 0; is not valid, but: extern int i; int i = 0; is valid. Adding static would also be desirable here but requires a larger change. * extra/gc.c (GC_INNER, GC_EXTERN): Do not define if __cplusplus; add comment and TODO item.
* Eliminate C++ warnings about deprecated register keyword (GC source)Jay Krell2018-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #206 (bdwgc). * blacklst.c (GC_number_stack_black_listed, total_stack_black_listed): Remove register keyword for local variables. * dyn_load.c [IRIX5 || USE_PROC_FOR_LIBRARIES && !LINUX] (GC_register_dynamic_libraries): Likewise. * extra/pcr_interface.c [PCR] (GC_enumerate_block): Likewise. * finalize.c (GC_grow_table): Likewise. * headers.c (alloc_hdr, GC_init_headers, GC_remove_counts, GC_prev_block): Likewise. * include/private/gc_pmark.h (PUSH_OBJ): Likewise. * mach_dep.c [!HAVE_PUSH_REGS && !HAVE_BUILTIN_UNWIND_INIT] (GC_with_callee_saves_pushed): Likewise. * mark.c (clear_marks_for_block): Likewise. * mark_rts.c [MSWIN32 || MSWINCE || CYGWIN32] (GC_add_roots_inner): Likewise. * mark_rts.c [!NO_DEBUGGING] (GC_is_tmp_root): Likewise. * os_dep.c [GWW_VDB || MPROTECT_VDB || PROC_VDB || MANUAL_VDB] (GC_page_was_dirty): Likewise. * os_dep.c [CHECKSUMS && GWW_VDB || PROC_VDB] (GC_or_pages, GC_page_was_ever_dirty): Likewise. * os_dep.c (GC_write_fault_handler): Likewise. * os_dep.c [PROC_VDB] (GC_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Likewise. * os_dep.c [SAVE_CALL_CHAIN && NARGS>0] (GC_save_callers): Likewise. * pthread_stop_world.c [!NACL] (GC_start_world): Likewise. * pthread_support.c (GC_delete_thread, GC_delete_gc_thread): Likewise. * typd_mlc.c (GC_push_complex_descriptor): Likewise. * win32_threads.c (GC_delete_gc_thread_no_free, GC_delete_thread): Likewise.
* Fix arguments delimiter in pcr_interface.c (PCR)Ivan Maidanski2018-02-081-1/+1
| | | | | * extra/pcr_interface.c (GC_enumerate_block): Replace ';' with ',' in the arguments list.
* Change type of hb_sz field (of hblkhdr) from size_t to wordIvan Maidanski2018-02-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed to make the size of hb_sz to be the same as of AO_t. * allchblk.c [USE_MUNMAP] (GC_unmap_old): Cast hhdr->hb_sz to size_t when passed to GC_unmap(). * allchblk.c (GC_allochblk_nth): Cast hhdr->hb_sz to signed_word when assigned to size_avail. * allchblk.c [USE_MUNMAP] (GC_allochblk_nth): Cast hhdr->hb_sz to size_t when passed to GC_remap(). * alloc.c (GC_set_fl_marks, GC_clear_fl_marks): Change type of sz and bit_no local variables from size_t/unsigned to word. * dbg_mlc.c (GC_check_heap_block): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (per_object_helper): Cast hhdr->hb_sz to size_t; change type of i local variables from int to size_t. * checksums.c [CHECKSUMS] (GC_on_free_list): Change type of sz local variable from size_t to word. * mark.c (GC_push_marked, GC_push_unconditionally, GC_block_was_dirty): Likewise. * reclaim.c (GC_reclaim_small_nonempty_block, GC_disclaim_and_reclaim_or_free_small_block, GC_reclaim_block, GC_n_set_marks): Likewise. * checksums.c [CHECKSUMS] (GC_add_block): Remove bytes local variable (to avoid casting of hhdr->hb_sz). * dbg_mlc.c (GC_debug_free): Change type of i and obj_sz local variables from size_t to word. * dbg_mlc.c (GC_check_leaked): Likewise. * extra/pcr_interface.c (GC_enumerate_block): Change type of sz local variable from int to size_t. * extra/pcr_interface.c (GC_enumerate_block): Cast hhdr->hb_sz to size_t when assigned to sz. * mallocx.c (GC_realloc): Likewise. * mark.c (GC_set_hdr_marks): Likewise. * reclaim.c (GC_do_enumerate_reachable_objects): Likewise. * include/private/gc_pmark.h [MARK_BIT_PER_OBJ] (PUSH_CONTENTS_HDR): Cast hhdr->hb_sz to size_t in assignment of obj_displ. * include/private/gc_priv.h (struct hblkhdr): Change type of hb_sz from size_t to word. * include/private/gc_priv.h (MARK_BIT_NO): Cast offset argument to word instead of unsigned. * malloc.c (GC_free): Cast hhdr->hb_sz to size_t. * mallocx.c (GC_get_kind_and_size): Likewise. * mark.c (GC_clear_hdr_marks): Likewise. * misc.c (GC_size): Likewise. * misc.c (GC_do_blocking): Remove redundant cast of hhdr->hb_sz. * reclaim.c (GC_reclaim_clear, GC_reclaim_uninit, GC_disclaim_and_reclaim, GC_continue_reclaim): Change type of sz argument from size_t to word. * typd_mlc.c (GC_array_mark_proc): Change type of sz and nwords local variables from size_t to word.
* Eliminate 'boolean result used in bitwise op' cppcheck false warningIvan Maidanski2017-09-191-2/+3
| | | | | | | * extra/AmigaOS.c [GC_AMIGA_DS] (GC_register_data_segments): Replace (ULONG)&data[1] in comparison to (ULONG)(&data[1]). * misc.c [!THREADS && !SPARC] (GC_do_blocking_inner): Replace (ptr_t)&d in comparison to (ptr_t)(&d).
* Move pcr_interface.c, real_malloc.c to 'extra' folderIvan Maidanski2017-06-133-2/+219
| | | | | | | | | | | | | | | (code refactoring) * Makefile.am (EXTRA_DIST): Add extra/ prefix to pcr_interface.c, real_malloc.c. * PCR-Makefile (CSRC): Likewise. * PCR-Makefile (COBJ): Add extra/ prefix to pcr_interface.o, real_malloc.o. * extra/gc.c: Remove include pcr_interface.c; update comment about files which are not included. * pcr_interface.c: Move to "extra" folder. * real_malloc.c: Likewise. * include/private/gc_priv.h (GC_INNER, GC_EXTERN): Update comment.
* Eliminate 'condition ret==NULL always true' cppcheck style warning (Amiga)Ivan Maidanski2017-03-051-3/+6
| | | | | | | | | * 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.
* Fix various typos in comments and printed messagesKlemens Zwischenbrugger2017-02-211-2/+2
| | | | | | | | | | | | | | | | 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").
* Do not define amiga_get_mem, MacTemporaryNewPtr unless really used (extra)Ivan Maidanski2016-11-142-1/+7
| | | | | | | | * extra/AmigaOS.c (GC_amiga_get_mem): Define only if GC_AMIGA_FASTALLOC. * extra/MacOS.c (TemporaryMemoryBlock, TemporaryMemoryHandle, struct TemporaryMemoryBlock, theTemporaryMemory, GC_MacTemporaryNewPtr, perform_final_collection, GC_MacFreeTemporaryMemory): Define only if USE_TEMPORARY_MEMORY.
* Change no-argument functions declaration style to ANSI C (extra files)Ivan Maidanski2016-11-143-7/+7
| | | | | | | | * extra/AmigaOS.c (GC_get_main_stack_base, GC_register_data_segments): Replace "()" to "(void)" in the function prototype. * extra/MacOS.c (GC_MacGetDataStart, perform_final_collection, GC_MacFreeTemporaryMemory, GC_MacGetDataEnd): Likewise. * extra/msvc_dbg.c (GetSymHandle): Likewise.
* Replace C++ style comments to C ones, remove commented out code (extra)Ivan Maidanski2016-11-143-27/+18
| | | | | | | | | | | | * extra/AmigaOS.c (GC_amiga_get_mem, GC_amiga_allocwrapper_any, GC_amiga_allocwrapper_fast): Replace the style of comments from C++ to C. * extra/MacOS.c (CodeZeroPtr, GC_MacTemporaryNewPtr): Likewise. * extra/Mac_files/MacOS_config.h: Likewise. * extra/AmigaOS.c (GC_amiga_get_mem, GC_amiga_rec_alloc, GC_amiga_allocwrapper_any, GC_amiga_allocwrapper_fast): Remove commented out code. * extra/Mac_files/MacOS_config.h: Likewise.
* Eliminate 'ISO C forbids an empty translation unit' GCC pedantic warningIvan Maidanski2016-10-211-1/+6
| | | | | | | "extern int GC_quiet" is added to suppress compiler warning. * extra/msvc_dbg.c [_M_AMD64 || !_MSC_VER] (GC_quiet): Declare external variable.
* Workaround 'Uninitialized variable' cppcheck errorsIvan Maidanski2016-10-181-3/+2
| | | | | | | | | | | | | * extra/AmigaOS.c [GC_AMIGA_DS] (GC_register_data_segments): Initialize myseglist outside conditional statement. * mach_dep.c [GETCONTEXT_FPU_EXCMASK_BUG && X86_64] (GC_with_callee_saves_pushed): Call GC_noop1(&old_fcw) (before asm fstcw) if CPPCHECK. * mach_dep.c [!HAVE_BUILTIN_UNWIND_INIT] (GC_with_callee_saves_pushed): Replace regs with &regs. * os_dep.c [!MSWIN32 && !GC_OPENBSD_THREADS && ...] (GC_get_main_stack_base): Set result to NULL if CPPCHECK but none of HEURISTIC* and *STACKBOTTOM defined.
* Fix 'variable assigned a value that is never used' cppcheck style warningsIvan Maidanski2016-10-183-9/+7
| | | | | | | | | | | | | | * dyn_load.c [USE_PROC_FOR_LIBRARIES] (GC_register_map_entries): Remove datastart local variable. * extra/AmigaOS.c [GC_AMIGA_DS] (GC_register_data_segments): Remove num local variable. * extra/MacOS.c (firstTime): Remove. * extra/MacOS.c (GC_MacTemporaryNewPtr): Do not define firstTime if SHARED_LIBRARY_BUILD. * extra/MacOS.c (GC_MacFreeTemporaryMemory): Do not define (and update) totalMemoryUsed if SHARED_LIBRARY_BUILD. * extra/msvc_dbg.c (GetDescriptionFromAddress): Do not assign size variable when its value no longer used.
* Eliminate more 'scope of variable can be reduced' cppcheck style warningsIvan Maidanski2016-10-142-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * allchblk.c [MARK_BIT_PER_GRANULE] (setup_header): Move local variable declarations to the inner scope where the variables are actually used. * alloc.c [!SMALL_CONFIG] (GC_try_to_collect_inner, GC_finish_collection): Likewise. * alloc.c (GC_stopped_mark): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (add_edge): Likewise. * darwin_stop_world.c [GC_DARWIN_THREADS] (GC_push_all_stacks, GC_stop_world, GC_thread_resume): Likewise. * dyn_load.c [USE_PROC_FOR_LIBRARIES] (sort_heap_sects): Likewise. * dyn_load.c [ALPHA && OSF1 || HPUX] (GC_register_dynamic_libraries): Likewise. * dyn_load.c [DARWIN] (GC_dyld_image_add, GC_dyld_image_remove): Likewise. * extra/AmigaOS.c (GC_amiga_free_all_mem, GC_amiga_allocwrapper_any): Likewise. * extra/msvc_dbg.c (GetDescriptionFromAddress): Likewise. * gcj_mlc.c [GC_GCJ_SUPPORT] (GC_core_gcj_malloc, GC_gcj_malloc_ignore_off_page): Likewise. * include/new_gc_alloc.h (single_client_gc_alloc_template::deallocate, single_client_gc_alloc_template::ptr_free_deallocate, single_client_traceable_alloc_template::deallocate, single_client_traceable_alloc_template::ptr_free_deallocate): Likewise. * malloc.c [THREADS] (GC_free_inner): Likewise. * mark_rts.c (GC_add_roots_inner): Likewise. * misc.c (GC_clear_stack): Likewise. * os_dep.c [GWW_VDB] (GC_gww_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB] (GC_protect_heap): Likewise. * os_dep.c [PROC_VDB] (GC_read_dirty): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise): Likewise. * pthread_stop_world.c [GC_NETBSD_THREADS_WORKAROUND] (GC_start_world): Likewise. * pthread_support.c [!GC_NO_PTHREAD_SIGMASK] (pthread_sigmask): Likewise. * reclaim.c [!SMALL_CONFIG] (GC_reclaim_all): Likewise. * tests/test.c (run_one_test): Likewise. * tests/test.c [MACOS] (SetMinimumStack): Likewise. * thread_local_alloc.c [THREAD_LOCAL_ALLOC] (return_single_freelist): Likewise. * typd_mlc.c (GC_make_descriptor): Likewise. * win32_threads.c (GC_start_world, GC_CreateThread): Likewise. * win32_threads.c [!GC_PTHREADS_PARAMARK] (GC_start_mark_threads_inner): Likewise. * win32_threads.c [!MSWINCE && !CYGWIN32] (GC_beginthreadex): Likewise.