From 350b24522f0a522dc5fc106b1757c6bf40275671 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 21 Jul 2006 21:57:43 +0000 Subject: [PATCH] Make FlexeLint happier git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@553 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 2 +- varnish-cache/bin/varnishd/cache_vcl.c | 6 +++--- varnish-cache/include/vcl_returns.h | 20 +++++++++---------- varnish-cache/lib/libvcl/vcc_compile.c | 20 ++++++++++++++----- varnish-cache/lib/libvcl/vcc_compile.h | 11 ++-------- varnish-cache/lib/libvcl/vcc_fixed_token.c | 7 ------- .../lib/libvcl/vcc_gen_fixed_token.tcl | 4 ++-- varnish-cache/lib/libvcl/vcc_token.c | 19 ------------------ 8 files changed, 33 insertions(+), 56 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index eb2394b2..9fccf30a 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -366,7 +366,7 @@ void VCL_Rel(struct VCL_conf *vc); struct VCL_conf *VCL_Get(void); int VCL_Load(const char *fn, const char *name, struct cli *cli); -#define VCL_RET_MAC(l,u,b) +#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 diff --git a/varnish-cache/bin/varnishd/cache_vcl.c b/varnish-cache/bin/varnishd/cache_vcl.c index 991d32a6..56f4aa17 100644 --- a/varnish-cache/bin/varnishd/cache_vcl.c +++ b/varnish-cache/bin/varnishd/cache_vcl.c @@ -206,8 +206,8 @@ vcl_handlingname(unsigned u) { switch (u) { -#define VCL_RET_MAC(a, b, c) case VCL_RET_##b: return(#a); -#define VCL_RET_MAC_E(a, b, c) case VCL_RET_##b: return(#a); +#define VCL_RET_MAC(a, b, c,d) case VCL_RET_##b: return(#a); +#define VCL_RET_MAC_E(a, b, c,d) case VCL_RET_##b: return(#a); #include "vcl_returns.h" #undef VCL_RET_MAC #undef VCL_RET_MAC_E @@ -216,7 +216,7 @@ vcl_handlingname(unsigned u) } } -#define VCL_RET_MAC(l,u,b) +#define VCL_RET_MAC(l,u,b,n) #define VCL_MET_MAC(func, xxx, bitmap) \ void \ diff --git a/varnish-cache/include/vcl_returns.h b/varnish-cache/include/vcl_returns.h index be61f599..1fef265e 100644 --- a/varnish-cache/include/vcl_returns.h +++ b/varnish-cache/include/vcl_returns.h @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: vcc_gen_fixed_token.tcl 545 2006-07-21 20:43:56Z phk $ * * NB: This file is machine generated, DO NOT EDIT! * @@ -8,16 +8,16 @@ #ifdef VCL_RET_MAC #ifdef VCL_RET_MAC_E -VCL_RET_MAC_E(error, ERROR, 0) +VCL_RET_MAC_E(error, ERROR, (1 << 0), 0) #endif -VCL_RET_MAC(lookup, LOOKUP, (1 << 1)) -VCL_RET_MAC(pipe, PIPE, (1 << 2)) -VCL_RET_MAC(pass, PASS, (1 << 3)) -VCL_RET_MAC(insert_pass, INSERT_PASS, (1 << 4)) -VCL_RET_MAC(fetch, FETCH, (1 << 5)) -VCL_RET_MAC(insert, INSERT, (1 << 6)) -VCL_RET_MAC(deliver, DELIVER, (1 << 7)) -VCL_RET_MAC(discard, DISCARD, (1 << 8)) +VCL_RET_MAC(lookup, LOOKUP, (1 << 1), 1) +VCL_RET_MAC(pipe, PIPE, (1 << 2), 2) +VCL_RET_MAC(pass, PASS, (1 << 3), 3) +VCL_RET_MAC(insert_pass, INSERT_PASS, (1 << 4), 4) +VCL_RET_MAC(fetch, FETCH, (1 << 5), 5) +VCL_RET_MAC(insert, INSERT, (1 << 6), 6) +VCL_RET_MAC(deliver, DELIVER, (1 << 7), 7) +VCL_RET_MAC(discard, DISCARD, (1 << 8), 8) #else #define VCL_RET_ERROR (1 << 0) #define VCL_RET_LOOKUP (1 << 1) diff --git a/varnish-cache/lib/libvcl/vcc_compile.c b/varnish-cache/lib/libvcl/vcc_compile.c index af44b983..909c0ce4 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.c +++ b/varnish-cache/lib/libvcl/vcc_compile.c @@ -58,6 +58,15 @@ #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) +static struct method method_tab[] = { +#define VCL_RET_MAC(a,b,c,d) +#define VCL_MET_MAC(a,b,c) { "vcl_"#a, "default_vcl_"#a, c }, +#include "vcl_returns.h" +#undef VCL_MET_MAC +#undef VCL_RET_MAC + { NULL, 0U } +}; + /*--------------------------------------------------------------------*/ static void Compound(struct tokenlist *tl); @@ -214,6 +223,7 @@ AddRefStr(struct tokenlist *tl, const char *s, enum ref_type type) struct token *t; t = calloc(sizeof *t, 1); + assert(t != NULL); t->b = s; t->e = strchr(s, '\0'); t->tok = METHOD; @@ -745,10 +755,10 @@ Action(struct tokenlist *tl) case T_NO_CACHE: Fc(tl, 1, "VCL_no_cache(sp);\n"); return; -#define VCL_RET_MAC(a,b,c) case T_##b: \ +#define VCL_RET_MAC(a,b,c,d) case T_##b: \ Fc(tl, 1, "VRT_done(sp, VCL_RET_%s);\n", #b); \ tl->curproc->returns |= VCL_RET_##b; \ - tl->curproc->returnt[c] = at; \ + tl->curproc->returnt[d] = at; \ return; #include "vcl_returns.h" #undef VCL_RET_MAC @@ -1169,10 +1179,10 @@ Consist_Decend(struct tokenlist *tl, struct proc *p, unsigned returns) } u = p->returns & ~returns; if (u) { -#define VCL_RET_MAC(a, b, c) \ +#define VCL_RET_MAC(a, b, c, d) \ if (u & VCL_RET_##b) { \ sbuf_printf(tl->sb, "Illegal return for method\n"); \ - vcc_ErrWhere(tl, p->returnt[c]); \ + vcc_ErrWhere(tl, p->returnt[d]); \ } #include "vcl_returns.h" #undef VCL_RET_MAC @@ -1350,7 +1360,7 @@ EmitStruct(struct tokenlist *tl) Fc(tl, 0, "\t.nbackend = %d,\n", tl->nbackend); Fc(tl, 0, "\t.ref = VGC_ref,\n"); Fc(tl, 0, "\t.nref = VGC_NREFS,\n"); -#define VCL_RET_MAC(l,u,b) +#define VCL_RET_MAC(l,u,b,n) #define VCL_MET_MAC(l,u,b) \ if (FindRefStr(tl, "vcl_" #l, R_FUNC)) { \ Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n"); \ diff --git a/varnish-cache/lib/libvcl/vcc_compile.h b/varnish-cache/lib/libvcl/vcc_compile.h index c180d670..254c78c9 100644 --- a/varnish-cache/lib/libvcl/vcc_compile.h +++ b/varnish-cache/lib/libvcl/vcc_compile.h @@ -68,17 +68,10 @@ struct var { const char *lname; }; -static struct method { +struct method { const char *name; const char *defname; unsigned returns; -} method_tab[] = { -#define VCL_RET_MAC(a,b,c) -#define VCL_MET_MAC(a,b,c) { "vcl_"#a, "default_vcl_"#a, c }, -#include "vcl_returns.h" -#undef VCL_MET_MAC -#undef VCL_RET_MAC - { NULL, 0U } }; struct proccall { @@ -107,7 +100,7 @@ extern const char *vcc_default_vcl_b, *vcc_default_vcl_e; /* vcc_obj.c */ extern struct var vcc_be_vars[]; extern struct var vcc_vars[]; -const char *vrt_obj_h; +extern const char *vrt_obj_h; /* vcc_token.c */ void vcc_ErrToken(struct tokenlist *tl, struct token *t); diff --git a/varnish-cache/lib/libvcl/vcc_fixed_token.c b/varnish-cache/lib/libvcl/vcc_fixed_token.c index 2037ffc8..c5db22e7 100644 --- a/varnish-cache/lib/libvcl/vcc_fixed_token.c +++ b/varnish-cache/lib/libvcl/vcc_fixed_token.c @@ -488,8 +488,6 @@ vcl_output_lang_h(FILE *f) fputs("};\n", f); fputs("\n", f); fputs("void VRT_count(struct sess *, unsigned);\n", f); - fputs("void VRT_no_cache(struct sess *);\n", f); - fputs("void VRT_no_new_cache(struct sess *);\n", f); fputs("#if 0\n", f); fputs("int ip_match(unsigned, struct vcl_acl *);\n", f); fputs("int string_match(const char *, const char *);\n", f); @@ -499,14 +497,9 @@ vcl_output_lang_h(FILE *f) fputs("int VRT_switch_config(const char *);\n", f); fputs("\n", f); fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f); - fputs("char *VRT_GetReq(struct sess *);\n", f); fputs("void VRT_handling(struct sess *sp, unsigned hand);\n", f); - fputs("int VRT_obj_valid(struct sess *);\n", f); - fputs("int VRT_obj_cacheable(struct sess *);\n", f); fputs("\n", f); fputs("void VRT_set_backend_name(struct backend *, const char *);\n", f); - fputs("void VRT_set_backend_hostname(struct backend *, const char *);\n", f); - fputs("void VRT_set_backend_portname(struct backend *, const char *);\n", f); fputs("\n", f); fputs("void VRT_alloc_backends(struct VCL_conf *cp);\n", f); fputs("\n", f); diff --git a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl index a505b604..1a087bad 100755 --- a/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl +++ b/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl @@ -128,10 +128,10 @@ set i 0 foreach k $returns { if {$k == "error"} { puts $for "#ifdef VCL_RET_MAC_E" - puts $for "VCL_RET_MAC_E($k, [string toupper $k], $i)" + puts $for "VCL_RET_MAC_E($k, [string toupper $k], (1 << $i), $i)" puts $for "#endif" } else { - puts $for "VCL_RET_MAC($k, [string toupper $k], (1 << $i))" + puts $for "VCL_RET_MAC($k, [string toupper $k], (1 << $i), $i)" } incr i } diff --git a/varnish-cache/lib/libvcl/vcc_token.c b/varnish-cache/lib/libvcl/vcc_token.c index 4396d648..6934bb0e 100644 --- a/varnish-cache/lib/libvcl/vcc_token.c +++ b/varnish-cache/lib/libvcl/vcc_token.c @@ -26,10 +26,6 @@ #include "libvcl.h" -#define ERRCHK(tl) do { if ((tl)->err) return; } while (0) - -#define INDENT 2 - /*--------------------------------------------------------------------*/ void @@ -146,21 +142,6 @@ vcc__Expect(struct tokenlist *tl, unsigned tok, int line) vcc_ErrWhere(tl, tl->t); } -#define Expect(a, b) _Expect(a, b, __LINE__) -#define ExpectErr(a, b) do { _Expect(a, b, __LINE__); ERRCHK(a);} while (0) - -#define L(tl, foo) do { \ - tl->indent += INDENT; \ - foo; \ - tl->indent -= INDENT; \ -} while (0) - -#define C(tl, sep) do { \ - Fc(tl, 1, "VRT_count(sp, %u)%s\n", ++tl->cnt, sep); \ - tl->t->cnt = tl->cnt; \ -} while (0) - - /*-------------------------------------------------------------------- * Compare token to token */ -- 2.39.5