From 11c64ab8f18b77c918854e3512e5e255f7104851 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 28 Nov 2016 22:52:10 -0800 Subject: Eliminate duplicated warning-suppressing function. * eval.c (warning_continue): Static function removed. (no_warn_expand): Use uw_muffle_warning instead of removed function. * parser.y (warning_continue): Static function removed. (parse_once): Use uw_muffle_warning instead of removed function. * unwind.c (uw_muffle_warning): New function. * unwind.h (uw_muffle_warning): Declared. --- eval.c | 8 ++------ parser.y | 8 ++------ unwind.c | 7 +++++++ unwind.h | 1 + 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/eval.c b/eval.c index d1396f4c..53fb6ad5 100644 --- a/eval.c +++ b/eval.c @@ -3929,16 +3929,12 @@ val expand(val form, val menv) return ret; } -static val warning_continue(val exc, val arg) -{ - uw_throw(continue_s, nil); -} - static val no_warn_expand(val form, val menv) { val ret; uw_frame_t uw_handler; - uw_push_handler(&uw_handler, cons(warning_s, nil), func_n2(warning_continue)); + uw_push_handler(&uw_handler, cons(warning_s, nil), + func_n1v(uw_muffle_warning)); ret = expand(form, menv); uw_pop_frame(&uw_handler); return ret; diff --git a/parser.y b/parser.y index c39b3a8f..24114b88 100644 --- a/parser.y +++ b/parser.y @@ -1740,11 +1740,6 @@ void yybadtoken(parser_t *parser, int tok, val context) yyerrorf(scnr, lit("unexpected character ~a"), chr(tok), nao); } -static val warning_continue(val exc, val arg) -{ - uw_throw(continue_s, nil); -} - int parse_once(val stream, val name, parser_t *parser) { int res = 0; @@ -1759,7 +1754,8 @@ int parse_once(val stream, val name, parser_t *parser) parser->stream = stream; parser->name = name; - uw_push_handler(&uw_handler, cons(warning_s, nil), func_n2(warning_continue)); + uw_push_handler(&uw_handler, cons(warning_s, nil), + func_n1v(uw_muffle_warning)); uw_catch_begin(cons(error_s, nil), esym, eobj); diff --git a/unwind.c b/unwind.c index 946db162..056cdb50 100644 --- a/unwind.c +++ b/unwind.c @@ -406,6 +406,13 @@ val uw_invoke_catch(val catch_frame, val sym, struct args *args) abort(); } +val uw_muffle_warning(val exc, struct args *args) +{ + (void) exc; + (void) args; + uw_throw(continue_s, nil); +} + void uw_push_cont_copy(uw_frame_t *fr, mem_t *ptr, void (*copy)(mem_t *ptr, int parent)) { diff --git a/unwind.h b/unwind.h index 20e3c987..ea8af20b 100644 --- a/unwind.h +++ b/unwind.h @@ -143,6 +143,7 @@ uw_frame_t *uw_current_exit_point(void); val uw_get_frames(void); val uw_find_frame(val extype, val frtype); val uw_invoke_catch(val catch_frame, val sym, struct args *); +val uw_muffle_warning(val exc, struct args *); val uw_capture_cont(val tag, val fun, val ctx_form); void uw_push_cont_copy(uw_frame_t *, mem_t *ptr, void (*copy)(mem_t *ptr, int parent)); -- cgit v1.2.3