diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2011-09-14 21:52:49 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2011-09-14 21:52:49 +0400 |
commit | 47e74a0090ee55945ab0207afbcbdedef969ec47 (patch) | |
tree | 6023c4e203ec247b40dc2d53dc4f24907ba86b24 /cord | |
parent | 2082770db88c2a1de0f7d24aa7637366ae9e1996 (diff) | |
download | bdwgc-47e74a0090ee55945ab0207afbcbdedef969ec47.tar.gz |
Replace ARGSUSED comment-based annotation with GCC 'unused' attribute.
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.
Diffstat (limited to 'cord')
-rw-r--r-- | cord/cordxtra.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/cord/cordxtra.c b/cord/cordxtra.c index 5904d3b2..abb34f64 100644 --- a/cord/cordxtra.c +++ b/cord/cordxtra.c @@ -21,19 +21,21 @@ # include <string.h> # include <stdlib.h> # include <stdarg.h> + # include "cord.h" # include "ec.h" + # define I_HIDE_POINTERS /* So we get access to allocation lock. */ /* We use this for lazy file reading, */ - /* so that we remain independent */ - /* of the threads primitives. */ + /* so that we remain independent */ + /* of the threads primitives. */ # include "gc.h" /* For now we assume that pointer reads and writes are atomic, */ /* i.e. another thread always sees the state before or after */ -/* a write. This might be false on a Motorola M68K with */ +/* a write. This might be false on a Motorola M68K with */ /* pointers that are not 32-bit aligned. But there probably */ -/* aren't too many threads packages running on those. */ +/* aren't too many threads packages running on those. */ # define ATOMIC_WRITE(x,y) (x) = (y) # define ATOMIC_READ(x) (*(x)) @@ -45,8 +47,8 @@ # define SEEK_END 2 # endif -# define BUFSZ 2048 /* Size of stack allocated buffers when */ - /* we want large buffers. */ +# define BUFSZ 2048 /* Size of stack allocated buffers when */ + /* we want large buffers. */ typedef void (* oom_fn)(void); @@ -54,6 +56,12 @@ typedef void (* oom_fn)(void); ABORT("Out of memory\n"); } # define ABORT(msg) { fprintf(stderr, "%s\n", msg); abort(); } +#if __GNUC__ >= 4 +# define CORD_ATTR_UNUSED __attribute__((__unused__)) +#else +# define CORD_ATTR_UNUSED /* empty */ +#endif + CORD CORD_cat_char(CORD x, char c) { register char * string; @@ -425,8 +433,7 @@ void CORD_ec_append_cord(CORD_ec x, CORD s) x[0].ec_cord = CORD_cat(x[0].ec_cord, s); } -/*ARGSUSED*/ -char CORD_nul_func(size_t i, void * client_data) +char CORD_nul_func(size_t i CORD_ATTR_UNUSED, void * client_data) { return((char)(unsigned long)client_data); } @@ -551,8 +558,7 @@ char CORD_lf_func(size_t i, void * client_data) return(cl -> data[MOD_LINE_SZ(i)]); } -/*ARGSUSED*/ -void CORD_lf_close_proc(void * obj, void * client_data) +void CORD_lf_close_proc(void * obj, void * client_data CORD_ATTR_UNUSED) { if (fclose(((lf_state *)obj) -> lf_file) != 0) { ABORT("CORD_lf_close_proc: fclose failed"); |