Commit 1cb7b206 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Improve usage restriction messages a little bit.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5008 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 70d8aeed
...@@ -69,7 +69,7 @@ parse_error(struct vcc *tl) ...@@ -69,7 +69,7 @@ parse_error(struct vcc *tl)
vcc_NextToken(tl); vcc_NextToken(tl);
if (tl->t->tok == ID) { if (tl->t->tok == ID) {
vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "cannot be read");
ERRCHK(tl); ERRCHK(tl);
assert(vp != NULL); assert(vp != NULL);
if (vp->fmt == INT) { if (vp->fmt == INT) {
...@@ -120,7 +120,7 @@ parse_set(struct vcc *tl) ...@@ -120,7 +120,7 @@ parse_set(struct vcc *tl)
vcc_NextToken(tl); vcc_NextToken(tl);
ExpectErr(tl, ID); ExpectErr(tl, ID);
vt = tl->t; vt = tl->t;
vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "set"); vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "cannot be set");
ERRCHK(tl); ERRCHK(tl);
assert(vp != NULL); assert(vp != NULL);
Fb(tl, 1, "%s", vp->lname); Fb(tl, 1, "%s", vp->lname);
...@@ -241,7 +241,7 @@ parse_unset(struct vcc *tl) ...@@ -241,7 +241,7 @@ parse_unset(struct vcc *tl)
vcc_NextToken(tl); vcc_NextToken(tl);
ExpectErr(tl, ID); ExpectErr(tl, ID);
vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "unset"); vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "cannot be unset");
ERRCHK(tl); ERRCHK(tl);
assert(vp != NULL); assert(vp != NULL);
if (vp->fmt != STRING || vp->hdr == NULL) { if (vp->fmt != STRING || vp->hdr == NULL) {
...@@ -529,7 +529,8 @@ vcc_ParseAction(struct vcc *tl) ...@@ -529,7 +529,8 @@ vcc_ParseAction(struct vcc *tl)
for(atp = action_table; atp->name != NULL; atp++) { for(atp = action_table; atp->name != NULL; atp++) {
if (vcc_IdIs(at, atp->name)) { if (vcc_IdIs(at, atp->name)) {
if (atp->bitmask != 0) if (atp->bitmask != 0)
vcc_AddUses(tl, at, atp->bitmask, "is"); vcc_AddUses(tl, at, atp->bitmask,
"not a valid action");
atp->func(tl); atp->func(tl);
return(1); return(1);
} }
......
...@@ -340,7 +340,7 @@ vcc_Cond_2(struct vcc *tl) ...@@ -340,7 +340,7 @@ vcc_Cond_2(struct vcc *tl)
vcc_Cond_0(tl); vcc_Cond_0(tl);
SkipToken(tl, ')'); SkipToken(tl, ')');
} else if (tl->t->tok == ID) { } else if (tl->t->tok == ID) {
vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "cannot be read");
ERRCHK(tl); ERRCHK(tl);
assert(vp != NULL); assert(vp != NULL);
vcc_NextToken(tl); vcc_NextToken(tl);
......
...@@ -159,7 +159,7 @@ vcc_StringVal(struct vcc *tl) ...@@ -159,7 +159,7 @@ vcc_StringVal(struct vcc *tl)
return 1; return 1;
} }
if (tl->t->tok == ID) { if (tl->t->tok == ID) {
vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "cannot be read");
if (tl->err) if (tl->err)
return (0); return (0);
assert(vp != NULL); assert(vp != NULL);
......
...@@ -60,7 +60,7 @@ struct proccall { ...@@ -60,7 +60,7 @@ struct proccall {
struct procuse { struct procuse {
VTAILQ_ENTRY(procuse) list; VTAILQ_ENTRY(procuse) list;
struct token *t; const struct token *t;
unsigned mask; unsigned mask;
const char *use; const char *use;
}; };
...@@ -217,12 +217,11 @@ vcc_AddUses(struct vcc *tl, const struct token *t, unsigned mask, ...@@ -217,12 +217,11 @@ vcc_AddUses(struct vcc *tl, const struct token *t, unsigned mask,
{ {
struct procuse *pu; struct procuse *pu;
(void)t;
if (tl->curproc == NULL) /* backend */ if (tl->curproc == NULL) /* backend */
return; return;
pu = TlAlloc(tl, sizeof *pu); pu = TlAlloc(tl, sizeof *pu);
assert(pu != NULL); assert(pu != NULL);
pu->t = tl->t; pu->t = t;
pu->mask = mask; pu->mask = mask;
pu->use = use; pu->use = use;
VTAILQ_INSERT_TAIL(&tl->curproc->uses, pu, list); VTAILQ_INSERT_TAIL(&tl->curproc->uses, pu, list);
...@@ -358,7 +357,7 @@ vcc_CheckUseRecurse(struct vcc *tl, const struct proc *p, ...@@ -358,7 +357,7 @@ vcc_CheckUseRecurse(struct vcc *tl, const struct proc *p,
pu = vcc_FindIllegalUse(p, m); pu = vcc_FindIllegalUse(p, m);
if (pu != NULL) { if (pu != NULL) {
vsb_printf(tl->sb, vsb_printf(tl->sb,
"'%.*s': %s not possible in method '%.*s'.\n", "'%.*s': %s from method '%.*s'.\n",
PF(pu->t), pu->use, PF(p->name)); PF(pu->t), pu->use, PF(p->name));
vcc_ErrWhere(tl, pu->t); vcc_ErrWhere(tl, pu->t);
vsb_printf(tl->sb, "\n...in subroutine \"%.*s\"\n", vsb_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
...@@ -393,7 +392,7 @@ vcc_CheckUses(struct vcc *tl) ...@@ -393,7 +392,7 @@ vcc_CheckUses(struct vcc *tl)
pu = vcc_FindIllegalUse(p, m); pu = vcc_FindIllegalUse(p, m);
if (pu != NULL) { if (pu != NULL) {
vsb_printf(tl->sb, vsb_printf(tl->sb,
"'%.*s': %s not possible in method '%.*s'.", "'%.*s': %s in method '%.*s'.",
PF(pu->t), pu->use, PF(p->name)); PF(pu->t), pu->use, PF(p->name));
vsb_cat(tl->sb, "\nAt: "); vsb_cat(tl->sb, "\nAt: ");
vcc_ErrWhere(tl, pu->t); vcc_ErrWhere(tl, pu->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