diff options
-rw-r--r-- | libguile/debug.h | 3 | ||||
-rw-r--r-- | libguile/deprecation.c | 18 | ||||
-rw-r--r-- | libguile/eval.c | 3 |
3 files changed, 13 insertions, 11 deletions
diff --git a/libguile/debug.h b/libguile/debug.h index 81e1fb3f1..f967be6b6 100644 --- a/libguile/debug.h +++ b/libguile/debug.h @@ -58,7 +58,8 @@ SCM_API scm_t_option scm_debug_opts[]; #define SCM_DEVAL_P scm_debug_opts[11].val #define SCM_STACK_LIMIT scm_debug_opts[12].val #define SCM_SHOW_FILE_NAME scm_debug_opts[13].val -#define SCM_N_DEBUG_OPTIONS 14 +#define SCM_WARN_DEPRECATED scm_debug_opts[14].val +#define SCM_N_DEBUG_OPTIONS 15 SCM_API int scm_debug_mode_p; SCM_API int scm_check_entry_p; diff --git a/libguile/deprecation.c b/libguile/deprecation.c index daa02c06d..4205def1b 100644 --- a/libguile/deprecation.c +++ b/libguile/deprecation.c @@ -46,13 +46,13 @@ struct issued_warning { }; static struct issued_warning *issued_warnings; -static enum { detailed, summary, summary_print } mode; +static int print_summary = 0; void scm_c_issue_deprecation_warning (const char *msg) { - if (mode != detailed) - mode = summary_print; + if (!SCM_WARN_DEPRECATED) + print_summary = 1; else { struct issued_warning *iw; @@ -99,8 +99,8 @@ SCM_DEFINE(scm_issue_deprecation_warning, "they are printed in turn, each one followed by a newline.") #define FUNC_NAME s_scm_issue_deprecation_warning { - if (mode != detailed) - mode = summary_print; + if (!SCM_WARN_DEPRECATED) + print_summary = 1; else { SCM nl = scm_from_locale_string ("\n"); @@ -125,7 +125,7 @@ SCM_DEFINE(scm_issue_deprecation_warning, static void print_deprecation_summary (void) { - if (mode == summary_print) + if (print_summary) { fputs ("\n" "Some deprecated features have been used. Set the environment\n" @@ -159,12 +159,12 @@ scm_init_deprecation () if (level == NULL) level = SCM_WARN_DEPRECATED_DEFAULT; if (!strcmp (level, "detailed")) - mode = detailed; + SCM_WARN_DEPRECATED = 1; else if (!strcmp (level, "no")) - mode = summary; + SCM_WARN_DEPRECATED = 0; else { - mode = summary; + SCM_WARN_DEPRECATED = 0; atexit (print_deprecation_summary); } #endif diff --git a/libguile/eval.c b/libguile/eval.c index 193fd1c8a..8c3ed5617 100644 --- a/libguile/eval.c +++ b/libguile/eval.c @@ -3062,7 +3062,8 @@ scm_t_option scm_debug_opts[] = { { SCM_OPTION_BOOLEAN, "backtrace", 0, "Show backtrace on error." }, { SCM_OPTION_BOOLEAN, "debug", 0, "Use the debugging evaluator." }, { SCM_OPTION_INTEGER, "stack", 20000, "Stack size limit (measured in words; 0 = no check)." }, - { SCM_OPTION_SCM, "show-file-name", (unsigned long)SCM_BOOL_T, "Show file names and line numbers in backtraces when not `#f'. A value of `base' displays only base names, while `#t' displays full names."} + { SCM_OPTION_SCM, "show-file-name", (unsigned long)SCM_BOOL_T, "Show file names and line numbers in backtraces when not `#f'. A value of `base' displays only base names, while `#t' displays full names."}, + { SCM_OPTION_BOOLEAN, "warn-deprecated", 0, "Warn when deprecated features are used." } }; scm_t_option scm_evaluator_trap_table[] = { |