diff --git a/guile-readline/ChangeLog b/guile-readline/ChangeLog index d010037cd..b8f3410fe 100644 --- a/guile-readline/ChangeLog +++ b/guile-readline/ChangeLog @@ -1,3 +1,8 @@ +2001-06-07 Dirk Herrmann + + * readline.c (current_input_getc): Mark unused parameters with + SCM_UNUSED. + 2001-06-03 Marius Vollmer * configure.in: Added AC_PREREQ(2.50) and minimally changed for diff --git a/guile-readline/readline.c b/guile-readline/readline.c index 6070e174f..b085f94d8 100644 --- a/guile-readline/readline.c +++ b/guile-readline/readline.c @@ -1,6 +1,6 @@ /* readline.c --- line editing support for Guile */ -/* Copyright (C) 1997,1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1997,1999,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -128,7 +128,7 @@ static SCM input_port; static SCM before_read; static int -current_input_getc (FILE *in) +current_input_getc (FILE *in SCM_UNUSED) { if (promptp && !SCM_FALSEP (before_read)) { diff --git a/libguile/ChangeLog b/libguile/ChangeLog index a4cc49e64..ef708e74e 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,77 @@ +2001-06-07 Dirk Herrmann + + * __scm.h (SCM_NORETURN): Moved here from error.h. + + (SCM_UNUSED): New macro. + + (SCM_DEBUG_PAIR_ACCESSES): New macro. + + * backtrace.c (display_error_handler), continuations.c + (continuation_print), debug.c (debugobj_print), dynwind.c + (guards_print), environments.c (observer_print, + core_environments_finalize, leaf_environment_cell, + leaf_environment_print, eval_environment_print, + eval_environment_observer, import_environment_define, + import_environment_undefine, import_environment_print, + import_environment_observer, export_environment_define, + export_environment_undefine, export_environment_print, + export_environment_observer), eval.c (scm_m_quote, scm_m_begin, + scm_m_if, scm_m_set_x, scm_m_and, scm_m_or, scm_m_case, + scm_m_cond, scm_m_lambda, scm_m_letstar, scm_m_do, scm_m_delay, + scm_m_letrec1, scm_m_apply, scm_m_cont, scm_m_nil_cond, + scm_m_nil_ify, scm_m_t_ify, scm_m_0_cond, scm_m_0_ify, + scm_m_1_ify, scm_m_atfop, scm_m_at_call_with_values), evalext.c + (scm_m_generalized_set_x), fluids.c (fluid_print), fports.c + (fport_print), gc.c (gc_start_stats, scm_remember_upto_here_1, + scm_remember_upto_here_2, scm_remember_upto_here, mark_gc_async), + gh_init.c (gh_standard_handler), goops.c (get_slot_value, + set_slot_value, test_slot_existence, scm_change_object_class, + scm_m_atslot_ref, scm_m_atslot_set_x, make_struct_class, + default_setter), guardians.c (guardian_print, guardian_gc_init, + guardian_zombify, whine_about_self_centered_zombies), guile.c + (inner_main), init.c (stream_handler), keywords.c (keyword_print), + mallocs.c (malloc_print), numbers.c (scm_print_real, + scm_print_complex, scm_bigprint), ports.c (flush_port_default, + end_input_default, scm_port_print, fill_input_void_port, + write_void_port), root.c (root_print), smob.c (scm_mark0, + scm_free0, scm_smob_print, scm_smob_apply_1_error, + scm_smob_apply_2_error, scm_smob_apply_3_error, free_print), + stime.c (restorezone), strings.c (scm_makfromstr), struct.c + (scm_struct_free_0, scm_struct_free_standard, + scm_struct_free_entity, scm_struct_gc_init, scm_free_structs), + throw.c (jmpbuffer_print, lazy_catch_print, ss_handler, + scm_handle_by_throw, scm_ithrow), weaks.c + (scm_weak_vector_gc_init, scm_mark_weak_vector_spines, + scm_scan_weak_vectors), ramap.c (scm_array_fill_int), filesys.c + (scm_dir_print): Mark unused parameters with SCM_UNUSED. + + * error.h (SCM_NORETURN): Moved to __scm.h. + + * error.h (ERRORH, SCM_ERROR_H), pairs.h (PAIRSH, SCM_PAIRS_H): + Renamed H to SCM__H. + + * gc.c (debug_cells_gc_interval): New static variable. + + (scm_assert_cell_valid): If selected by the user, perform + additional garbage collections. + + (scm_set_debug_cell_accesses_x): Extended to let the user specify + if additional garbage collections are desired. + + (mark_gc_async): If additional garbage collections are selected + by the user, don't call the after-gc-hook. Instead require the + user to run the hook manually. + + * pairs.c (scm_error_pair_access): New function. Only compiled + if SCM_DEBUG_PAIR_ACCESSES is set to 1. + + * pairs.h (SCM_VALIDATE_PAIR): New macro. + + (SCM_CAR, SCM_CDR, SCM_SETCAR, SCM_SETCDR): If + SCM_DEBUG_PAIR_ACCESSES is set to 1, make sure that the argument + is a real pair object. (Glocs are also accepted, but that may + change.) If not, abort with an error message. + 2001-06-05 Dirk Herrmann * eval.c (SCM_VALIDATE_NON_EMPTY_COMBINATION): New macro. diff --git a/libguile/__scm.h b/libguile/__scm.h index 2a06b9caa..f5e7ed3a0 100644 --- a/libguile/__scm.h +++ b/libguile/__scm.h @@ -55,6 +55,38 @@ should go in __scm.h. */ +/* {Compiler hints} + * + * The following macros are used to provide additional information for the + * compiler, which may help to do better error checking and code + * optimization. A second benefit of these macros is, that they also provide + * additional information to the developers. + */ + +/* The macro SCM_NORETURN indicates that a function will never return. + * Examples: + * 1) int foo (char arg) SCM_NORETURN; + */ +#ifdef __GNUC__ +#define SCM_NORETURN __attribute__ ((noreturn)) +#else +#define SCM_NORETURN +#endif + +/* The macro SCM_UNUSED indicates that a function, function argument or + * variable may potentially be unused. + * Examples: + * 1) static int unused_function (char arg) SCM_UNUSED; + * 2) int foo (char unused_argument SCM_UNUSED); + * 3) int unused_variable SCM_UNUSED; + */ +#ifdef __GNUC__ +#define SCM_UNUSED __attribute__ ((unused)) +#else +#define SCM_UNUSED +#endif + + /* {Supported Options} * * These may be defined or undefined. @@ -177,6 +209,14 @@ #define SCM_DEBUG_INTERRUPTS SCM_DEBUG #endif +/* If SCM_DEBUG_PAIR_ACCESSES is set to 1, accesses to cons cells will be + * exhaustively checked. Note: If this option is enabled, guile will run + * slower than normally. + */ +#ifndef SCM_DEBUG_PAIR_ACCESSES +#define SCM_DEBUG_PAIR_ACCESSES SCM_DEBUG +#endif + /* If SCM_DEBUG_REST_ARGUMENT is set to 1, functions that take rest arguments * will check whether the rest arguments are actually passed as a proper list. * Otherwise, if SCM_DEBUG_REST_ARGUMENT is 0, functions that take rest diff --git a/libguile/backtrace.c b/libguile/backtrace.c index a602d9139..8ddc473df 100644 --- a/libguile/backtrace.c +++ b/libguile/backtrace.c @@ -1,5 +1,5 @@ /* Printing of backtraces and error messages - * Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation + * Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -216,7 +216,7 @@ struct display_error_handler_data { try to print all objects, we would enter an infinite loop. */ static SCM display_error_handler (struct display_error_handler_data *data, - SCM tag, SCM args) + SCM tag, SCM args SCM_UNUSED) { SCM print_state = scm_make_print_state (); scm_puts ("\nException during displaying of ", data->port); diff --git a/libguile/continuations.c b/libguile/continuations.c index 7b33d7248..49f2890d8 100644 --- a/libguile/continuations.c +++ b/libguile/continuations.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1998, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -94,7 +94,7 @@ continuation_free (SCM obj) } static int -continuation_print (SCM obj, SCM port, scm_print_state *state) +continuation_print (SCM obj, SCM port, scm_print_state *state SCM_UNUSED) { scm_contregs_t *continuation = SCM_CONTREGS (obj); diff --git a/libguile/debug.c b/libguile/debug.c index dc47c9dbc..bd0b4ba7f 100644 --- a/libguile/debug.c +++ b/libguile/debug.c @@ -557,7 +557,7 @@ scm_m_start_stack (SCM exp, SCM env) scm_bits_t scm_tc16_debugobj; static int -debugobj_print (SCM obj, SCM port, scm_print_state *pstate) +debugobj_print (SCM obj, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts ("#obarray; SCM binding = obarray_retrieve (obarray, sym); @@ -1002,7 +1002,7 @@ leaf_environment_free (SCM env) static int -leaf_environment_print (SCM type, SCM port, scm_print_state *pstate) +leaf_environment_print (SCM type, SCM port, scm_print_state *pstate SCM_UNUSED) { SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); @@ -1363,7 +1363,7 @@ eval_environment_free (SCM env) static int -eval_environment_print (SCM type, SCM port, scm_print_state *pstate) +eval_environment_print (SCM type, SCM port, scm_print_state *pstate SCM_UNUSED) { SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); @@ -1395,7 +1395,7 @@ void *scm_type_eval_environment = &eval_environment_funcs; static void -eval_environment_observer (SCM caller, SCM eval_env) +eval_environment_observer (SCM caller SCM_UNUSED, SCM eval_env) { SCM obarray = EVAL_ENVIRONMENT (eval_env)->obarray; @@ -1687,7 +1687,9 @@ import_environment_fold (SCM env, scm_environment_folder proc, SCM data, SCM ini static SCM -import_environment_define (SCM env, SCM sym, SCM val) +import_environment_define (SCM env SCM_UNUSED, + SCM sym SCM_UNUSED, + SCM val SCM_UNUSED) #define FUNC_NAME "import_environment_define" { return SCM_ENVIRONMENT_BINDING_IMMUTABLE; @@ -1696,7 +1698,8 @@ import_environment_define (SCM env, SCM sym, SCM val) static SCM -import_environment_undefine (SCM env, SCM sym) +import_environment_undefine (SCM env SCM_UNUSED, + SCM sym SCM_UNUSED) #define FUNC_NAME "import_environment_undefine" { return SCM_ENVIRONMENT_BINDING_IMMUTABLE; @@ -1779,7 +1782,8 @@ import_environment_free (SCM env) static int -import_environment_print (SCM type, SCM port, scm_print_state *pstate) +import_environment_print (SCM type, SCM port, + scm_print_state *pstate SCM_UNUSED) { SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); @@ -1811,7 +1815,7 @@ void *scm_type_import_environment = &import_environment_funcs; static void -import_environment_observer (SCM caller, SCM import_env) +import_environment_observer (SCM caller SCM_UNUSED, SCM import_env) { core_environments_broadcast (import_env); } @@ -1997,7 +2001,9 @@ export_environment_fold (SCM env, scm_environment_folder proc, SCM data, SCM ini static SCM -export_environment_define (SCM env, SCM sym, SCM val) +export_environment_define (SCM env SCM_UNUSED, + SCM sym SCM_UNUSED, + SCM val SCM_UNUSED) #define FUNC_NAME "export_environment_define" { return SCM_ENVIRONMENT_BINDING_IMMUTABLE; @@ -2006,7 +2012,7 @@ export_environment_define (SCM env, SCM sym, SCM val) static SCM -export_environment_undefine (SCM env, SCM sym) +export_environment_undefine (SCM env SCM_UNUSED, SCM sym SCM_UNUSED) #define FUNC_NAME "export_environment_undefine" { return SCM_ENVIRONMENT_BINDING_IMMUTABLE; @@ -2082,7 +2088,8 @@ export_environment_free (SCM env) static int -export_environment_print (SCM type, SCM port, scm_print_state *pstate) +export_environment_print (SCM type, SCM port, + scm_print_state *pstate SCM_UNUSED) { SCM address = scm_ulong2num (SCM_UNPACK (type)); SCM base16 = scm_number_to_string (address, SCM_MAKINUM (16)); @@ -2114,7 +2121,7 @@ void *scm_type_export_environment = &export_environment_funcs; static void -export_environment_observer (SCM caller, SCM export_env) +export_environment_observer (SCM caller SCM_UNUSED, SCM export_env) { core_environments_broadcast (export_env); } diff --git a/libguile/error.h b/libguile/error.h index cfdc604a1..37b8ee342 100644 --- a/libguile/error.h +++ b/libguile/error.h @@ -1,8 +1,8 @@ /* classes: h_files */ -#ifndef ERRORH -#define ERRORH -/* Copyright (C) 1995,1996,1997,1998, 2000 Free Software Foundation, Inc. +#ifndef SCM_ERROR_H +#define SCM_ERROR_H +/* Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,15 +50,6 @@ extern int scm_ints_disabled; -/* GCC can be told that a function doesn't return; this helps it do - better error checking (for uninitialized variable use, for - example), and some optimization. */ -#ifdef __GNUC__ -#define SCM_NORETURN __attribute__ ((noreturn)) -#else -#define SCM_NORETURN -#endif - extern void scm_error (SCM key, const char *subr, const char *message, SCM args, SCM rest) SCM_NORETURN; extern SCM scm_error_scm (SCM key, SCM subr, SCM message, @@ -91,7 +82,7 @@ extern SCM scm_wta (SCM arg, const char *pos, const char *s_subr); #endif /* SCM_DEBUG_DEPRECATED == 0 */ -#endif /* ERRORH */ +#endif /* SCM_ERROR_H */ /* Local Variables: diff --git a/libguile/eval.c b/libguile/eval.c index ee577c1e1..a45ae0851 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -518,7 +518,7 @@ SCM_SYNTAX(s_quote,"quote", scm_makmmacro, scm_m_quote); SCM_GLOBAL_SYMBOL(scm_sym_quote, s_quote); SCM -scm_m_quote (SCM xorig, SCM env) +scm_m_quote (SCM xorig, SCM env SCM_UNUSED) { SCM x = scm_copy_tree (SCM_CDR (xorig)); @@ -532,7 +532,7 @@ SCM_SYNTAX(s_begin, "begin", scm_makmmacro, scm_m_begin); SCM_GLOBAL_SYMBOL(scm_sym_begin, s_begin); SCM -scm_m_begin (SCM xorig, SCM env) +scm_m_begin (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) >= 1, scm_s_expression, s_begin); return scm_cons (SCM_IM_BEGIN, SCM_CDR (xorig)); @@ -542,7 +542,7 @@ SCM_SYNTAX(s_if, "if", scm_makmmacro, scm_m_if); SCM_GLOBAL_SYMBOL(scm_sym_if, s_if); SCM -scm_m_if (SCM xorig, SCM env) +scm_m_if (SCM xorig, SCM env SCM_UNUSED) { long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 2 && len <= 3, scm_s_expression, "if"); @@ -556,7 +556,7 @@ const char scm_s_set_x[] = "set!"; SCM_GLOBAL_SYMBOL(scm_sym_set_x, scm_s_set_x); SCM -scm_m_set_x (SCM xorig, SCM env) +scm_m_set_x (SCM xorig, SCM env SCM_UNUSED) { SCM x = SCM_CDR (xorig); SCM_ASSYNT (2 == scm_ilength (x), scm_s_expression, scm_s_set_x); @@ -569,7 +569,7 @@ SCM_SYNTAX(s_and, "and", scm_makmmacro, scm_m_and); SCM_GLOBAL_SYMBOL(scm_sym_and, s_and); SCM -scm_m_and (SCM xorig, SCM env) +scm_m_and (SCM xorig, SCM env SCM_UNUSED) { long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 0, scm_s_test, s_and); @@ -583,7 +583,7 @@ SCM_SYNTAX(s_or,"or", scm_makmmacro, scm_m_or); SCM_GLOBAL_SYMBOL(scm_sym_or,s_or); SCM -scm_m_or (SCM xorig, SCM env) +scm_m_or (SCM xorig, SCM env SCM_UNUSED) { long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 0, scm_s_test, s_or); @@ -598,7 +598,7 @@ SCM_SYNTAX(s_case, "case", scm_makmmacro, scm_m_case); SCM_GLOBAL_SYMBOL(scm_sym_case, s_case); SCM -scm_m_case (SCM xorig, SCM env) +scm_m_case (SCM xorig, SCM env SCM_UNUSED) { SCM proc, cdrx = scm_list_copy (SCM_CDR (xorig)), x = cdrx; SCM_ASSYNT (scm_ilength (x) >= 2, scm_s_clauses, s_case); @@ -620,7 +620,7 @@ SCM_GLOBAL_SYMBOL(scm_sym_cond, s_cond); SCM -scm_m_cond (SCM xorig, SCM env) +scm_m_cond (SCM xorig, SCM env SCM_UNUSED) { SCM arg1, cdrx = scm_list_copy (SCM_CDR (xorig)), x = cdrx; long len = scm_ilength (x); @@ -663,7 +663,7 @@ scm_c_improper_memq (SCM obj, SCM list) } SCM -scm_m_lambda (SCM xorig, SCM env) +scm_m_lambda (SCM xorig, SCM env SCM_UNUSED) { SCM proc, x = SCM_CDR (xorig); if (scm_ilength (x) < 2) @@ -710,7 +710,7 @@ SCM_GLOBAL_SYMBOL(scm_sym_letstar,s_letstar); SCM -scm_m_letstar (SCM xorig, SCM env) +scm_m_letstar (SCM xorig, SCM env SCM_UNUSED) { SCM x = SCM_CDR (xorig), arg1, proc, vars = SCM_EOL, *varloc = &vars; long len = scm_ilength (x); @@ -750,7 +750,7 @@ SCM_SYNTAX(s_do, "do", scm_makmmacro, scm_m_do); SCM_GLOBAL_SYMBOL(scm_sym_do, s_do); SCM -scm_m_do (SCM xorig, SCM env) +scm_m_do (SCM xorig, SCM env SCM_UNUSED) { SCM x = SCM_CDR (xorig), arg1, proc; SCM vars = SCM_EOL, inits = SCM_EOL, steps = SCM_EOL; @@ -852,7 +852,7 @@ SCM_SYNTAX (s_delay, "delay", scm_makmmacro, scm_m_delay); SCM_GLOBAL_SYMBOL (scm_sym_delay, s_delay); SCM -scm_m_delay (SCM xorig, SCM env) +scm_m_delay (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (xorig) == 2, scm_s_expression, s_delay); return scm_cons2 (SCM_IM_DELAY, SCM_EOL, SCM_CDR (xorig)); @@ -912,7 +912,7 @@ scm_m_define (SCM x, SCM env) /* end of acros */ static SCM -scm_m_letrec1 (SCM op, SCM imm, SCM xorig, SCM env) +scm_m_letrec1 (SCM op, SCM imm, SCM xorig, SCM env SCM_UNUSED) { SCM cdrx = SCM_CDR (xorig); /* locally mutable version of form */ char *what = SCM_SYMBOL_CHARS (SCM_CAR (xorig)); @@ -1022,7 +1022,7 @@ SCM_GLOBAL_SYMBOL (scm_sym_atapply, s_atapply); SCM_GLOBAL_SYMBOL (scm_sym_apply, s_atapply + 1); SCM -scm_m_apply (SCM xorig, SCM env) +scm_m_apply (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 2, scm_s_expression, s_atapply); return scm_cons (SCM_IM_APPLY, SCM_CDR (xorig)); @@ -1034,7 +1034,7 @@ SCM_GLOBAL_SYMBOL(scm_sym_atcall_cc,s_atcall_cc); SCM -scm_m_cont (SCM xorig, SCM env) +scm_m_cont (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 1, scm_s_expression, s_atcall_cc); @@ -1049,7 +1049,7 @@ SCM_GLOBAL_SYMBOL (scm_lisp_t, "t"); SCM_SYNTAX (s_nil_cond, "nil-cond", scm_makmmacro, scm_m_nil_cond); SCM -scm_m_nil_cond (SCM xorig, SCM env) +scm_m_nil_cond (SCM xorig, SCM env SCM_UNUSED) { long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 1 && (len & 1) == 1, scm_s_expression, "nil-cond"); @@ -1059,7 +1059,7 @@ scm_m_nil_cond (SCM xorig, SCM env) SCM_SYNTAX (s_nil_ify, "nil-ify", scm_makmmacro, scm_m_nil_ify); SCM -scm_m_nil_ify (SCM xorig, SCM env) +scm_m_nil_ify (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 1, scm_s_expression, "nil-ify"); return scm_cons (SCM_IM_NIL_IFY, SCM_CDR (xorig)); @@ -1068,7 +1068,7 @@ scm_m_nil_ify (SCM xorig, SCM env) SCM_SYNTAX (s_t_ify, "t-ify", scm_makmmacro, scm_m_t_ify); SCM -scm_m_t_ify (SCM xorig, SCM env) +scm_m_t_ify (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 1, scm_s_expression, "t-ify"); return scm_cons (SCM_IM_T_IFY, SCM_CDR (xorig)); @@ -1077,7 +1077,7 @@ scm_m_t_ify (SCM xorig, SCM env) SCM_SYNTAX (s_0_cond, "0-cond", scm_makmmacro, scm_m_0_cond); SCM -scm_m_0_cond (SCM xorig, SCM env) +scm_m_0_cond (SCM xorig, SCM env SCM_UNUSED) { long len = scm_ilength (SCM_CDR (xorig)); SCM_ASSYNT (len >= 1 && (len & 1) == 1, scm_s_expression, "0-cond"); @@ -1087,7 +1087,7 @@ scm_m_0_cond (SCM xorig, SCM env) SCM_SYNTAX (s_0_ify, "0-ify", scm_makmmacro, scm_m_0_ify); SCM -scm_m_0_ify (SCM xorig, SCM env) +scm_m_0_ify (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 1, scm_s_expression, "0-ify"); return scm_cons (SCM_IM_0_IFY, SCM_CDR (xorig)); @@ -1096,7 +1096,7 @@ scm_m_0_ify (SCM xorig, SCM env) SCM_SYNTAX (s_1_ify, "1-ify", scm_makmmacro, scm_m_1_ify); SCM -scm_m_1_ify (SCM xorig, SCM env) +scm_m_1_ify (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 1, scm_s_expression, "1-ify"); return scm_cons (SCM_IM_1_IFY, SCM_CDR (xorig)); @@ -1105,7 +1105,7 @@ scm_m_1_ify (SCM xorig, SCM env) SCM_SYNTAX (s_atfop, "@fop", scm_makmmacro, scm_m_atfop); SCM -scm_m_atfop (SCM xorig, SCM env) +scm_m_atfop (SCM xorig, SCM env SCM_UNUSED) { SCM x = SCM_CDR (xorig), var; SCM_ASSYNT (scm_ilength (x) >= 1, scm_s_expression, "@fop"); @@ -1148,7 +1148,7 @@ SCM_SYNTAX (s_at_call_with_values, "@call-with-values", scm_makmmacro, scm_m_at_ SCM_GLOBAL_SYMBOL(scm_sym_at_call_with_values, s_at_call_with_values); SCM -scm_m_at_call_with_values (SCM xorig, SCM env) +scm_m_at_call_with_values (SCM xorig, SCM env SCM_UNUSED) { SCM_ASSYNT (scm_ilength (SCM_CDR (xorig)) == 2, scm_s_expression, s_at_call_with_values); diff --git a/libguile/evalext.c b/libguile/evalext.c index a36ef687b..b19f94c21 100644 --- a/libguile/evalext.c +++ b/libguile/evalext.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1998,1999,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +56,7 @@ SCM_SYMBOL (scm_sym_setter, "setter"); SCM -scm_m_generalized_set_x (SCM xorig, SCM env) +scm_m_generalized_set_x (SCM xorig, SCM env SCM_UNUSED) { SCM x = SCM_CDR (xorig); SCM_ASSYNT (2 == scm_ilength (x), scm_s_expression, scm_s_set_x); diff --git a/libguile/filesys.c b/libguile/filesys.c index 0960300e6..56b4737d1 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -783,7 +783,7 @@ SCM_DEFINE (scm_closedir, "closedir", 1, 0, 0, static int -scm_dir_print (SCM exp, SCM port, scm_print_state *pstate) +scm_dir_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts ("#<", port); if (!SCM_DIR_OPEN_P (exp)) diff --git a/libguile/fluids.c b/libguile/fluids.c index 718dc5f3f..b3a12d666 100644 --- a/libguile/fluids.c +++ b/libguile/fluids.c @@ -96,7 +96,7 @@ scm_copy_fluids (scm_root_state *root_state) } static int -fluid_print (SCM exp, SCM port, scm_print_state *pstate) +fluid_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts ("#string", 1, 1, 0, SCM_BIGDIG conditionals */ int -scm_print_real (SCM sexp, SCM port, scm_print_state *pstate) +scm_print_real (SCM sexp, SCM port, scm_print_state *pstate SCM_UNUSED) { char num_buf[FLOBUFLEN]; scm_lfwrite (num_buf, iflo2str (sexp, num_buf), port); @@ -2213,7 +2213,7 @@ scm_print_real (SCM sexp, SCM port, scm_print_state *pstate) } int -scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate) +scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate SCM_UNUSED) { char num_buf[FLOBUFLEN]; scm_lfwrite (num_buf, iflo2str (sexp, num_buf), port); @@ -2221,7 +2221,7 @@ scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate) } int -scm_bigprint (SCM exp, SCM port, scm_print_state *pstate) +scm_bigprint (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { #ifdef SCM_BIGDIG exp = big2str (exp, (unsigned int) 10); diff --git a/libguile/pairs.c b/libguile/pairs.c index 812c39235..48db366b3 100644 --- a/libguile/pairs.c +++ b/libguile/pairs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -54,6 +54,20 @@ /* {Pairs} */ +#if (SCM_DEBUG_PAIR_ACCESSES == 1) + +#include "libguile/ports.h" +#include "libguile/strings.h" + +void scm_error_pair_access (SCM non_pair) +{ + SCM message = scm_makfrom0str ("Non-pair accessed with SCM_C[AD]R: `~Sī\n"); + scm_simple_format (scm_current_error_port (), message, SCM_LIST1 (non_pair)); + abort (); +} + +#endif + SCM_DEFINE (scm_cons, "cons", 2, 0, 0, (SCM x, SCM y), "Return a newly allocated pair whose car is @var{x} and whose\n" diff --git a/libguile/pairs.h b/libguile/pairs.h index 96b0e47d7..17aa76cd1 100644 --- a/libguile/pairs.h +++ b/libguile/pairs.h @@ -1,8 +1,8 @@ /* classes: h_files */ -#ifndef PAIRSH -#define PAIRSH -/* Copyright (C) 1995,1996,2000 Free Software Foundation, Inc. +#ifndef SCM_PAIRS_H +#define SCM_PAIRS_H +/* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,14 +52,22 @@ +#if (SCM_DEBUG_PAIR_ACCESSES == 1) +# include "libguile/struct.h" +# define SCM_VALIDATE_PAIR(cell, expr) \ + ((!SCM_ECONSP (cell) ? scm_error_pair_access (cell), 0 : 0), (expr)) +#else +# define SCM_VALIDATE_PAIR(cell, expr) (expr) +#endif + #define SCM_NULLP(x) (SCM_EQ_P ((x), SCM_EOL)) #define SCM_NNULLP(x) (!SCM_NULLP (x)) -#define SCM_CAR(x) (SCM_CELL_OBJECT_0 (x)) -#define SCM_CDR(x) (SCM_CELL_OBJECT_1 (x)) +#define SCM_CAR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_0 (x))) +#define SCM_CDR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_1 (x))) -#define SCM_SETCAR(x, v) (SCM_SET_CELL_OBJECT_0 ((x), (v))) -#define SCM_SETCDR(x, v) (SCM_SET_CELL_OBJECT_1 ((x), (v))) +#define SCM_SETCAR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_0 ((x), (v)))) +#define SCM_SETCDR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_1 ((x), (v)))) #define SCM_CAAR(OBJ) SCM_CAR (SCM_CAR (OBJ)) #define SCM_CDAR(OBJ) SCM_CDR (SCM_CAR (OBJ)) @@ -94,6 +102,9 @@ +#if (SCM_DEBUG_PAIR_ACCESSES == 1) +extern void scm_error_pair_access (SCM) SCM_NORETURN; +#endif extern SCM scm_cons (SCM x, SCM y); extern SCM scm_cons2 (SCM w, SCM x, SCM y); extern SCM scm_pair_p (SCM x); @@ -101,7 +112,7 @@ extern SCM scm_set_car_x (SCM pair, SCM value); extern SCM scm_set_cdr_x (SCM pair, SCM value); extern void scm_init_pairs (void); -#endif /* PAIRSH */ +#endif /* SCM_PAIRS_H */ /* Local Variables: diff --git a/libguile/ports.c b/libguile/ports.c index 9bc8168bd..cf1ac56c7 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -108,12 +108,12 @@ scm_markstream (SCM ptr) */ static void -flush_port_default (SCM port) +flush_port_default (SCM port SCM_UNUSED) { } static void -end_input_default (SCM port, int offset) +end_input_default (SCM port SCM_UNUSED, int offset SCM_UNUSED) { } @@ -1487,7 +1487,7 @@ scm_print_port_mode (SCM exp, SCM port) } int -scm_port_print (SCM exp, SCM port, scm_print_state *pstate) +scm_port_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { char *type = SCM_PTOBNAME (SCM_PTOBNUM (exp)); if (!type) @@ -1514,13 +1514,15 @@ scm_ports_prehistory () scm_bits_t scm_tc16_void_port = 0; -static int fill_input_void_port (SCM port) +static int fill_input_void_port (SCM port SCM_UNUSED) { return EOF; } static void -write_void_port (SCM port, const void *data, size_t size) +write_void_port (SCM port SCM_UNUSED, + const void *data SCM_UNUSED, + size_t size SCM_UNUSED) { } diff --git a/libguile/ramap.c b/libguile/ramap.c index 74e281c65..4c169753b 100644 --- a/libguile/ramap.c +++ b/libguile/ramap.c @@ -475,7 +475,7 @@ SCM_DEFINE (scm_array_fill_x, "array-fill!", 2, 0, 0, /* to be used as cproc in scm_ramapc to fill an array dimension with "fill". */ int -scm_array_fill_int (SCM ra, SCM fill, SCM ignore) +scm_array_fill_int (SCM ra, SCM fill, SCM ignore SCM_UNUSED) #define FUNC_NAME s_scm_array_fill_x { unsigned long i; diff --git a/libguile/rdelim.c b/libguile/rdelim.c index c029b3f8c..b8fde12e2 100644 --- a/libguile/rdelim.c +++ b/libguile/rdelim.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/libguile/root.c b/libguile/root.c index f3d6edd86..e37d77b8f 100644 --- a/libguile/root.c +++ b/libguile/root.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998, 1999, 2000 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,1999,2000 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -92,7 +92,7 @@ root_mark (SCM root) static int -root_print (SCM exp, SCM port, scm_print_state *pstate) +root_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts ("# rootcont), 16, port); diff --git a/libguile/smob.c b/libguile/smob.c index e2d9fcb7c..558adc979 100644 --- a/libguile/smob.c +++ b/libguile/smob.c @@ -84,7 +84,7 @@ scm_smob_descriptor scm_smobs[MAX_SMOB_COUNT]; to make their links fail. */ SCM -scm_mark0 (SCM ptr) +scm_mark0 (SCM ptr SCM_UNUSED) { return SCM_BOOL_F; } @@ -101,7 +101,7 @@ scm_markcdr (SCM ptr) */ size_t -scm_free0 (SCM ptr) +scm_free0 (SCM ptr SCM_UNUSED) { return 0; } @@ -117,7 +117,7 @@ scm_smob_free (SCM obj) */ int -scm_smob_print (SCM exp, SCM port, scm_print_state *pstate) +scm_smob_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { long n = SCM_SMOBNUM (exp); scm_puts ("#<", port); @@ -216,7 +216,7 @@ scm_smob_apply_1_021 (SCM smob, SCM a1) } static SCM -scm_smob_apply_1_error (SCM smob, SCM a1) +scm_smob_apply_1_error (SCM smob, SCM a1 SCM_UNUSED) { scm_wrong_num_args (smob); } @@ -246,7 +246,7 @@ scm_smob_apply_2_021 (SCM smob, SCM a1, SCM a2) } static SCM -scm_smob_apply_2_error (SCM smob, SCM a1, SCM a2) +scm_smob_apply_2_error (SCM smob, SCM a1 SCM_UNUSED, SCM a2 SCM_UNUSED) { scm_wrong_num_args (smob); } @@ -278,7 +278,10 @@ scm_smob_apply_3_021 (SCM smob, SCM a1, SCM a2, SCM rst) } static SCM -scm_smob_apply_3_error (SCM smob, SCM a1, SCM a2, SCM rst) +scm_smob_apply_3_error (SCM smob, + SCM a1 SCM_UNUSED, + SCM a2 SCM_UNUSED, + SCM rst SCM_UNUSED) { scm_wrong_num_args (smob); } @@ -512,7 +515,7 @@ scm_set_smob_mfpe (long tc, */ static int -free_print (SCM exp, SCM port, scm_print_state *pstate) +free_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { char buf[100]; diff --git a/libguile/stime.c b/libguile/stime.c index ac99a1587..f99656da4 100644 --- a/libguile/stime.c +++ b/libguile/stime.c @@ -325,7 +325,7 @@ setzone (SCM zone, int pos, const char *subr) } static void -restorezone (SCM zone, char **oldenv, const char *subr) +restorezone (SCM zone, char **oldenv, const char *subr SCM_UNUSED) { if (!SCM_UNBNDP (zone)) { diff --git a/libguile/strings.c b/libguile/strings.c index b87864973..a60c03ac1 100644 --- a/libguile/strings.c +++ b/libguile/strings.c @@ -192,7 +192,7 @@ scm_take0str (char *s) } SCM -scm_makfromstr (const char *src, size_t len, int dummy) +scm_makfromstr (const char *src, size_t len, int dummy SCM_UNUSED) { SCM s = scm_allocate_string (len); char *dst = SCM_STRING_CHARS (s); diff --git a/libguile/struct.c b/libguile/struct.c index b13a8c1c8..dc9b7d981 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -332,7 +332,8 @@ scm_alloc_struct (int n_words, int n_extra, char *who) } size_t -scm_struct_free_0 (scm_bits_t * vtable, scm_bits_t * data) +scm_struct_free_0 (scm_bits_t * vtable SCM_UNUSED, + scm_bits_t * data SCM_UNUSED) { return 0; } @@ -345,7 +346,7 @@ scm_struct_free_light (scm_bits_t * vtable, scm_bits_t * data) } size_t -scm_struct_free_standard (scm_bits_t * vtable, scm_bits_t * data) +scm_struct_free_standard (scm_bits_t * vtable SCM_UNUSED, scm_bits_t * data) { size_t n = (data[scm_struct_i_n_words] + scm_struct_n_extra_words) * sizeof (scm_bits_t) + 7; @@ -354,7 +355,7 @@ scm_struct_free_standard (scm_bits_t * vtable, scm_bits_t * data) } size_t -scm_struct_free_entity (scm_bits_t * vtable, scm_bits_t * data) +scm_struct_free_entity (scm_bits_t * vtable SCM_UNUSED, scm_bits_t * data) { size_t n = (data[scm_struct_i_n_words] + scm_struct_entity_n_extra_words) * sizeof (scm_bits_t) + 7; @@ -363,14 +364,18 @@ scm_struct_free_entity (scm_bits_t * vtable, scm_bits_t * data) } static void * -scm_struct_gc_init (void *dummy1, void *dummy2, void *dummy3) +scm_struct_gc_init (void *dummy1 SCM_UNUSED, + void *dummy2 SCM_UNUSED, + void *dummy3 SCM_UNUSED) { scm_structs_to_free = SCM_EOL; return 0; } static void * -scm_free_structs (void *dummy1, void *dummy2, void *dummy3) +scm_free_structs (void *dummy1 SCM_UNUSED, + void *dummy2 SCM_UNUSED, + void *dummy3 SCM_UNUSED) { SCM newchain = scm_structs_to_free; do diff --git a/libguile/symbols.c b/libguile/symbols.c index 83cddc0da..448c9d85f 100644 --- a/libguile/symbols.c +++ b/libguile/symbols.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1996,1997,1998, 2000, 2001 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1997,1998,2000,2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/libguile/throw.c b/libguile/throw.c index 63af28650..765924bf6 100644 --- a/libguile/throw.c +++ b/libguile/throw.c @@ -84,7 +84,7 @@ static scm_bits_t tc16_jmpbuffer; #endif static int -jmpbuffer_print (SCM exp, SCM port, scm_print_state *pstate) +jmpbuffer_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED) { scm_puts ("# + + * srfi-14.c (charset_print): Mark unused parameters with + SCM_UNUSED. + 2001-06-07 Martin Grabmueller * srfi-1.scm (fold, fold-pair): Fixed a buggy call to apply. @@ -5,7 +10,6 @@ retained, as required. (member, assoc): Fixed wrong order of equality predicate application. - 2001-06-06 Martin Grabmueller diff --git a/srfi/srfi-14.c b/srfi/srfi-14.c index 2cb7dc9e3..de9713bd9 100644 --- a/srfi/srfi-14.c +++ b/srfi/srfi-14.c @@ -1,6 +1,6 @@ /* srfi-14.c --- SRFI-14 procedures for Guile * - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -60,7 +60,7 @@ int scm_tc16_charset = 0; /* Smob print hook for character sets. */ static int -charset_print (SCM charset, SCM port, scm_print_state *pstate) +charset_print (SCM charset, SCM port, scm_print_state *pstate SCM_UNUSED) { int i; int first = 1;