mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-23 20:05:32 +02:00
* eval.c, debug.h (SCM_WARN_DEPRECATED): New debug option.
* deprecation.c (scm_issue_deprecation_warning, scm_c_issue_deprecation_warning_fmt): Use it. (mode): Removed. (print_summary): New. (scm_init_deprecation): Initialize SCM_WARN_DEPRECATED instead of mode.
This commit is contained in:
parent
d6dc83a9bc
commit
65bc1f7a0b
3 changed files with 13 additions and 11 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue