Commit ac73171e authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

r37066@cat (orig r1290): phk | 2007-03-31 09:43:05 +0200

 Improve error message layout and information.
 


git-svn-id: http://www.varnish-cache.org/svn/branches/1.0@1333 d4fa192b-c00b-0410-8231-f00ffab90ce4
parents fe0eefad d059484e
...@@ -395,21 +395,20 @@ Consist_Decend(struct tokenlist *tl, struct proc *p, unsigned returns) ...@@ -395,21 +395,20 @@ Consist_Decend(struct tokenlist *tl, struct proc *p, unsigned returns)
if (u) { if (u) {
#define VCL_RET_MAC(a, b, c, d) \ #define VCL_RET_MAC(a, b, c, d) \
if (u & VCL_RET_##b) { \ if (u & VCL_RET_##b) { \
vsb_printf(tl->sb, "Illegal return for method\n"); \ vsb_printf(tl->sb, "Illegal action \"%s\"\n", #a); \
vcc_ErrWhere(tl, p->returnt[d]); \ vcc_ErrWhere(tl, p->returnt[d]); \
} }
#include "vcl_returns.h" #include "vcl_returns.h"
#undef VCL_RET_MAC #undef VCL_RET_MAC
vsb_printf(tl->sb, "In function\n"); vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
vcc_ErrWhere(tl, p->name); vcc_ErrWhere(tl, p->name);
return (1); return (1);
} }
p->active = 1; p->active = 1;
TAILQ_FOREACH(pc, &p->calls, list) { TAILQ_FOREACH(pc, &p->calls, list) {
if (Consist_Decend(tl, pc->p, returns)) { if (Consist_Decend(tl, pc->p, returns)) {
vsb_printf(tl->sb, "\nCalled from\n"); vsb_printf(tl->sb, "\n...called from \"%.*s\"\n",
vcc_ErrWhere(tl, p->name); PF(p->name));
vsb_printf(tl->sb, "at\n");
vcc_ErrWhere(tl, pc->t); vcc_ErrWhere(tl, pc->t);
return (1); return (1);
} }
...@@ -434,7 +433,16 @@ Consistency(struct tokenlist *tl) ...@@ -434,7 +433,16 @@ Consistency(struct tokenlist *tl)
continue; continue;
if (Consist_Decend(tl, p, m->returns)) { if (Consist_Decend(tl, p, m->returns)) {
vsb_printf(tl->sb, vsb_printf(tl->sb,
"\nwhich is a %s method\n", m->name); "\n...which is the \"%s\" method\n", m->name);
vsb_printf(tl->sb, "Legal actions are:");
#define VCL_RET_MAC(a, b, c, d) \
if (m->returns & c) \
vsb_printf(tl->sb, " \"%s\"", #a);
#define VCL_RET_MAC_E(a, b, c, d) VCL_RET_MAC(a, b, c, d)
#include "vcl_returns.h"
#undef VCL_RET_MAC
#undef VCL_RET_MAC_E
vsb_printf(tl->sb, "\n");
return (1); return (1);
} }
} }
......
...@@ -91,7 +91,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t) ...@@ -91,7 +91,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t)
} else } else
pos++; pos++;
} }
vsb_printf(tl->sb, "In %s Line %d Pos %d\n", f, lin, pos); vsb_printf(tl->sb, "(%s Line %d Pos %d)\n", f, lin, pos);
x = y = 0; x = y = 0;
for (p = l; p < e && *p != '\n'; p++) { for (p = l; p < e && *p != '\n'; p++) {
if (*p == '\t') { if (*p == '\t') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment