r3676 - in branches/2.0/varnish-cache: bin/varnishd include lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 15:18:21 CET 2009


Author: tfheen
Date: 2009-02-06 15:18:21 +0100 (Fri, 06 Feb 2009)
New Revision: 3676

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_vcl.c
   branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
   branches/2.0/varnish-cache/include/vcl.h
   branches/2.0/varnish-cache/include/vcl_returns.h
   branches/2.0/varnish-cache/lib/libvcl/vcc_action.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h
   branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
   branches/2.0/varnish-cache/lib/libvcl/vcc_xref.c
Log:
Merge r3484+r3485: 

Generate VCL_RET_* as enumbering instead of bitmap, compensate
elsewhere as required.

Remove unecessary args to VCL_[RM]ET_MAC().

Rely on VCL_RET_* definition in vcl.h

Adjust to VCL_RET_* being enum instead of bitmap.

This solves the "restart" procaction issue in a non-hackish way
and looks better overall.



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 14:18:21 UTC (rev 3676)
@@ -595,11 +595,9 @@
 void VCL_Get(struct VCL_conf **vcc);
 void VCL_Poll(void);
 
-#define VCL_RET_MAC(l,u,b,n)
 #define VCL_MET_MAC(l,u,b) void VCL_##l##_method(struct sess *);
 #include "vcl_returns.h"
 #undef VCL_MET_MAC
-#undef VCL_RET_MAC
 
 /* cache_vrt_esi.c */
 

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vcl.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_vcl.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_vcl.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -300,8 +300,6 @@
 
 /*--------------------------------------------------------------------*/
 
-#define VCL_RET_MAC(l,u,b,n)
-
 #define VCL_MET_MAC(func, upper, bitmap)				\
 void									\
 VCL_##func##_method(struct sess *sp)					\
@@ -313,13 +311,12 @@
 	sp->vcl->func##_func(sp);					\
 	WSP(sp, SLT_VCL_return, "%s", VCC_Return_Name(sp->handling));	\
 	sp->cur_method = 0;						\
-	assert(sp->handling & bitmap);					\
-	assert(!(sp->handling & ~bitmap));				\
+	assert((1 << sp->handling) & bitmap);				\
+	assert(!((1 << sp->handling) & ~bitmap));			\
 }
 
 #include "vcl_returns.h"
 #undef VCL_MET_MAC
-#undef VCL_RET_MAC
 
 /*--------------------------------------------------------------------*/
 

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_vrt.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -348,7 +348,7 @@
 {
 
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
-	assert(!(hand & (hand -1)));	/* must be power of two */
+	assert(hand < VCL_RET_MAX);
 	sp->handling = hand;
 }
 

Modified: branches/2.0/varnish-cache/include/vcl.h
===================================================================
--- branches/2.0/varnish-cache/include/vcl.h	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/include/vcl.h	2009-02-06 14:18:21 UTC (rev 3676)
@@ -30,16 +30,16 @@
 #define VCL_MET_MAX		12
 
 /* VCL Returns */
-#define VCL_RET_ERROR		(1 << 0)
-#define VCL_RET_LOOKUP		(1 << 1)
-#define VCL_RET_HASH		(1 << 2)
-#define VCL_RET_PIPE		(1 << 3)
-#define VCL_RET_PASS		(1 << 4)
-#define VCL_RET_FETCH		(1 << 5)
-#define VCL_RET_DELIVER		(1 << 6)
-#define VCL_RET_DISCARD		(1 << 7)
-#define VCL_RET_KEEP		(1 << 8)
-#define VCL_RET_RESTART		(1 << 9)
+#define VCL_RET_ERROR		0
+#define VCL_RET_LOOKUP		1
+#define VCL_RET_HASH		2
+#define VCL_RET_PIPE		3
+#define VCL_RET_PASS		4
+#define VCL_RET_FETCH		5
+#define VCL_RET_DELIVER		6
+#define VCL_RET_DISCARD		7
+#define VCL_RET_KEEP		8
+#define VCL_RET_RESTART		9
 
 #define VCL_RET_MAX		10
 

Modified: branches/2.0/varnish-cache/include/vcl_returns.h
===================================================================
--- branches/2.0/varnish-cache/include/vcl_returns.h	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/include/vcl_returns.h	2009-02-06 14:18:21 UTC (rev 3676)
@@ -7,43 +7,72 @@
  */
 
 #ifdef VCL_RET_MAC
-#ifdef VCL_RET_MAC_E
-VCL_RET_MAC_E(error, ERROR, (1 << 0), 0)
+VCL_RET_MAC(error, ERROR)
+VCL_RET_MAC(lookup, LOOKUP)
+VCL_RET_MAC(hash, HASH)
+VCL_RET_MAC(pipe, PIPE)
+VCL_RET_MAC(pass, PASS)
+VCL_RET_MAC(fetch, FETCH)
+VCL_RET_MAC(deliver, DELIVER)
+VCL_RET_MAC(discard, DISCARD)
+VCL_RET_MAC(keep, KEEP)
+VCL_RET_MAC(restart, RESTART)
 #endif
-VCL_RET_MAC(lookup, LOOKUP, (1 << 1), 1)
-VCL_RET_MAC(hash, HASH, (1 << 2), 2)
-VCL_RET_MAC(pipe, PIPE, (1 << 3), 3)
-VCL_RET_MAC(pass, PASS, (1 << 4), 4)
-VCL_RET_MAC(fetch, FETCH, (1 << 5), 5)
-VCL_RET_MAC(deliver, DELIVER, (1 << 6), 6)
-VCL_RET_MAC(discard, DISCARD, (1 << 7), 7)
-VCL_RET_MAC(keep, KEEP, (1 << 8), 8)
-VCL_RET_MAC(restart, RESTART, (1 << 9), 9)
-#endif
 
 #ifdef VCL_MET_MAC
 VCL_MET_MAC(recv,RECV,
-    (VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_PIPE|VCL_RET_LOOKUP))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_PASS)
+    | (1 << VCL_RET_PIPE)
+    | (1 << VCL_RET_LOOKUP)
+))
 VCL_MET_MAC(pipe,PIPE,
-    (VCL_RET_ERROR|VCL_RET_PIPE))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_PIPE)
+))
 VCL_MET_MAC(pass,PASS,
-    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_RESTART)
+    | (1 << VCL_RET_PASS)
+))
 VCL_MET_MAC(hash,HASH,
-    (VCL_RET_HASH))
+     ((1 << VCL_RET_HASH)
+))
 VCL_MET_MAC(miss,MISS,
-    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_FETCH))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_RESTART)
+    | (1 << VCL_RET_PASS)
+    | (1 << VCL_RET_FETCH)
+))
 VCL_MET_MAC(hit,HIT,
-    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_RESTART)
+    | (1 << VCL_RET_PASS)
+    | (1 << VCL_RET_DELIVER)
+))
 VCL_MET_MAC(fetch,FETCH,
-    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
+     ((1 << VCL_RET_ERROR)
+    | (1 << VCL_RET_RESTART)
+    | (1 << VCL_RET_PASS)
+    | (1 << VCL_RET_DELIVER)
+))
 VCL_MET_MAC(deliver,DELIVER,
-    (VCL_RET_RESTART|VCL_RET_DELIVER))
+     ((1 << VCL_RET_RESTART)
+    | (1 << VCL_RET_DELIVER)
+))
 VCL_MET_MAC(prefetch,PREFETCH,
-    (VCL_RET_FETCH|VCL_RET_PASS))
+     ((1 << VCL_RET_FETCH)
+    | (1 << VCL_RET_PASS)
+))
 VCL_MET_MAC(timeout,TIMEOUT,
-    (VCL_RET_FETCH|VCL_RET_DISCARD))
+     ((1 << VCL_RET_FETCH)
+    | (1 << VCL_RET_DISCARD)
+))
 VCL_MET_MAC(discard,DISCARD,
-    (VCL_RET_DISCARD|VCL_RET_KEEP))
+     ((1 << VCL_RET_DISCARD)
+    | (1 << VCL_RET_KEEP)
+))
 VCL_MET_MAC(error,ERROR,
-    (VCL_RET_DELIVER))
+     ((1 << VCL_RET_DELIVER)
+))
 #endif

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_action.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_action.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_action.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -48,18 +48,16 @@
 
 	Expect(tl, ID);
 
-#define VCL_RET_MAC(l, u, b, i)						\
+#define VCL_RET_MAC(l, U)						\
 	do {								\
 		if (vcc_IdIs(tl->t, #l)) {				\
-			Fb(tl, 1, "VRT_done(sp, VCL_RET_%s);\n", #u);	\
-			vcc_ProcAction(tl->curproc, i, tl->t);		\
+			Fb(tl, 1, "VRT_done(sp, VCL_RET_" #U ");\n");	\
+			vcc_ProcAction(tl->curproc, VCL_RET_##U, tl->t);\
 			retval = 1;					\
 		}							\
 	} while (0);
-#define VCL_RET_MAC_E(l, u, b, i) VCL_RET_MAC(l, u, b, i)
 #include "vcl_returns.h"
 #undef VCL_RET_MAC
-#undef VCL_RET_MAC_E
 	if (!retval) {
 		vsb_printf(tl->sb, "Expected action name.\n");
 		vcc_ErrWhere(tl, tl->t);
@@ -85,8 +83,7 @@
 		ERRCHK(tl);
 	}
 	Fb(tl, 1, "VRT_done(sp, VCL_RET_RESTART);\n");
-	assert(VCL_RET_RESTART == (1 << 9));	/* XXX: BANDAID FIXME! */
-	vcc_ProcAction(tl->curproc, 9, tl->t);
+	vcc_ProcAction(tl->curproc, VCL_RET_RESTART, tl->t);
 	vcc_NextToken(tl);
 }
 
@@ -465,7 +462,7 @@
 } action_table[] = {
 	{ "restart",		parse_restart },
 	{ "error",		parse_error },
-#define VCL_RET_MAC(l, u, b, i) { #l, parse_action },
+#define VCL_RET_MAC(l, U) { #l, parse_action },
 #include "vcl_returns.h"
 #undef VCL_RET_MAC
 

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -84,11 +84,9 @@
 #include "libvarnish.h"
 
 struct method method_tab[] = {
-#define VCL_RET_MAC(l,U,b,n)
 #define VCL_MET_MAC(l,U,m)	{ "vcl_"#l, m, VCL_MET_##U },
 #include "vcl_returns.h"
 #undef VCL_MET_MAC
-#undef VCL_RET_MAC
 	{ NULL, 0U, 0}
 };
 
@@ -360,12 +358,10 @@
 	Fc(tl, 0, "\t.srcname = srcname,\n");
 	Fc(tl, 0, "\t.srcbody = srcbody,\n");
 	Fc(tl, 0, "\t.nhashcount = %u,\n", tl->nhashcount);
-#define VCL_RET_MAC(l,u,b,n)
 #define VCL_MET_MAC(l,u,b) \
 	Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
 #include "vcl_returns.h"
 #undef VCL_MET_MAC
-#undef VCL_RET_MAC
 	Fc(tl, 0, "};\n");
 }
 
@@ -669,11 +665,8 @@
 {
 
 	switch (method) {
-	case 0:	return ("<none>");
-#define VCL_RET_MAC(l, u, b, i) case b: return(#l);
-#define VCL_RET_MAC_E(l, u, b, i) case b: return(#l);
+#define VCL_RET_MAC(l, U) case VCL_RET_##U: return(#l);
 #include "vcl_returns.h"
-#undef VCL_RET_MAC_E
 #undef VCL_RET_MAC
 	}
 	return (NULL);

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h	2009-02-06 14:18:21 UTC (rev 3676)
@@ -142,7 +142,7 @@
 
 struct method {
 	const char		*name;
-	unsigned		returns;
+	unsigned		ret_bitmap;
 	unsigned		bitval;
 };
 

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -154,21 +154,11 @@
 void
 vcl_output_lang_h(struct vsb *sb)
 {
-	vsb_cat(sb, "#define VCL_RET_ERROR  (1 << 0)\n");
-	vsb_cat(sb, "#define VCL_RET_LOOKUP  (1 << 1)\n");
-	vsb_cat(sb, "#define VCL_RET_HASH  (1 << 2)\n");
-	vsb_cat(sb, "#define VCL_RET_PIPE  (1 << 3)\n");
-	vsb_cat(sb, "#define VCL_RET_PASS  (1 << 4)\n");
-	vsb_cat(sb, "#define VCL_RET_FETCH  (1 << 5)\n");
-	vsb_cat(sb, "#define VCL_RET_DELIVER  (1 << 6)\n");
-	vsb_cat(sb, "#define VCL_RET_DISCARD  (1 << 7)\n");
-	vsb_cat(sb, "#define VCL_RET_KEEP  (1 << 8)\n");
-	vsb_cat(sb, "#define VCL_RET_RESTART  (1 << 9)\n");
 
 	/* ../../include/vcl.h */
 
-	vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3601 2009-02-05 10");
-	vsb_cat(sb, ":21:48Z tfheen $\n *\n * NB:  This file is machine gen");
+	vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3675 2009-02-06 14");
+	vsb_cat(sb, ":04:08Z tfheen $\n *\n * NB:  This file is machine gen");
 	vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe");
 	vsb_cat(sb, "d_token.tcl instead\n */\n\nstruct sess;\n");
 	vsb_cat(sb, "struct cli;\n\ntypedef void vcl_init_f(struct cli *);\n");
@@ -187,18 +177,14 @@
 	vsb_cat(sb, "#define VCL_MET_DISCARD\t\t(1 << 10)\n");
 	vsb_cat(sb, "#define VCL_MET_ERROR\t\t(1 << 11)\n");
 	vsb_cat(sb, "\n#define VCL_MET_MAX\t\t12\n\n");
-	vsb_cat(sb, "/* VCL Returns */\n#define VCL_RET_ERROR\t\t(1 << 0)\n");
-	vsb_cat(sb, "#define VCL_RET_LOOKUP\t\t(1 << 1)\n");
-	vsb_cat(sb, "#define VCL_RET_HASH\t\t(1 << 2)\n");
-	vsb_cat(sb, "#define VCL_RET_PIPE\t\t(1 << 3)\n");
-	vsb_cat(sb, "#define VCL_RET_PASS\t\t(1 << 4)\n");
-	vsb_cat(sb, "#define VCL_RET_FETCH\t\t(1 << 5)\n");
-	vsb_cat(sb, "#define VCL_RET_DELIVER\t\t(1 << 6)\n");
-	vsb_cat(sb, "#define VCL_RET_DISCARD\t\t(1 << 7)\n");
-	vsb_cat(sb, "#define VCL_RET_KEEP\t\t(1 << 8)\n");
-	vsb_cat(sb, "#define VCL_RET_RESTART\t\t(1 << 9)\n");
-	vsb_cat(sb, "\n#define VCL_RET_MAX\t\t10\n\n");
-	vsb_cat(sb, "struct VCL_conf {\n\tunsigned\tmagic;\n");
+	vsb_cat(sb, "/* VCL Returns */\n#define VCL_RET_ERROR\t\t0\n");
+	vsb_cat(sb, "#define VCL_RET_LOOKUP\t\t1\n#define VCL_RET_HASH\t\t2");
+	vsb_cat(sb, "\n#define VCL_RET_PIPE\t\t3\n#define VCL_RET_PASS\t\t4");
+	vsb_cat(sb, "\n#define VCL_RET_FETCH\t\t5\n#define VCL_RET_DELIVER\t");
+	vsb_cat(sb, "\t6\n#define VCL_RET_DISCARD\t\t7\n");
+	vsb_cat(sb, "#define VCL_RET_KEEP\t\t8\n#define VCL_RET_RESTART\t\t");
+	vsb_cat(sb, "9\n\n#define VCL_RET_MAX\t\t10\n");
+	vsb_cat(sb, "\nstruct VCL_conf {\n\tunsigned\tmagic;\n");
 	vsb_cat(sb, "#define VCL_CONF_MAGIC\t0x7406c509\t/* from /dev/rando");
 	vsb_cat(sb, "m */\n\n\tstruct director\t**director;\n");
 	vsb_cat(sb, "\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n");

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl	2009-02-06 14:18:21 UTC (rev 3676)
@@ -144,7 +144,7 @@
 puts $fo "/* VCL Returns */"
 set i 0
 foreach k $returns {
-	puts $fo "#define VCL_RET_[string toupper $k]\t\t(1 << $i)"
+	puts $fo "#define VCL_RET_[string toupper $k]\t\t$i"
 	incr i
 }
 puts $fo "\n#define VCL_RET_MAX\t\t$i\n"
@@ -186,11 +186,9 @@
 foreach k $returns {
 	set u [string toupper $k]
 	if {$k == "error"} {
-		puts $for "#ifdef VCL_RET_MAC_E"
-		puts $for "VCL_RET_MAC_E($k, $u, (1 << $i), $i)"
-		puts $for "#endif"
+		puts $for "VCL_RET_MAC($k, $u)"
 	} else {
-		puts $for "VCL_RET_MAC($k, $u, (1 << $i), $i)"
+		puts $for "VCL_RET_MAC($k, $u)"
 	}
 	incr i
 }
@@ -202,12 +200,12 @@
 	puts -nonewline $for "VCL_MET_MAC([lindex $m 0]"
 	puts -nonewline $for ",[string toupper [lindex $m 0]]"
 	set l [lindex $m 1]
-	puts -nonewline $for ",\n    (VCL_RET_[string toupper [lindex $l 0]]"
+	puts $for ","
+	puts $for "     ((1 << VCL_RET_[string toupper [lindex $l 0]])"
 	foreach r [lrange $l 1 end] {
-		puts -nonewline $for "|VCL_RET_[string toupper $r]"
+		puts $for "    | (1 << VCL_RET_[string toupper $r])"
 	}
-	puts -nonewline $for ")"
-	puts $for ")"
+	puts $for "))"
 	incr u
 }
 puts $for "#endif"
@@ -400,12 +398,6 @@
 puts $fo "void"
 puts $fo "vcl_output_lang_h(struct vsb *sb)"
 puts $fo "{"
-set i 0
-foreach k $returns {
-	set u [string toupper $k]
-	puts $fo "\tvsb_cat(sb, \"#define VCL_RET_$u  (1 << $i)\\n\");"
-	incr i
-}
 
 copy_include ../../include/vcl.h
 copy_include ../../include/vrt.h

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_xref.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_xref.c	2009-02-06 14:04:08 UTC (rev 3675)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_xref.c	2009-02-06 14:18:21 UTC (rev 3676)
@@ -68,7 +68,7 @@
 	VTAILQ_HEAD(,proccall)	calls;
 	VTAILQ_HEAD(,procuse)	uses;
 	struct token		*name;
-	unsigned		returns;
+	unsigned		ret_bitmap;
 	unsigned		exists;
 	unsigned		called;
 	unsigned		active;
@@ -242,14 +242,15 @@
 vcc_ProcAction(struct proc *p, unsigned returns, struct token *t)
 {
 
-	p->returns |= (1U << returns);
+	assert(returns < VCL_RET_MAX);
+	p->ret_bitmap |= (1U << returns);
 	/* Record the first instance of this return */
 	if (p->return_tok[returns] == NULL)
 		p->return_tok[returns] = t;
 }
 
 static int
-vcc_CheckActionRecurse(struct tokenlist *tl, struct proc *p, unsigned returns)
+vcc_CheckActionRecurse(struct tokenlist *tl, struct proc *p, unsigned bitmap)
 {
 	unsigned u;
 	struct proccall *pc;
@@ -264,13 +265,13 @@
 		vcc_ErrWhere(tl, p->name);
 		return (1);
 	}
-	u = p->returns & ~returns;
+	u = p->ret_bitmap & ~bitmap;
 	if (u) {
 /*lint -save -e525 -e539 */
-#define VCL_RET_MAC(a, b, c, d) \
-		if (u & VCL_RET_##b) { \
-			vsb_printf(tl->sb, "Invalid return \"%s\"\n", #a); \
-			vcc_ErrWhere(tl, p->return_tok[d]); \
+#define VCL_RET_MAC(l, U) 						\
+		if (u & (1 << (VCL_RET_##U))) {				\
+			vsb_printf(tl->sb, "Invalid return \"" #l "\"\n");\
+			vcc_ErrWhere(tl, p->return_tok[VCL_RET_##U]);	\
 		}
 #include "vcl_returns.h"
 #undef VCL_RET_MAC
@@ -281,7 +282,7 @@
 	}
 	p->active = 1;
 	VTAILQ_FOREACH(pc, &p->calls, list) {
-		if (vcc_CheckActionRecurse(tl, pc->p, returns)) {
+		if (vcc_CheckActionRecurse(tl, pc->p, bitmap)) {
 			vsb_printf(tl->sb, "\n...called from \"%.*s\"\n",
 			    PF(p->name));
 			vcc_ErrWhere(tl, pc->t);
@@ -305,19 +306,17 @@
 		if (i < 0)
 			continue;
 		m = method_tab + i;
-		if (vcc_CheckActionRecurse(tl, p, m->returns)) {
+		if (vcc_CheckActionRecurse(tl, p, m->ret_bitmap)) {
 			vsb_printf(tl->sb,
 			    "\n...which is the \"%s\" method\n", m->name);
 			vsb_printf(tl->sb, "Legal returns 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)
+#define VCL_RET_MAC(l, U)						\
+			if (m->ret_bitmap & ((1 << VCL_RET_##U)))	\
+				vsb_printf(tl->sb, " \"%s\"", #l);
 /*lint -save -e525 -e539 */
 #include "vcl_returns.h"
 /*lint +e525 */
 #undef VCL_RET_MAC
-#undef VCL_RET_MAC_E
 /*lint -restore */
 			vsb_printf(tl->sb, "\n");
 			return (1);



More information about the varnish-commit mailing list