diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-09-15 08:14:08 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-09-15 10:23:49 +0300 |
commit | 77c069df3ea02551fcf82e0ccd8ea2e68739ac3c (patch) | |
tree | 7b7e70499567fbf655fe102298c146315995571f /os_dep.c | |
parent | a8e6d322879051cc4862d2055eeb2ffa5a3d0db4 (diff) | |
download | bdwgc-77c069df3ea02551fcf82e0ccd8ea2e68739ac3c.tar.gz |
Use cast to void instead of the attribute to indicate unused arguments
(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.
Diffstat (limited to 'os_dep.c')
-rw-r--r-- | os_dep.c | 68 |
1 files changed, 47 insertions, 21 deletions
@@ -524,8 +524,9 @@ GC_INNER const char * GC_get_maps(void) static struct sigaction old_segv_act; STATIC JMP_BUF GC_jmp_buf_openbsd; - STATIC void GC_fault_handler_openbsd(int sig GC_ATTR_UNUSED) + STATIC void GC_fault_handler_openbsd(int sig) { + UNUSED_ARG(sig); LONGJMP(GC_jmp_buf_openbsd, 1); } @@ -938,8 +939,9 @@ GC_INNER size_t GC_page_size = 0; GC_INNER JMP_BUF GC_jmp_buf; - STATIC void GC_fault_handler(int sig GC_ATTR_UNUSED) + STATIC void GC_fault_handler(int sig) { + UNUSED_ARG(sig); LONGJMP(GC_jmp_buf, 1); } @@ -1535,14 +1537,14 @@ GC_INNER size_t GC_page_size = 0; return GC_SUCCESS; } # else - GC_API int GC_CALL GC_get_stack_base( - struct GC_stack_base *b GC_ATTR_UNUSED) + GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *b) { # if defined(GET_MAIN_STACKBASE_SPECIAL) && !defined(THREADS) \ && !defined(IA64) b->mem_base = GC_get_main_stack_base(); return GC_SUCCESS; # else + UNUSED_ARG(b); return GC_UNIMPLEMENTED; # endif } @@ -4373,25 +4375,46 @@ EXTERN_C_END /* These should never be called, but just in case... */ GC_API_OSCALL kern_return_t -catch_exception_raise_state(mach_port_name_t exception_port GC_ATTR_UNUSED, - int exception GC_ATTR_UNUSED, exception_data_t code GC_ATTR_UNUSED, - mach_msg_type_number_t codeCnt GC_ATTR_UNUSED, int flavor GC_ATTR_UNUSED, - thread_state_t old_state GC_ATTR_UNUSED, int old_stateCnt GC_ATTR_UNUSED, - thread_state_t new_state GC_ATTR_UNUSED, int new_stateCnt GC_ATTR_UNUSED) +catch_exception_raise_state(mach_port_name_t exception_port, int exception, + exception_data_t code, + mach_msg_type_number_t codeCnt, int flavor, + thread_state_t old_state, int old_stateCnt, + thread_state_t new_state, int new_stateCnt) { + UNUSED_ARG(exception_port); + UNUSED_ARG(exception); + UNUSED_ARG(code); + UNUSED_ARG(codeCnt); + UNUSED_ARG(flavor); + UNUSED_ARG(old_state); + UNUSED_ARG(old_stateCnt); + UNUSED_ARG(new_state); + UNUSED_ARG(new_stateCnt); ABORT_RET("Unexpected catch_exception_raise_state invocation"); return KERN_INVALID_ARGUMENT; } GC_API_OSCALL kern_return_t -catch_exception_raise_state_identity( - mach_port_name_t exception_port GC_ATTR_UNUSED, - mach_port_t thread GC_ATTR_UNUSED, mach_port_t task GC_ATTR_UNUSED, - int exception GC_ATTR_UNUSED, exception_data_t code GC_ATTR_UNUSED, - mach_msg_type_number_t codeCnt GC_ATTR_UNUSED, int flavor GC_ATTR_UNUSED, - thread_state_t old_state GC_ATTR_UNUSED, int old_stateCnt GC_ATTR_UNUSED, - thread_state_t new_state GC_ATTR_UNUSED, int new_stateCnt GC_ATTR_UNUSED) +catch_exception_raise_state_identity(mach_port_name_t exception_port, + mach_port_t thread, mach_port_t task, + int exception, exception_data_t code, + mach_msg_type_number_t codeCnt, + int flavor, thread_state_t old_state, + int old_stateCnt, + thread_state_t new_state, + int new_stateCnt) { + UNUSED_ARG(exception_port); + UNUSED_ARG(thread); + UNUSED_ARG(task); + UNUSED_ARG(exception); + UNUSED_ARG(code); + UNUSED_ARG(codeCnt); + UNUSED_ARG(flavor); + UNUSED_ARG(old_state); + UNUSED_ARG(old_stateCnt); + UNUSED_ARG(new_state); + UNUSED_ARG(new_stateCnt); ABORT_RET("Unexpected catch_exception_raise_state_identity invocation"); return KERN_INVALID_ARGUMENT; } @@ -4833,10 +4856,9 @@ STATIC kern_return_t GC_forward_exception(mach_port_t thread, mach_port_t task, /* call this. catch_exception_raise, catch_exception_raise_state and */ /* and catch_exception_raise_state_identity are called from OS. */ GC_API_OSCALL kern_return_t -catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED, - mach_port_t thread, mach_port_t task GC_ATTR_UNUSED, - exception_type_t exception, exception_data_t code, - mach_msg_type_number_t code_count GC_ATTR_UNUSED) +catch_exception_raise(mach_port_t exception_port, mach_port_t thread, + mach_port_t task, exception_type_t exception, + exception_data_t code, mach_msg_type_number_t code_count) { kern_return_t r; char *addr; @@ -4844,12 +4866,16 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED, mach_msg_type_number_t exc_state_count = DARWIN_EXC_STATE_COUNT; DARWIN_EXC_STATE_T exc_state; + UNUSED_ARG(exception_port); + UNUSED_ARG(task); if (exception != EXC_BAD_ACCESS || code[0] != KERN_PROTECTION_FAILURE) { # ifdef DEBUG_EXCEPTION_HANDLING /* We aren't interested, pass it on to the old handler */ GC_log_printf("Exception: 0x%x Code: 0x%x 0x%x in catch...\n", exception, code_count > 0 ? code[0] : -1, code_count > 1 ? code[1] : -1); +# else + UNUSED_ARG(code_count); # endif return FWD(); } @@ -4868,7 +4894,7 @@ catch_exception_raise(mach_port_t exception_port GC_ATTR_UNUSED, } /* This is the address that caused the fault */ - addr = (char*) exc_state.DARWIN_EXC_STATE_DAR; + addr = (char*)exc_state.DARWIN_EXC_STATE_DAR; if (!is_header_found_async(addr)) { /* Ugh... just like the SIGBUS problem above, it seems we get */ /* a bogus KERN_PROTECTION_FAILURE every once and a while. We wait */ |