r1347 - in branches/1.0: . lib/libvcl

des at projects.linpro.no des at projects.linpro.no
Thu Apr 19 16:51:11 CEST 2007


Author: des
Date: 2007-04-19 16:51:11 +0200 (Thu, 19 Apr 2007)
New Revision: 1347

Modified:
   branches/1.0/
   branches/1.0/lib/libvcl/flint.lnt
   branches/1.0/lib/libvcl/vcc_action.c
   branches/1.0/lib/libvcl/vcc_backend.c
   branches/1.0/lib/libvcl/vcc_compile.c
   branches/1.0/lib/libvcl/vcc_compile.h
   branches/1.0/lib/libvcl/vcc_parse.c
   branches/1.0/lib/libvcl/vcc_token.c
   branches/1.0/lib/libvcl/vcc_xref.c
Log:
 r37080 at cat (orig r1304):  phk | 2007-04-01 21:01:38 +0200
 Various nitpicking prompted by flexelint
 



Property changes on: branches/1.0
___________________________________________________________________
Name: svk:merge
   - d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1303
   + d4fa192b-c00b-0410-8231-f00ffab90ce4:/trunk/varnish-cache:1304

Modified: branches/1.0/lib/libvcl/flint.lnt
===================================================================
--- branches/1.0/lib/libvcl/flint.lnt	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/flint.lnt	2007-04-19 14:51:11 UTC (rev 1347)
@@ -12,43 +12,29 @@
 -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

Modified: branches/1.0/lib/libvcl/vcc_action.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_action.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_action.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -29,13 +29,13 @@
  * $Id$
  */
 
-#include <assert.h>
 #include <stdio.h>
 
 #include "vsb.h"
 
 #include "vcc_priv.h"
 #include "vcc_compile.h"
+#include "libvarnish.h"
 
 
 /*--------------------------------------------------------------------*/

Modified: branches/1.0/lib/libvcl/vcc_backend.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_backend.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_backend.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -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,8 +40,8 @@
 
 #include "vcc_priv.h"
 #include "vcc_compile.h"
+#include "libvarnish.h"
 
-
 static const char *
 CheckHostPort(const char *host, const char *port)
 {

Modified: branches/1.0/lib/libvcl/vcc_compile.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_compile.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_compile.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -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 @@
 /*--------------------------------------------------------------------*/
 
 int
-IsMethod(struct token *t)
+IsMethod(const struct token *t)
 {
 	struct method *m;
 
@@ -129,7 +129,7 @@
  */
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 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 @@
 }
 
 void
-EncToken(struct vsb *sb, struct token *t)
+EncToken(struct vsb *sb, const struct token *t)
 {
 
 	assert(t->tok == CSTR);
@@ -235,7 +235,7 @@
 /*--------------------------------------------------------------------*/
 
 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 @@
 /*--------------------------------------------------------------------*/
 
 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 @@
  */
 
 static void
-LocTable(struct tokenlist *tl)
+LocTable(const struct tokenlist *tl)
 {
 	struct token *t;
 	unsigned lin, pos;
@@ -340,7 +340,7 @@
 /*--------------------------------------------------------------------*/
 
 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 @@
 }
 
 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 @@
 /*--------------------------------------------------------------------*/
 
 static void
-EmitStruct(struct tokenlist *tl)
+EmitStruct(const struct tokenlist *tl)
 {
 	struct source *sp;
 
@@ -582,7 +582,7 @@
  */
 
 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];

Modified: branches/1.0/lib/libvcl/vcc_compile.h
===================================================================
--- branches/1.0/lib/libvcl/vcc_compile.h	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_compile.h	2007-04-19 14:51:11 UTC (rev 1347)
@@ -140,14 +140,14 @@
 
 /* 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 @@
 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);

Modified: branches/1.0/lib/libvcl/vcc_parse.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_parse.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_parse.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -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 @@
 /*--------------------------------------------------------------------*/
 
 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 @@
 /*--------------------------------------------------------------------*/
 
 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 @@
 }
 
 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 @@
 }
 
 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);

Modified: branches/1.0/lib/libvcl/vcc_token.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_token.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_token.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -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 @@
 }
 
 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 @@
 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 @@
  */
 
 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 @@
  */
 
 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 @@
  * Decode %xx in a string
  */
 
-static int
+static int8_t
 vcc_xdig(const char c)
 {
 	static const char *xdigit =

Modified: branches/1.0/lib/libvcl/vcc_xref.c
===================================================================
--- branches/1.0/lib/libvcl/vcc_xref.c	2007-04-19 14:51:10 UTC (rev 1346)
+++ branches/1.0/lib/libvcl/vcc_xref.c	2007-04-19 14:51:11 UTC (rev 1347)
@@ -39,11 +39,11 @@
  * 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 @@
 	}
 	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 @@
 			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");




More information about the varnish-commit mailing list