summaryrefslogtreecommitdiff
path: root/cord/cordxtra.c
Commit message (Collapse)AuthorAgeFilesLines
* Use cast to void instead of the attribute to indicate unused argumentsIvan Maidanski2022-09-151-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (refactoring) * CMakeLists.txt [BORLAND] (add_compile_options): Remove "/w-par"; reorder options. * CMakeLists.txt [!BORLAND && MSVC] (add_compile_options): Remove "/wd4100"; update comment. * NT_MAKEFILE (.c.obj): Likewise. * allchblk.c [!NO_DEBUGGING || GC_ASSERTIONS] (add_hb_sz): Use UNUSED_ARG() instead of GC_ATTR_UNUSED. * allchblk.c [USE_MUNMAP] (GC_adjust_num_unmapped): Likewise. * backgraph.c [MAKE_BACK_GRAPH] (pop_in_progress, reset_back_edge, update_max_height): Likewise. * checksums.c [CHECKSUMS] (GC_add_block): Likewise. * darwin_stop_world.c (GC_stack_range_for): Likewise. * dbg_mlc.c (GC_store_debug_info_inner, GC_debug_change_stubborn, GC_check_heap_block): Likewise. * finalize.c [!GC_NO_FINALIZATION] (GC_null_finalize_mark_proc): Likewise. * gcj_mlc.c [GC_GCJ_SUPPORT] (GC_gcj_fake_mark_proc): Likewise. * mallocx.c [!CPPCHECK] (GC_change_stubborn): Likewise. * mark.c (GC_noop6, clear_marks_for_block): Likewise. * mark.c [WRAP_MARK_SOME && (MSWIN32 || MSWINCE) && __GNUC__] (mark_ex_handler): Likewise. * mark.c [GC_DISABLE_INCREMENTAL] (GC_push_conditional): Likewise. * mark_rts.c (GC_push_current_stack, GC_push_roots): Likewise. * misc.c (GC_default_oom_fn, GC_set_handle_fork): Likewise. * misc.c [THREADS && !SIGNAL_BASED_STOP_WORLD] (GC_set_suspend_signal, GC_set_thr_restart_signal): Likewise. * misc.c [THREADS && UNIX_LIKE && !NO_GETCONTEXT] (callee_saves_pushed_dummy_fn): Likewise. * misc.c [!THREADS] (GC_do_blocking_inner): Likewise. * misc.c [!PARALLEL_MARK] (GC_set_markers_count): Likewise. * os_dep.c [OPENBSD] (GC_fault_handler_openbsd): Likewise. * os_dep.c [NEED_FIND_LIMIT || WRAP_MARK_SOME && !MSWIN32 && !MSWINCE || USE_PROC_FOR_LIBRARIES && THREADS] (GC_fault_handler): Likewise. * os_dep.c [!HAVE_GET_STACK_BASE && !NEED_FIND_LIMIT] (GC_get_stack_base): Likewise. * os_dep.c [MPROTECT_VDB && DARWIN] (catch_exception_raise_state, catch_exception_raise_state_identity, catch_exception_raise): Likewise. * pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS && !SUSPEND_HANDLER_NO_CONTEXT] (GC_suspend_sigaction): Likewise. * pthread_stop_world.c [!NACL && !GC_OPENBSD_UTHREADS] (GC_suspend_handler_inner): Likewise. * pthread_support.c (GC_do_blocking_inner): Likewise. * pthread_support.c [GC_ENABLE_SUSPEND_THREAD && SIGNAL_BASED_STOP_WORLD] (GC_suspend_self_blocked): Likewise. * tests/gctest.c [!DBG_HDRS_ALL] (fail_proc1): Likewise. * tests/gctest.c [(MSWIN32 && !__MINGW32__ || MSWINCE) && !NO_WINMAIN_ENTRY] (WinMain): Likewise. * tests/gctest.c [!PCR && !GC_WIN32_THREADS && !GC_PTHREADS && CPPCHECK && RTEMS] (Init): Likewise. * tests/gctest.c [GC_WIN32_THREADS && !GC_PTHREADS] (thr_run_one_test): Likewise. * tests/gctest.c [MSWINCE] (thr_window): Likewise. * tests/gctest.c [GC_PTHREADS] (thr_run_one_test): Likewise. * typd_mlc.c (GC_array_mark_proc): Likewise. * win32_threads.c (GC_register_altstack, GC_do_blocking_inner): Likewise. * win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY] (GC_DllMain): Likewise. * cord/cordxtra.c (CORD_ATTR_UNUSED): Remove. * include/private/gc_priv.h [!GC_ATTR_UNUSED] (GC_ATTR_UNUSED): Likewise. * cord/cordxtra.c (CORD_nul_func): Cast unused argument to void instead of using CORD_ATTR_UNUSED. * cord/cordxtra.c [!GC_NO_FINALIZATION] (CORD_lf_close_proc): Likewise. * include/private/gc_priv.h [!UNUSED_ARG] (UNUSED_ARG): Define macro.
* Remove extra space after comma in license termsIvan Maidanski2022-05-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-91/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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.
* Fix linking of tests in case of finalization is offIvan Maidanski2022-04-221-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | (fix of commit c14335e44) * cord/cordxtra.c (CORD_lf_close_proc): Do not define if GC_NO_FINALIZATION. * cord/cordxtra.c (CORD_from_file_lazy_inner): Do not call GC_REGISTER_FINALIZER(CORD_lf_close_proc) if GC_NO_FINALIZATION. * cord/tests/cordtest.c (test_extras): Do not call GC_invoke_finalizers if GC_NO_FINALIZATION. * include/gc/gc_cpp.h (gc_cleanup::~gc_cleanup, gc_cleanup::gc_cleanup): Do not call GC_base() and GC_register_finalizer_ignore_self() if GC_NO_FINALIZATION. * include/gc/gc_cpp.h (operator new): Do not call GC_REGISTER_FINALIZER_IGNORE_SELF() if GC_NO_FINALIZATION. * tests/cpp.cc [FINALIZE_ON_DEMAND] (main): Do not call GC_invoke_finalizers() if GC_NO_FINALIZATION. * tests/disclaim_bench.c (testobj_new): Do not call GC_NEW() followed by GC_REGISTER_FINALIZER_NO_ORDER() if GC_NO_FINALIZATION. * tests/disclaim_bench.c [GC_NO_FINALIZATION] (main): Set model_min variable to 1 (instead of 0). * tests/gctest.c [GC_NO_FINALIZATION && !NO_TYPED_TEST] (NO_TYPED_TEST): Define macro.
* 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.
* Add GC_reachable_here after GC_END_STUBBORN_CHANGE in cordsIvan Maidanski2018-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | (fix of commit e12e820f3) * cord/cordbscs.c (CORD_cat_char_star, CORD_cat, CORD_from_fn_inner, CORD_substr_closure): Call GC_END_STUBBORN_CHANGE() instead of GC_end_stubborn_change(). * cord/cordxtra.c (refill_cache): Likewise. * cord/tests/de.c (prune_map, add_map, add_hist, replace_line, generic_init): Likewise. * cord/cordbscs.c (CORD_cat_char_star, CORD_cat): Mark x and y as reachable after GC_END_STUBBORN_CHANGE(result). * cord/cordbscs.c (CORD_from_fn_inner): Mark client_data as reachable after GC_END_STUBBORN_CHANGE(result). * cord/cordbscs.c (CORD_substr_closure): Mark x as reachable after GC_END_STUBBORN_CHANGE(sa). * cord/tests/de.c (prune_map): Mark saved map->previous->previous as reachable after GC_END_STUBBORN_CHANGE(map). * cord/tests/de.c (add_map): Mark saved current_map as reachable after GC_END_STUBBORN_CHANGE(new_map). * cord/tests/de.c (replace_line): Mark s as reachable after GC_END_STUBBORN_CHANGE(screen+i).
* Eliminate 'cast between incompatible function types' compiler warningIvan Maidanski2018-06-041-7/+6
| | | | | | | | | | | | | * cord/cordxtra.c (refill_cache): Add GC_CALLBACK; change return type from char to void*; change argument type from refill_data* to void*; add necessary casts to client_data and the return expression. * cord/cordxtra.c (CORD_lf_func): Do not cast refill_cache. * os_dep.c [MPROTECT_VDB] (GC_write_fault_handler, GC_mprotect_dirty_init): Cast SIG_DFL, SIG_IGN and oldact.sa_handler to SIG_HNDLR_PTR via signed_word type. * os_dep.c [MPROTECT_VDB && !MSWIN32 && !MSWINCE] (GC_write_fault_handler): Cast old_handler to PLAIN_HNDLR_PTR via signed_word type.
* Fix cords for MANUAL_VDBIvan Maidanski2018-05-231-0/+2
| | | | | | | | * cord/cordbscs.c (CORD_cat_char_star, CORD CORD_cat, CORD_from_fn_inner, CORD_substr_closure): Call GC_end_stubborn_change. * cord/cordxtra.c (refill_cache): Likewise. * cord/tests/de.c (prune_map, add_map, add_hist, replace_line, generic_init): Likewise.
* Eliminate C++ warning about deprecated register keyword (cord)Jay Krell2018-02-221-39/+40
| | | | | | | | | | | | | | | | | | | | | | | | Issue #206 (bdwgc). * cord/cordbscs.c (CORD_dump_inner, CORD_cat_char_star, CORD_cat, CORD_from_fn_inner, CORD_index_access_fn, CORD_apply_access_fn, CORD_substr_closure, CORD_substr_checked, CORD_substr, CORD_iter5, CORD_riter4, CORD_init_min_len, CORD_init_forest, CORD_add_forest, CORD_concat_forest, CORD_balance_insert, CORD_balance, CORD__extend_path, CORD__pos_fetch, CORD__next, CORD__prev, CORD_pos_fetch: Remove register keyword for local variables (and function parameters). * cord/cordprnt.c (extract_conv_spec, CORD_vsprintf): 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_put_proc, CORD_batched_put_proc, CORD_chr_proc, CORD_rchr_proc, CORD_batched_chr_proc, CORD_str, CORD_ec_flush_buf, CORD_from_file_eager, refill_cache, CORD_lf_func, CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Likewise. * cord/tests/cordtest.c (test_basics, test_extras): Likewise. * cord/tests/de.c (retrieve_line, redisplay): Likewise. * cord/tests/de_win.c (plain_chars, control_chars, WndProc): Likewise.
* Fix 'invalid conversion from const char* to char*' in CORD_batched_chr_procJay Krell2018-02-201-2/+2
| | | | | | | | | Issue #206 (bdwgc). Add const to the variable receiving strchr() result for C++ compatibility. * cord/cordxtra.c (CORD_batched_chr_proc): Change type of occ local variable from char* to const char*; remove register keyword for occ.
* Convert cord source files to valid C++ codeIvan Maidanski2018-02-141-4/+4
| | | | | | | | | | | | | | Issue #206 (bdwgc). * cord/cordbscs.c (Concatenation, Function, Generic): Define struct outside union (i.e. the union just uses them). * cord/cordbscs.c (CORD_cat_char_star, CORD_from_fn_inner, CORD_substr_checked): Cast GC_MALLOC_ATOMIC() result to char*. * cord/cordprnt.c (CORD_vsprintf): Likewise. * cord/cordxtra.c (CORD_cat_char, CORD_to_char_star, CORD_from_char_star, CORD_ec_flush_buf): Likewise. * cord/cordbscs.c (CORD_substr_checked): Remove register keyword for "result" local variable.
* Replace deprecated rewind to fseek in cordxtraIvan Maidanski2017-07-201-16/+11
| | | | | | | | rewind (unlike fseek) does not report whether the operation failed. * cord/cordxtra.c (CORD_from_file_lazy_inner, CORD_from_file_lazy, CORD_from_file): Replace rewind(f) to fseek(f, 0l, SEEK_SET) with error checking; adjust ABORT message in case of fseek and ftell failure.
* Eliminate 'possible loss of data' compiler warnings in cord (MS VC)Ivan Maidanski2017-04-201-5/+6
| | | | | | | | | | | | | | | | | | | | | | * 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.
* Define CLANG/GNUC_PREREQ macros to check gcc/clang minimum versionIvan Maidanski2017-03-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (code refactoring) * cord/cordxtra.c (CORD_ATTR_UNUSED): Use GC_GNUC_PREREQ() instead of direct use of __GNUC[_MINOR]__. * gc_cpp.cc (GC_NEW_DELETE_NEED_THROW): Likewise. * include/gc_config_macros.h (GC_API, GC_ATTR_MALLOC, GC_ATTR_ALLOC_SIZE, GC_ATTR_NONNULL, GC_ATTR_DEPRECATED, GC_RETURN_ADDR, GC_RETURN_ADDR_PARENT, GC_PTHREAD_EXIT_ATTRIBUTE): Likewise. * include/gc_cpp.h (GC_NO_OPERATOR_NEW_ARRAY): Likewise. * include/gc_inline.h (GC_EXPECT, GC_PREFETCH_FOR_WRITE): Likewise. * include/new_gc_alloc.h: Likewise. * include/private/gc_priv.h (GC_INNER, GC_ATTR_UNUSED, EXPECT, GC_INLINE, GC_ATTR_NOINLINE, GC_API_OSCALL, GC_ATTR_FORMAT_PRINTF, NONNULL_ARG_NOT_NULL): Likewise. * include/private/gc_priv.h [CANCEL_SAFE] (GC_cancel_disable_count): Likewise. * include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT, PREFETCH, GC_PREFETCH_FOR_WRITE): Likewise. * include/private/gcconfig.h [I386 && LINUX && __ELF__] (GC_NO_SIGSETJMP): Likewise. * include/private/gcconfig.h [X86_64 && MSWIN32] (MPROTECT_VDB): Likewise. * include/private/thread_local_alloc.h [CYGWIN32] (USE_PTHREAD_SPECIFIC): Likewise. * include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32 || PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Likewise. * mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise. * mark_rts.c (GC_approx_sp): Likewise. * tests/test_cpp.cc (ATTR_UNUSED): Likewise. * tools/setjmp_t.c (nested_sp): Likewise. * include/gc_config_macros.h (GC_GNUC_PREREQ): New macro (not for public use). * include/private/gc_priv.h (GC_CLANG_PREREQ): New private macro. * include/private/gcconfig.h (HAVE_BUILTIN_UNWIND_INIT): Refine comment. * include/private/thread_local_alloc.h [LINUX && !ARM32 && !AVR32 || PLATFORM_ANDROID && !__clang__] (USE_COMPILER_TLS): Use GC_CLANG_PREREQ() instead of direct use of __clang_major__ and __clang_minor__. * mark.c [MSWIN32 || MSWINCE] (GC_mark_some): Likewise.
* Eliminate 'checking if unsigned variable is <0' cppcheck style warningIvan Maidanski2016-08-291-2/+3
| | | | | | | | * cord/cordbscs.c (CORD_from_fn, CORD_substr): Do not expect size_t value to be negative (replace <=0 comparison with ==0 one). * cord/cordxtra.c (CORD_cmp): Likewise. * cord/cordbscs.c (CORD_substr): Remove obsolete comment (about SunOS 4 which had signed size_t type).
* Eliminate 'scope of variable can be reduced' cppcheck warningsIvan Maidanski2016-08-271-4/+6
| | | | | | | | | | | | | | | | | * cord/cordbscs.c (CORD_cat_char_star, CORD_from_fn, CORD_substr_checked, CORD_riter4, CORD_init_min_len): Move local variable declaration to the inner scope where the variable is used. * cord/cordxtra.c (CORD_cmp, CORD_ncmp, CORD_from_file_eager): Likewise. * cord/tests/cordtest.c (test_basics): Likewise. * cord/tests/de.c (line_pos, replace_line): Likewise. * dbg_mlc.c (GC_generate_random_heap_address): Likewise. * mark.c (GC_print_trace_inner): Likewise. * misc.c (GC_printf): Likewise. * cord/cordbscs.c (CORD_cat_char_star, CORD_from_fn, CORD_substr_checked, CORD_riter4, CORD_init_min_len): Remove "register" keyword for the moved variable. * cord/cordxtra.c (CORD_cmp, CORD_ncmp, CORD_from_file_eager): Likewise. * cord/tests/de.c (replace_line): Likewise.
* Fix 'CORD_iter5 unused result' code defect in cordxtraIvan Maidanski2016-03-021-4/+7
| | | | | | | | * cord/cordxtra.c (CORD_fill_buf): Return CORD_iter5() result (instead of void); update description comment. * cord/cordxtra.c (CORD_to_char_star): Do not execute CORD_fill_buf() if cord is empty (CORD_fill_buf returns 0 in case of empty cord); check CORD_fill_buf result (abort in case of unexpected result).
* Fix missing numeric casts in cordIvan Maidanski2016-02-121-3/+2
| | | | | | | | | | | * cord/cordprnt.c (CORD_vsprintf): Explicitly cast "prec" to unsigned (to avoid assignment of a signed value to a variable of a bigger unsigned integer type). * cord/cordxtra.c (CORD_nul_func, CORD_chars): Cast between pointer and char via GC_word (instead of long); explicitly cast char to unsigned char (to avoid a signed value cast to a bigger unsigned one). * cord/tests/de.c (replace_line): Explicitly cast COLS to unsigned (when compared to "len" local variable).
* Remove duplicate new-line in OUT_OF_MEMORY message (cord)Ivan Maidanski2016-02-121-2/+2
| | | | | * cord/cordbscs.c (OUT_OF_MEMORY): Remove '\n' in ABORT message. * cord/cordxtra.c (OUT_OF_MEMORY): Likewise.
* Fix null-pointer dereferences in case of out-of-memory in cordIvan Maidanski2016-02-121-0/+1
| | | | | | | | | | | | | | | | | | * cord/cordprnt.c: Include <stdlib.h> (for abort() declaration). * cord/cordprnt.c (OUT_OF_MEMORY): New macro. * cord/tests/de.c (OUT_OF_MEMORY): Likewise. * cord/cordprnt.c (CORD_vsprintf): Execute OUT_OF_MEMORY if GC_MALLOC_ATOMIC returns NULL. * cord/cordxtra.c (CORD_ec_flush_buf): Likewise. * cord/tests/de.c (replace_line, main): Likewise. * tests/cordtest.c (test_extras): Declare "u" local variable; do ABORT if CORD_substr returns NULL (to avoid null pointer dereference in strcmp). * cord/tests/de_win.c (plain_chars, control_chars): Return NULL if GC_MALLOC_ATOMIC returns NULL. * cord/tests/de_win.c (WndProc): Execute de_error() (with the appropriate message) if plain_chars() or control_chars() returned NULL (and do not call the corresponding TextOutA in such a case).
* Fix more typos in comments and documentationIvan Maidanski2013-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * alloc.c: Fix typo ("overflow"). * configure.ac: Fix typo ("optimization"). * doc/README.amiga: Fix typos ("also", "specific", "unnecessary"). * doc/README.cords: Fix typos ("descendants", "highlighted"). * ChangeLog: Fix typos ("[un]collectible"). * README.md: Likewise. * dbg_mlc.c: Likewise. * doc/README.hp: Likewise. * doc/README.linux: Likewise. * doc/gcdescr.html: Likewise. * doc/gcinterface.html: Likewise. * include/gc_mark.h: Likewise. * include/gc_pthread_redirects.h: Likewise. * include/new_gc_alloc.h: Likewise. * include/private/dbg_mlc.h: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * new_hblk.c: Likewise. * ChangeLog: Fix typo ("multi-threaded"). * cord/cordxtra.c: Likewise. * doc/debugging.html: Likewise. * doc/gcinterface.html: Likewise. * doc/leak.html: Likewise. * doc/overview.html: Likewise. * doc/simple_example.html: Likewise. * include/gc_mark.h: Likewise. * include/private/gc_priv.h: Likewise. * os_dep.c: Likewise. * ptr_chck.c: Likewise. * README.md: Fix typo ("pointer-free"). * allchblk.c: Likewise. * doc/debugging.html: Likewise. * doc/gcdescr.html: Likewise.
* Fix typos in commentsOndrej Bilka2013-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * blacklst.c: Fix typo ("even though"). * cord/cordbscs.c: Fix typo ("exponentially"). * cord/cordxtra.c: Fix typo ("represented"). * dyn_load.c: Fix typos ("uncollectible", "occurred"). * extra/AmigaOS: Fix typos ("specific", "necessary", "always", "effectiveness"). * finalize.c: Fix typo ("descendants"). * include/cord.h: Fix typo ("idiosyncrasies"). * include/gc.h: Fix typo ("collectible"). * include/gc_allocator.h: Fix typos ("allocator", "[un]collectible"). * mach_dep.c: Fix typo ("erroneously"). * malloc.c: Fix typos ("[un]collectible", "pointer-free", "initialization"). * mallocx.c: Fix typos ("largely", "pointer-free", "uncollectible"). * mark.c: Fix typos ("[un]collectible", "even though"). * misc.c: Fix typo ("erroneously"). * os_dep.c: Fix typos ("non-addressable", "happening", "pointer-free"). * tests/test.c: Fix typos ("uncollectible", "reversed"). * tests/test_cpp.cc: Fix typos ("[un]collectible"). * typd_mlc.c: Fix typo ("copyright"). * win32_threads.c: Fix typos ("optimization", "uncollectible").
* Expand tabs to spaces in rarely used (ancient) filesIvan Maidanski2013-07-101-23/+23
| | | | | | | | | * extra/AmigaOS.c: Expand tabs to spaces. * extra/MacOS.c: Likewise. * extra/Mac_files/dataend.c: Likewise. * extra/Mac_files/datastart.c: Likewise. * extra/symbian.cpp: Likewise. * cord/cordxtra.c: Likewise.
* Include "config.h" instead of "private/config.h" on HAVE_CONFIG_HIvan Maidanski2012-08-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | (Change the behavior of HAVE_CONFIG_H macro to the standard one which assumes that no folder is specified in #include "config.h".) * configure.ac (AM_CONFIG_HEADER): Replace include/private/config.h to include/config.h. * cord/cordbscs.c: Include "config.h" (instead of "private/config.h") if HAVE_CONFIG_H defined. * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise. * gc_cpp.cc: Likewise. * include/private/gc_pmark.h: Likewise. * include/private/gc_priv.h: Likewise. * real_malloc.c: Likewise. * tests/disclaim_test.c: Likewise. * tests/initsecondarythread.c: Likewise. * tests/subthread_create.c: Likewise. * tests/test.c: Likewise. * tests/test_cpp.cc: Likewise. * tests/thread_leak_test.c: Likewise. * tests/threadkey_test.c: Likewise.
* Suppress false 'unused argument' warnings for GCC v3Ivan Maidanski2012-02-271-1/+1
| | | | | | * cord/cordxtra.c (CORD_ATTR_UNUSED): Use 'unused' attribute starting from GCC v3.4 (instead of v4.0). * include/private/gc_priv.h (GC_ATTR_UNUSED): Likewise.
* cord: Change function declaration style from K-R to ANSI CIvan Maidanski2012-02-161-2/+1
| | | | | * cord/cordxtra.c (refill_cache): Replace the K&R-style function definition with the ANSI C one.
* Minor adjustment of libcord visibility fixIvan Maidanski2012-01-161-0/+7
| | | | | | | | | * cord/cord.am (libcord_la_CPPFLAGS): Do not define CORD_BUILD and GC_DLL here (same approach as for GC_BUILD). * cord/cordbscs.c: Include config.h if HAVE_CONFIG_H (for GC_DLL) and define CORD_BUILD (before including cord.h). * cord/cordprnt.c: Likewise. * cord/cordxtra.c: Likewise.
* Replace ARGSUSED comment-based annotation with GCC 'unused' attribute.Ivan Maidanski2011-09-141-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Turn on unused-parameter checking for GCC. * alloc.c (GC_try_to_collect_general): Add GC_ATTR_UNUSED attribute to an argument. * tests/test.c (tiny_reverse_test, thr_run_one_test): Likewise. * backgraph.c (reset_back_edge, update_max_height): Replace ARGSUSED annotation with GC_ATTR_UNUSED attribute for some arguments. * checksums.c (GC_add_block): Likewise. * dbg_mlc.c (GC_debug_change_stubborn, GC_debug_end_stubborn_change, GC_check_heap_block): Likewise. * finalize.c (GC_null_finalize_mark_proc): Likewise. * gcj_mlc.c (GC_gcj_fake_mark_proc): Likewise. * mark.c (GC_noop, clear_marks_for_block, GC_mark_and_push): Likewise. * mark_rts.c (GC_push_conditional_with_exclusions, GC_push_current_stack): Likewise. * misc.c (GC_default_oom_fn, GC_do_blocking_inner): Likewise. * os_dep.c (GC_fault_handler_openbsd, GC_fault_handler, GC_remove_protection, GC_page_was_dirty, GC_page_was_ever_dirty): Likewise. * pthread_stop_world.c (GC_suspend_handler, GC_suspend_handler_inner): Likewise. * pthread_support.c (GC_do_blocking_inner): Likewise. * stubborn.c (GC_change_stubborn, GC_end_stubborn_change): Likewise. * tests/test.c (fail_proc1): Likewise. * typd_mlc.c (GC_array_mark_proc): Likewise. * win32_threads.c (GC_do_blocking_inner, DllMain): Likewise. * include/private/gc_priv.h (GC_ATTR_UNUSED): Define new macro. * cordxtra.c (CORD_ATTR_UNUSED): Likewise. * cordxtra.c (CORD_nul_func, CORD_lf_close_proc): Replace ARGSUSED annotation with CORD_ATTR_UNUSED attribute for an argument. * mach_dep.c (GC_clear_stack_inner): Remove ARGSUSED annotation and use "limit" argument in the function (to suppress compiler warning). * misc.c (GC_clear_stack_inner): Remove ARGSUSED. * tests/threadkey_test.c (on_thread_exit_inner, on_thread_exit): Use all function arguments (to suppress compiler warning). * configure.ac (CFLAGS): Remove "-Wno-unused-parameter" option.
* Remove information about the authors from the source files.Ivan Maidanski2011-08-251-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (This information could be observed via "git log" or by looking into the original version of a file.) * Makefile.am: Remove original-author and modified-by information (as well as a time-stamp) from the file header. * configure.ac: Ditto. * cord/cordbscs.c: Ditto. * cord/cordprnt.c: Ditto. * cord/cordxtra.c: Ditto. * cord/de.c: Ditto. * cord/de_cmds.h: Ditto. * cord/de_win.h: Ditto. * doc/README.arm.cross: Ditto. * doc/doc.am: Ditto. * dyn_load.c: Ditto. * gc_cpp.cc: Ditto. * gc_dlopen.c: Ditto. * include/cord.h: Ditto. * include/include.am: Ditto. * include/private/cord_pos.h: Ditto. * include/private/gc_hdrs.h: Ditto. * include/weakpointer.h: Ditto. * m4/gc_set_version.m4: Ditto. * tests/test_cpp.cc: Ditto. * cord/cordprnt.c: Fix a typo in a comment. * AUTHORS: Add authors. * cord/cordprnt.c: Expand all tabs to spaces; remove trailing spaces at EOLn. * cord/de.c: Ditto. * cord/de_cmds.h: Ditto. * cord/de_win.c: Ditto. * cord/de_win.h: Ditto. * doc/README.arm.cross: Ditto. * include/private/cord_pos.h: Ditto. * include/weakpointer.h: Ditto. * m4/gc_set_version.m4: Ditto.
* 2011-05-06 Ivan Maidanski <ivmai@mail.ru>ivmai2011-07-261-120/+123
| | | | | | * cord/cordxtra.c (CORD_from_file_lazy_inner): Suppress "unused result" compiler warning for fread(). * cord/cordxtra.c: Expand all tabs to spaces.
* gc6.3alpha5 tarball importgc6_3alpha5Ivan Maidanski2011-07-261-2/+2
|
* gc6.3alpha4 tarball importgc6_3alpha4Ivan Maidanski2011-07-261-1/+1
|
* gc5.0alpha3 tarball importgc5_0alpha3Ivan Maidanski2011-07-261-1/+1
|
* gc4.13 tarball importgc4_13Ivan Maidanski2011-07-261-2/+4
|
* gc4.11 tarball importgc4_11Ivan Maidanski2011-07-261-1/+13
|
* gc4.10 tarball importgc4_10Ivan Maidanski2011-07-261-6/+3
|
* gc4.8 tarball importgc4_8Ivan Maidanski2011-07-261-12/+56
|
* gc4.1 tarball importgc4_1Ivan Maidanski2011-07-261-0/+566