summaryrefslogtreecommitdiffstats
path: root/unwind.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-12-06 06:15:49 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-12-06 06:15:49 -0800
commit45412f6aef55df4f83f54b2b5445f673bfeee691 (patch)
tree8e2ee888a5c370c96a2afe011d74236fb2d57284 /unwind.c
parenteec7b1fdc2fa0d53bef990d6cc2339354d57067a (diff)
downloadtxr-45412f6aef55df4f83f54b2b5445f673bfeee691.tar.gz
txr-45412f6aef55df4f83f54b2b5445f673bfeee691.tar.bz2
txr-45412f6aef55df4f83f54b2b5445f673bfeee691.zip
unwind: new function uw_warningf.
Convenience function for throwing warnings. * unwind.c (uw_warningf): New function. * unwind.h (uw_warningf): Declared.
Diffstat (limited to 'unwind.c')
-rw-r--r--unwind.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/unwind.c b/unwind.c
index 3495213d..93b09fe1 100644
--- a/unwind.c
+++ b/unwind.c
@@ -793,6 +793,28 @@ val uw_errorfv(val fmt, struct args *args)
abort();
}
+val uw_warningf(val fmt, ...)
+{
+ va_list vl;
+
+ val stream = make_string_output_stream();
+ va_start (vl, fmt);
+ (void) vformat(stream, fmt, vl);
+ va_end (vl);
+
+ uw_catch_begin (cons(continue_s, nil), exsym, exvals);
+
+ uw_throw(warning_s, get_string_from_stream(stream));
+
+ uw_catch(exsym, exvals) { (void) exsym; (void) exvals; }
+
+ uw_unwind;
+
+ uw_catch_end;
+
+ return nil;
+}
+
val type_mismatch(val fmt, ...)
{
va_list vl;