chiark / gitweb /
config parsing: When closure is of wrong type, report how
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 24 May 2020 19:46:00 +0000 (20:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 24 May 2020 19:47:04 +0000 (20:47 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
log.c

diff --git a/log.c b/log.c
index dd3e4776c4517d79cc84b14615379f7ffd56b6ea..aca1b9b8e415ea6a86fc89e20a68144cbcd4467c 100644 (file)
--- a/log.c
+++ b/log.c
@@ -165,8 +165,13 @@ void cfgfatal_maybefile(FILE *maybe_f, struct cloc loc, cstring_t facility,
 void cfgfatal_cl_type(struct cloc loc, const char *facility,
                      closure_t *cl, uint32_t exp_type, const char *name)
 {
+    char expbuf[10], gotbuf[10];
     assert(cl->type != exp_type);
-    cfgfatal(loc,facility,"\"%s\" is the wrong type of closure\n",name);
+    const char *exp = closure_type_name(exp_type, expbuf);
+    const char *got = closure_type_name(cl->type, gotbuf);
+    cfgfatal(loc,facility,
+            "\"%s\" is the wrong type of closure (expected %s, got %s)\n",
+            name, exp, got);
 }
 
 void cfgfatal(struct cloc loc, cstring_t facility, const char *message, ...)