]> err.no Git - varnish/commitdiff
Various nitpicking prompted by flexelint
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 1 Apr 2007 19:01:38 +0000 (19:01 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 1 Apr 2007 19:01:38 +0000 (19:01 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1304 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvcl/flint.lnt
varnish-cache/lib/libvcl/vcc_action.c
varnish-cache/lib/libvcl/vcc_backend.c
varnish-cache/lib/libvcl/vcc_compile.c
varnish-cache/lib/libvcl/vcc_compile.h
varnish-cache/lib/libvcl/vcc_parse.c
varnish-cache/lib/libvcl/vcc_token.c
varnish-cache/lib/libvcl/vcc_xref.c

index 35910f423834282b8aba430996401f7ecb73566a..5724f57a782ace1106ac777859a5ed2113d3af42 100644 (file)
 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
 -sem(vcc_new_source, custodial(1))
 
--ffc    // No automatic custody
+// -ffc    // No automatic custody
+
+-esym(534, vsb_printf) // Ignoring return value of function
+-esym(534, vsb_cat)    // Ignoring return value of function
+-esym(534, vsb_bcat)   // Ignoring return value of function
+-esym(534, vsb_vprintf)        // Ignoring return value of function
+-esym(534, memset)     // Ignoring return value of function
+-e788                  // enum constant 'HND_Unclass' not used within defaulted switch
+-e716                  // while(1) ... 
+-e786                  // String concatenation within initializer
+-e732                  // Loss of sign (arg. no. 2) (int to unsigned int)
 
 
 -e763  // Redundant declaration for symbol '...' previously declared
 
 
 -e737  // Loss of sign in promotion from int to unsigned int
--e715  // Symbol 'arg' (line 43) not referenced
--e818  // Pointer parameter '...' could be declared as pointing to const
-
 -e534  // Ignoring return value of function
--e767  // macro 'LIST_INIT' was defined differently
-
 -e506  // Constant value boolean
--e527  // Unreachable code at token 'return'
--e732  // Loss of sign (arg. no. 2) (int to unsigned int)
 -e774  // Boolean within 'if' always evaluates to False
 -e713  // Loss of precision (assignment) (unsigned long long to long long)
 -e574  // Signed-unsigned mix with relational
-
--e525  // Negative indentation from line 90
 -e539  // Did not expect positive indentation
--e725  // Expected positive indentation from line 136
 -e734  // Loss of precision (assignment) (31 bits to 8 bits)
 -e747  // Significant prototype coercion (arg. no. 2) long
 -e712  // Loss of precision (assignment) (long long to
-
-
--e785  // Too few initializers for aggregate 
-
-// -e766       //  Header file '../../include/libvarnish.h' not used in module
-
--e773  // Expression-like macro 'VCL_FARGS' not parenthesized
-
--e788  // enum constant 'HND_Unclass' not used within defaulted switch
-
--e716  // while(1) ... 
--e641  // Converting enum 'cli_status_e' to int
-
--e786  // String concatenation within initializer
index bf1acc67435b1bc712c419fe90715152d3b4b628..1990fe7302d8448e341c3d74e2c083efe1477f87 100644 (file)
  * $Id$
  */
 
-#include <assert.h>
 #include <stdio.h>
 
 #include "vsb.h"
 
 #include "vcc_priv.h"
 #include "vcc_compile.h"
+#include "libvarnish.h"
 
 
 /*--------------------------------------------------------------------*/
index b73385cf8d02873177535941d1f8c28a4be2c848..f0ce5222103ee0d8461844381e2af8390bc99ccb 100644 (file)
@@ -32,7 +32,6 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 
-#include <assert.h>
 #include <netdb.h>
 #include <stdio.h>
 #include <string.h>
@@ -41,7 +40,7 @@
 
 #include "vcc_priv.h"
 #include "vcc_compile.h"
-
+#include "libvarnish.h"
 
 static const char *
 CheckHostPort(const char *host, const char *port)
index 7505e397ff547137d69725b68b686fead49d7ebe..765d4086963f9190dcaf72a39ee36ae9668d1834 100644 (file)
@@ -60,7 +60,6 @@
  *     and all the rest...
  */
 
-#include <assert.h>
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -79,6 +78,7 @@
 #include "vcc_compile.h"
 
 #include "libvcl.h"
+#include "libvarnish.h"
 
 struct method method_tab[] = {
 #define VCL_RET_MAC(l,U,b,n)
@@ -113,7 +113,7 @@ TlAlloc(struct tokenlist *tl, unsigned len)
 /*--------------------------------------------------------------------*/
 
 int
-IsMethod(struct token *t)
+IsMethod(const struct token *t)
 {
        struct method *m;
 
@@ -129,7 +129,7 @@ IsMethod(struct token *t)
  */
 
 void
-Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
+Fh(const struct tokenlist *tl, int indent, const char *fmt, ...)
 {
        va_list ap;
 
@@ -141,7 +141,7 @@ Fh(struct tokenlist *tl, int indent, const char *fmt, ...)
 }
 
 void
-Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
+Fb(const struct tokenlist *tl, int indent, const char *fmt, ...)
 {
        va_list ap;
 
@@ -154,7 +154,7 @@ Fb(struct tokenlist *tl, int indent, const char *fmt, ...)
 }
 
 void
-Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
+Fc(const struct tokenlist *tl, int indent, const char *fmt, ...)
 {
        va_list ap;
 
@@ -166,7 +166,7 @@ Fc(struct tokenlist *tl, int indent, const char *fmt, ...)
 }
 
 void
-Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
+Fi(const struct tokenlist *tl, int indent, const char *fmt, ...)
 {
        va_list ap;
 
@@ -178,7 +178,7 @@ Fi(struct tokenlist *tl, int indent, const char *fmt, ...)
 }
 
 void
-Ff(struct tokenlist *tl, int indent, const char *fmt, ...)
+Ff(const struct tokenlist *tl, int indent, const char *fmt, ...)
 {
        va_list ap;
 
@@ -225,7 +225,7 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
 }
 
 void
-EncToken(struct vsb *sb, struct token *t)
+EncToken(struct vsb *sb, const struct token *t)
 {
 
        assert(t->tok == CSTR);
@@ -235,7 +235,7 @@ EncToken(struct vsb *sb, struct token *t)
 /*--------------------------------------------------------------------*/
 
 static struct var *
-HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
+HeaderVar(struct tokenlist *tl, const struct token *t, const struct var *vh)
 {
        char *p;
        struct var *v;
@@ -266,12 +266,12 @@ HeaderVar(struct tokenlist *tl, struct token *t, struct var *vh)
 /*--------------------------------------------------------------------*/
 
 struct var *
-FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
+FindVar(struct tokenlist *tl, const struct token *t, struct var *vl)
 {
        struct var *v;
 
        for (v = vl; v->name != NULL; v++) {
-               if (v->fmt == HEADER  && t->e - t->b <= v->len)
+               if (v->fmt == HEADER  && (t->e - t->b) <= v->len)
                        continue;
                if (v->fmt != HEADER  && t->e - t->b != v->len)
                        continue;
@@ -294,7 +294,7 @@ FindVar(struct tokenlist *tl, struct token *t, struct var *vl)
  */
 
 static void
-LocTable(struct tokenlist *tl)
+LocTable(const struct tokenlist *tl)
 {
        struct token *t;
        unsigned lin, pos;
@@ -340,7 +340,7 @@ LocTable(struct tokenlist *tl)
 /*--------------------------------------------------------------------*/
 
 static void
-EmitInitFunc(struct tokenlist *tl)
+EmitInitFunc(const struct tokenlist *tl)
 {
 
        Fc(tl, 0, "\nstatic void\nVGC_Init(void)\n{\n\n");
@@ -351,7 +351,7 @@ EmitInitFunc(struct tokenlist *tl)
 }
 
 static void
-EmitFiniFunc(struct tokenlist *tl)
+EmitFiniFunc(const struct tokenlist *tl)
 {
 
        Fc(tl, 0, "\nstatic void\nVGC_Fini(void)\n{\n\n");
@@ -364,7 +364,7 @@ EmitFiniFunc(struct tokenlist *tl)
 /*--------------------------------------------------------------------*/
 
 static void
-EmitStruct(struct tokenlist *tl)
+EmitStruct(const struct tokenlist *tl)
 {
        struct source *sp;
 
@@ -582,7 +582,7 @@ vcc_DestroyTokenList(struct tokenlist *tl, char *ret)
  */
 
 static char *
-vcc_CallCc(char *source, struct vsb *sb)
+vcc_CallCc(const char *source, struct vsb *sb)
 {
        FILE *fo, *fs;
        char *of, *sf, buf[BUFSIZ];
index 4a54a047ba30082e677a074ad78c40991979f4e7..1e6239af99e20466206e827fba1565e1643e4cd0 100644 (file)
@@ -140,14 +140,14 @@ void vcc_ParseBackend(struct tokenlist *tl);
 
 /* vcc_compile.c */
 extern struct method method_tab[];
-void Fh(struct tokenlist *tl, int indent, const char *fmt, ...);
-void Fc(struct tokenlist *tl, int indent, const char *fmt, ...);
-void Fb(struct tokenlist *tl, int indent, const char *fmt, ...);
-void Fi(struct tokenlist *tl, int indent, const char *fmt, ...);
-void Ff(struct tokenlist *tl, int indent, const char *fmt, ...);
-void EncToken(struct vsb *sb, struct token *t);
-struct var *FindVar(struct tokenlist *tl, struct token *t, struct var *vl);
-int IsMethod(struct token *t);
+void Fh(const struct tokenlist *tl, int indent, const char *fmt, ...);
+void Fc(const struct tokenlist *tl, int indent, const char *fmt, ...);
+void Fb(const struct tokenlist *tl, int indent, const char *fmt, ...);
+void Fi(const struct tokenlist *tl, int indent, const char *fmt, ...);
+void Ff(const struct tokenlist *tl, int indent, const char *fmt, ...);
+void EncToken(struct vsb *sb, const struct token *t);
+struct var *FindVar(struct tokenlist *tl, const struct token *t, struct var *vl);
+int IsMethod(const struct token *t);
 void *TlAlloc(struct tokenlist *tl, unsigned len);
 
 /* vcc_obj.c */
@@ -163,11 +163,11 @@ unsigned vcc_UintVal(struct tokenlist *tl);
 double vcc_DoubleVal(struct tokenlist *tl);
 
 /* vcc_token.c */
-void vcc_ErrToken(struct tokenlist *tl, struct token *t);
-void vcc_ErrWhere(struct tokenlist *tl, struct token *t);
+void vcc_ErrToken(const struct tokenlist *tl, const struct token *t);
+void vcc_ErrWhere(struct tokenlist *tl, const struct token *t);
 void vcc__Expect(struct tokenlist *tl, unsigned tok, int line);
-int vcc_Teq(struct token *t1, struct token *t2);
-int vcc_IdIs(struct token *t, const char *p);
+int vcc_Teq(const struct token *t1, const struct token *t2);
+int vcc_IdIs(const struct token *t, const char *p);
 void vcc_Lexer(struct tokenlist *tl, struct source *sp);
 void vcc_NextToken(struct tokenlist *tl);
 void vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line);
index a6c46458d8226fe9a510c7191af6f6100850c419..bb0a01f942529cbabfdb365579b0d577d7422574 100644 (file)
@@ -29,7 +29,6 @@
  * $Id$
  */
 
-#include <assert.h>
 #include <stdio.h>
 #include <string.h>
 
@@ -37,6 +36,7 @@
 
 #include "vcc_priv.h"
 #include "vcc_compile.h"
+#include "libvarnish.h"
 
 #include "vrt.h"
 
@@ -221,7 +221,7 @@ vcc_RateVal(struct tokenlist *tl)
 /*--------------------------------------------------------------------*/
 
 static void
-vcc_re(struct tokenlist *tl, const char *str, struct token *re)
+vcc_re(struct tokenlist *tl, const char *str, const struct token *re)
 {
        char buf[32];
 
@@ -244,7 +244,7 @@ vcc_re(struct tokenlist *tl, const char *str, struct token *re)
 /*--------------------------------------------------------------------*/
 
 static void
-Cond_String(struct var *vp, struct tokenlist *tl)
+Cond_String(const struct var *vp, struct tokenlist *tl)
 {
 
        switch (tl->t->tok) {
@@ -271,7 +271,7 @@ Cond_String(struct var *vp, struct tokenlist *tl)
 }
 
 static void
-Cond_Int(struct var *vp, struct tokenlist *tl)
+Cond_Int(const struct var *vp, struct tokenlist *tl)
 {
 
        Fb(tl, 1, "%s ", vp->rname);
@@ -317,14 +317,14 @@ Cond_Int(struct var *vp, struct tokenlist *tl)
 }
 
 static void
-Cond_Bool(struct var *vp, struct tokenlist *tl)
+Cond_Bool(const struct var *vp, const struct tokenlist *tl)
 {
 
        Fb(tl, 1, "%s\n", vp->rname);
 }
 
 static void
-Cond_Backend(struct var *vp, struct tokenlist *tl)
+Cond_Backend(const struct var *vp, const struct tokenlist *tl)
 {
 
        Fb(tl, 1, "%s\n", vp->rname);
index 21d5119dac48b4b8d853ee13af8bae5d46c43724..5169d7b09c770f9209fe37c23591f66687710933 100644 (file)
@@ -44,7 +44,7 @@
 /*--------------------------------------------------------------------*/
 
 void
-vcc_ErrToken(struct tokenlist *tl, struct token *t)
+vcc_ErrToken(const struct tokenlist *tl, const struct token *t)
 {
 
        if (t->tok == EOI)
@@ -65,7 +65,7 @@ vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line)
 }
 
 void
-vcc_ErrWhere(struct tokenlist *tl, struct token *t)
+vcc_ErrWhere(struct tokenlist *tl, const struct token *t)
 {
        unsigned lin, pos, x, y;
        const char *p, *l, *f, *b, *e;
@@ -132,6 +132,7 @@ vcc_ErrWhere(struct tokenlist *tl, struct token *t)
 void
 vcc_NextToken(struct tokenlist *tl)
 {
+
        tl->t = TAILQ_NEXT(tl->t, list);
        if (tl->t == NULL) {
                vsb_printf(tl->sb,
@@ -158,7 +159,7 @@ vcc__Expect(struct tokenlist *tl, unsigned tok, int line)
  */
 
 int
-vcc_Teq(struct token *t1, struct token *t2)
+vcc_Teq(const struct token *t1, const struct token *t2)
 {
        if (t1->e - t1->b != t2->e - t2->b)
                return (0);
@@ -170,7 +171,7 @@ vcc_Teq(struct token *t1, struct token *t2)
  */
 
 int
-vcc_IdIs(struct token *t, const char *p)
+vcc_IdIs(const struct token *t, const char *p)
 {
        const char *q;
 
@@ -187,7 +188,7 @@ vcc_IdIs(struct token *t, const char *p)
  * Decode %xx in a string
  */
 
-static int
+static int8_t
 vcc_xdig(const char c)
 {
        static const char *xdigit =
index 68c8ec54b6a6670a9920ad8a0940e912c7cb4c1f..9b37278278e88f4837177f7103399140b6474f04 100644 (file)
  * they are called.
  */
 
-#include <assert.h>
 #include <stdio.h>
 
 #include "vsb.h"
 
+#include "libvarnish.h"
 #include "vcc_priv.h"
 #include "vcc_compile.h"
 
@@ -238,12 +238,15 @@ vcc_CheckActionRecurse(struct tokenlist *tl, struct proc *p, unsigned returns)
        }
        u = p->returns & ~returns;
        if (u) {
+/*lint -e525 */
 #define VCL_RET_MAC(a, b, c, d) \
                if (u & VCL_RET_##b) { \
                        vsb_printf(tl->sb, "Illegal return \"%s\"\n", #a); \
                        vcc_ErrWhere(tl, p->return_tok[d]); \
                }
+/*lint -e525 */
 #include "vcl_returns.h"
+/*lint +e525 */
 #undef VCL_RET_MAC
                vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name));
                vcc_ErrWhere(tl, p->name);
@@ -283,7 +286,9 @@ vcc_CheckAction(struct tokenlist *tl)
                        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)
+/*lint -e525 */
 #include "vcl_returns.h"
+/*lint +e525 */
 #undef VCL_RET_MAC
 #undef VCL_RET_MAC_E
                        vsb_printf(tl->sb, "\n");