[master] b75d595 Be more clear about redefining symbols of different expected type

Poul-Henning Kamp phk at FreeBSD.org
Wed Dec 7 11:48:04 CET 2016


commit b75d595d07ee8267604d788453abc11d5b90c210
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Dec 7 10:46:41 2016 +0000

    Be more clear about redefining symbols of different expected type
    
    Fixes #2021

diff --git a/bin/varnishtest/tests/c00005.vtc b/bin/varnishtest/tests/c00005.vtc
index a3da9f6..9343306 100644
--- a/bin/varnishtest/tests/c00005.vtc
+++ b/bin/varnishtest/tests/c00005.vtc
@@ -9,7 +9,7 @@ server s1 {
 	txresp -body "2222\n"
 } -start
 
-varnish v1 -errvcl {foo} {
+varnish v1 -errvcl {Name acl1 must have type 'acl'.} {
 	sub vcl_recv {
 		if (client.ip ~ acl1) {
 			set req.url = "/";
diff --git a/bin/varnishtest/tests/r01510.vtc b/bin/varnishtest/tests/r01510.vtc
index a8eb7f7..7e1555b 100644
--- a/bin/varnishtest/tests/r01510.vtc
+++ b/bin/varnishtest/tests/r01510.vtc
@@ -8,7 +8,7 @@ varnish v1 -errvcl {Instance 'first' redefined.} {
 	}
 }
 
-varnish v1 -errvcl {Name 'first' already used.} {
+varnish v1 -errvcl {Name 'first' already defined.} {
 	import debug;
 
 	backend first { .host = "${bad_ip}"; .port = "9080"; }
diff --git a/bin/varnishtest/tests/r01569.vtc b/bin/varnishtest/tests/r01569.vtc
index e3e2b1c..aed91b1 100644
--- a/bin/varnishtest/tests/r01569.vtc
+++ b/bin/varnishtest/tests/r01569.vtc
@@ -1,6 +1,6 @@
 varnishtest "symbol lookup order issue"
 
-varnish v1 -errvcl {Name 'debug' already used.} {
+varnish v1 -errvcl {Name 'debug' already defined.} {
 	vcl 4.0;
 	import debug;
 
diff --git a/lib/libvcc/vcc_symb.c b/lib/libvcc/vcc_symb.c
index 03b5272..03b069f 100644
--- a/lib/libvcc/vcc_symb.c
+++ b/lib/libvcc/vcc_symb.c
@@ -229,7 +229,7 @@ VCC_HandleSymbol(struct vcc *tl, const struct token *tk, vcc_type_t fmt,
 		vcc_ErrWhere(tl, sym->def_b);
 		return (sym);
 	} else if (sym != NULL && sym->def_b != NULL) {
-		VSB_printf(tl->sb, "Name '%.*s' already used.\n", PF(tk));
+		VSB_printf(tl->sb, "Name '%.*s' already defined.\n", PF(tk));
 		vcc_ErrWhere(tl, tk);
 		VSB_printf(tl->sb, "First definition:\n");
 		AN(sym->def_b);
@@ -237,7 +237,8 @@ VCC_HandleSymbol(struct vcc *tl, const struct token *tk, vcc_type_t fmt,
 		return (sym);
 	} else if (sym != NULL && sym->kind != kind) {
 		VSB_printf(tl->sb,
-		    "Name %.*s is a reserved name.\n", PF(tk));
+		    "Name %.*s must have type '%s'.\n",
+		    PF(tk), VCC_SymKind(tl, sym));
 		vcc_ErrWhere(tl, tk);
 		return (sym);
 	}



More information about the varnish-commit mailing list