[master] cca228f5a Refer to VCL subs as subroutines in error messages

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Dec 23 09:49:06 UTC 2019


commit cca228f5a84791340e61eccdd0319f58908a65aa
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Dec 23 10:42:35 2019 +0100

    Refer to VCL subs as subroutines in error messages
    
    Refs 17457b480a25

diff --git a/bin/varnishtest/tests/v00016.vtc b/bin/varnishtest/tests/v00016.vtc
index 15e6fb511..10c80fbf3 100644
--- a/bin/varnishtest/tests/v00016.vtc
+++ b/bin/varnishtest/tests/v00016.vtc
@@ -52,14 +52,14 @@ varnish v1 -errvcl {Symbol not found: 'foo.bar'} {
 	}
 }
 
-varnish v1 -errvcl {Cannot be set in method 'vcl_pipe'} {
+varnish v1 -errvcl {Cannot be set in subroutine 'vcl_pipe'} {
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_pipe {
 		set bereq.first_byte_timeout = 10s;
 	}
 }
 
-varnish v1 -errvcl {Cannot be set in method 'vcl_pipe'.} {
+varnish v1 -errvcl {Cannot be set in subroutine 'vcl_pipe'.} {
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_pipe {
 		set bereq.between_bytes_timeout = 10s;
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index cd5fc41db..572fde61e 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -114,7 +114,7 @@ varnish v1 -errvcl {Expected return action name.} {
 }
 
 # issue #936
-varnish v1 -errvcl {Not a valid action in method 'vcl_recv'} {
+varnish v1 -errvcl {Not a valid action in subroutine 'vcl_recv'} {
 	backend foo { .host = "127.0.0.1"; }
 	sub vcl_recv {
 		synthetic("XXX");
diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index b59fb5350..4c2a526ae 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -200,7 +200,7 @@ varnish v1 -errvcl {IP + IP not possible.} {
 	}
 }
 
-varnish v1 -errvcl {Name of function, 'foo.bar', contains illegal character '.'} {
+varnish v1 -errvcl {Name of subroutine, 'foo.bar', contains illegal character '.'} {
 	sub foo.bar {
 	}
 	sub vcl_recv {
@@ -223,7 +223,7 @@ varnish v1 -errvcl {Function returns VOID} {
 	}
 }
 
-varnish v1 -errvcl {Not available in method 'vcl_recv'.} {
+varnish v1 -errvcl {Not available in subroutine 'vcl_recv'.} {
 	import blob;
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_recv {
@@ -231,7 +231,7 @@ varnish v1 -errvcl {Not available in method 'vcl_recv'.} {
 	}
 }
 
-varnish v1 -errvcl {Not available in method 'vcl_hash'.} {
+varnish v1 -errvcl {Not available in subroutine 'vcl_hash'.} {
 	import blob;
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_hash {
@@ -239,7 +239,7 @@ varnish v1 -errvcl {Not available in method 'vcl_hash'.} {
 	}
 }
 
-varnish v1 -errvcl {Not available in method 'vcl_recv'.} {
+varnish v1 -errvcl {Not available in subroutine 'vcl_recv'.} {
 	backend b { .host = "127.0.0.1"; }
 	sub vcl_recv {
 		set req.http.foo = 100 + beresp.status;
@@ -251,7 +251,7 @@ varnish v1 -errvcl {
         sub foo { set req.http.foo = 100 + beresp.status; }
 -------------------------------------------######----------
 
-Not available from method 'vcl_recv'.
+Not available from subroutine 'vcl_recv'.
 
 ...in subroutine "foo"
 ('<vcl.inline>' Line 4 Pos 13)
@@ -274,7 +274,7 @@ varnish v1 -errvcl {
         sub foo { set req.http.foo = 100 + beresp.status; }
 -------------------------------------------######----------
 
-Not available from method 'vcl_recv'.
+Not available from subroutine 'vcl_recv'.
 
 ...in subroutine "foo"
 ('<vcl.inline>' Line 4 Pos 13)
diff --git a/bin/varnishtest/tests/v00021.vtc b/bin/varnishtest/tests/v00021.vtc
index 0ae6dc5a3..dd3392ee8 100644
--- a/bin/varnishtest/tests/v00021.vtc
+++ b/bin/varnishtest/tests/v00021.vtc
@@ -26,7 +26,7 @@ varnish v1 -errvcl "Symbol not found" {
 }
 
 varnish v1 -errvcl {
-Function recurses on
+Subroutine recurses on
 ('<vcl.inline>' Line 5 Pos 13)
         sub foo { call foo; }
 ------------###--------------
@@ -50,7 +50,7 @@ Function recurses on
 }
 
 varnish v1 -errvcl {
-Function recurses on
+Subroutine recurses on
 ('<vcl.inline>' Line 6 Pos 13)
         sub foo { call bar; }
 ------------###--------------
diff --git a/bin/varnishtest/tests/v00034.vtc b/bin/varnishtest/tests/v00034.vtc
index 44846a3ec..768ef69ce 100644
--- a/bin/varnishtest/tests/v00034.vtc
+++ b/bin/varnishtest/tests/v00034.vtc
@@ -7,7 +7,7 @@ server s1 {
 
 varnish v1 -vcl+backend { } -start
 
-varnish v1 -errvcl {Function 'c1' redefined} {
+varnish v1 -errvcl {Subroutine 'c1' redefined} {
 	backend foo { .host = "127.0.0.1"; }
 	sub c1 { }
 	sub c1 { }
diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c
index d501ba8e0..978c10057 100644
--- a/lib/libvcc/vcc_parse.c
+++ b/lib/libvcc/vcc_parse.c
@@ -224,7 +224,7 @@ vcc_ParseFunction(struct vcc *tl)
 	struct proc *p;
 
 	vcc_NextToken(tl);
-	vcc_ExpectVid(tl, "function");
+	vcc_ExpectVid(tl, "subroutine");
 	ERRCHK(tl);
 
 	t = tl->t;
@@ -253,7 +253,7 @@ vcc_ParseFunction(struct vcc *tl)
 		p->name = t;
 		VSB_printf(p->cname, "%s", sym->rname);
 	} else if (p->method == NULL) {
-		VSB_printf(tl->sb, "Function '%s' redefined\n", sym->name);
+		VSB_printf(tl->sb, "Subroutine '%s' redefined\n", sym->name);
 		vcc_ErrWhere(tl, t);
 		VSB_printf(tl->sb, "Previously defined here:\n");
 		vcc_ErrWhere(tl, p->name);
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index e680c1ba1..f814e12d8 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -152,7 +152,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
 
 	AN(p);
 	if (p->active) {
-		VSB_cat(tl->sb, "Function recurses on\n");
+		VSB_cat(tl->sb, "Subroutine recurses on\n");
 		vcc_ErrWhere(tl, p->name);
 		return (1);
 	}
@@ -174,7 +174,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
 	p->active = 1;
 	VTAILQ_FOREACH(pc, &p->calls, list) {
 		if (pc->sym->proc == NULL) {
-			VSB_printf(tl->sb, "Function %s does not exist\n",
+			VSB_printf(tl->sb, "Subroutine %s does not exist\n",
 			    pc->sym->name);
 			vcc_ErrWhere(tl, pc->t);
 			return (1);
@@ -205,7 +205,7 @@ vcc_checkaction(struct vcc *tl, const struct symbol *sym)
 		return;
 	if (vcc_CheckActionRecurse(tl, p, p->method->ret_bitmap)) {
 		VSB_printf(tl->sb,
-		    "\n...which is the \"%s\" method\n", p->method->name);
+		    "\n...which is the \"%s\" subroutine\n", p->method->name);
 		VSB_cat(tl->sb, "Legal returns are:");
 #define VCL_RET_MAC(l, U, B)						\
 		if (p->method->ret_bitmap & ((1 << VCL_RET_##U)))	\
@@ -249,7 +249,7 @@ vcc_CheckUseRecurse(struct vcc *tl, const struct proc *p,
 	pu = vcc_FindIllegalUse(p, m);
 	if (pu != NULL) {
 		vcc_ErrWhere2(tl, pu->t1, pu->t2);
-		VSB_printf(tl->sb, "%s from method '%s'.\n",
+		VSB_printf(tl->sb, "%s from subroutine '%s'.\n",
 		    pu->use, m->name);
 		VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
 		    PF(pu->fm->name));
@@ -280,14 +280,14 @@ vcc_checkuses(struct vcc *tl, const struct symbol *sym)
 	pu = vcc_FindIllegalUse(p, p->method);
 	if (pu != NULL) {
 		vcc_ErrWhere2(tl, pu->t1, pu->t2);
-		VSB_printf(tl->sb, "%s in method '%.*s'.",
+		VSB_printf(tl->sb, "%s in subroutine '%.*s'.",
 		    pu->use, PF(p->name));
 		VSB_cat(tl->sb, "\nAt: ");
 		return;
 	}
 	if (vcc_CheckUseRecurse(tl, p, p->method)) {
 		VSB_printf(tl->sb,
-		    "\n...which is the \"%s\" method\n", p->method->name);
+		    "\n...which is the \"%s\" subroutine\n", p->method->name);
 		return;
 	}
 }


More information about the varnish-commit mailing list