[master] a54af58 A quick FlexeLint check to see that there are no major complaints

Poul-Henning Kamp phk at varnish-cache.org
Thu Jan 10 11:35:03 CET 2013


commit a54af587f43251e616b7edc502e6bb08d589711d
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Jan 10 10:12:19 2013 +0000

    A quick FlexeLint check to see that there are no major complaints

diff --git a/bin/flint.lnt b/bin/flint.lnt
index 18a8d27..1f99a4b 100644
--- a/bin/flint.lnt
+++ b/bin/flint.lnt
@@ -103,3 +103,10 @@
 -elib(123)		// macro def. with arg at, (just warn)
 
 -emacro(702, WEXITSTATUS)	// signed shift right 
+
+-e786	// String concatenation within initializer
+-e726	// Extraneous comma ignored
+
+-e825	// control flows into case/default without -fallthrough comment
+-e835	// A zero has been given as ___ argument to operator '___'  (<<)
+
diff --git a/bin/varnishd/flint.lnt b/bin/varnishd/flint.lnt
index f0dfd9a..0d810d2 100644
--- a/bin/varnishd/flint.lnt
+++ b/bin/varnishd/flint.lnt
@@ -77,7 +77,6 @@
 -e459	// unlocked access from func-ptr
 -e454	// mutex not released (...ReleaseLocked)
 -e457	// unprotected access
--e835	// A zero has been given as ___ argument to operator '___'  (<<)
 -e777	// float equality comparison
 -e679	// Suspicious Truncation in arithmetic expression combining with pointer
 
@@ -130,11 +129,9 @@
 -e455	// thread lock
 -e458	// unprotected read
 -e763	// Redundant declaration for symbol '...' previously declared
--e726	// Extraneous comma ignored
 -e728	// Symbol ... not explicitly initialized
 -e716	// while(1) ... 
 -e785	// Too few initializers for aggregate 
--e786	// String concatenation within initializer
 
 -esym(765, vcc_ProcAction) // could be made static
 -esym(759, vcc_ProcAction) // could be moved to module
diff --git a/bin/varnishlog/flint.lnt b/bin/varnishlog/flint.lnt
index 3a0395c..7669aca 100644
--- a/bin/varnishlog/flint.lnt
+++ b/bin/varnishlog/flint.lnt
@@ -18,4 +18,4 @@
 -e788	// enum constant '___' not used within defaulted switch
 -e641	// Converting enum '___' to '___'
 
--esym(785,VSL_tags);	// Sparse array
+-esym(785,VSL_tags)	// Sparse array
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index bf7d32b..07fef9b 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -128,7 +128,7 @@ h_order(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
 		 * starting on the new one.
 		 */
 		if (last[fd] != SLT_SessClose)
-			VSB_printf(ob[fd], "%5d %-12s %c %s\n",
+			VSB_printf(ob[fd], "%5u %-12s %c %s\n",
 			    fd, "Interrupted", type, VSL_tags[tag]);
 		h_order_finish(fd, vd);
 	}
@@ -141,8 +141,8 @@ h_order(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
 			VSB_cat(ob[fd], "\n");
 		else
 			flg[fd] |= F_INVCL;
-		VSB_printf(ob[fd], "%5d %-12s %c %.*s",
-		    fd, VSL_tags[tag], type, len, ptr);
+		VSB_printf(ob[fd], "%5u %-12s %c %.*s",
+		    fd, VSL_tags[tag], type, (int)len, ptr);
 		return (0);
 	case SLT_VCL_trace:
 	case SLT_VCL_return:
@@ -159,8 +159,8 @@ h_order(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
 		VSB_cat(ob[fd], "\n");
 		flg[fd] &= ~F_INVCL;
 	}
-	VSB_printf(ob[fd], "%5d %-12s %c %.*s\n",
-	    fd, VSL_tags[tag], type, len, ptr);
+	VSB_printf(ob[fd], "%5u %-12s %c %.*s\n",
+	    fd, VSL_tags[tag], type, (int)len, ptr);
 	switch (tag) {
 	case SLT_ReqEnd:
 	case SLT_BackendClose:
diff --git a/bin/varnishncsa/base64.c b/bin/varnishncsa/base64.c
index a631098..1c0979a 100644
--- a/bin/varnishncsa/base64.c
+++ b/bin/varnishncsa/base64.c
@@ -6,10 +6,6 @@
 
 #include "config.h"
 
-#include <sys/types.h>
-
-#include <stdio.h>		// for test-prog
-
 #include "base64.h"
 
 static const char b64[] =
@@ -63,6 +59,8 @@ VB64_decode(char *d, unsigned dlen, const char *s)
 
 #ifdef TEST_DRIVER
 
+#include <stdio.h>		// for test-prog
+
 const char *test1 =
 "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz"
 "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg"
diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index f885985..2a4bc21 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -77,7 +77,6 @@
 #include "vcs.h"
 #include "vpf.h"
 #include "vqueue.h"
-#include "vre.h"
 #include "vsb.h"
 
 #include "compat/daemon.h"
@@ -112,7 +111,7 @@ static struct logline {
 	VTAILQ_HEAD(, hdr) vcl_log;     /* VLC_Log entries */
 } **ll;
 
-struct VSM_data *vd;
+static struct VSM_data *vd;
 
 static size_t nll;
 
@@ -210,7 +209,6 @@ req_header(struct logline *l, const char *name)
 	VTAILQ_FOREACH(h, &l->req_headers, list) {
 		if (strcasecmp(h->key, name) == 0) {
 			return (h->value);
-			break;
 		}
 	}
 	return (NULL);
@@ -223,7 +221,6 @@ resp_header(struct logline *l, const char *name)
 	VTAILQ_FOREACH(h, &l->resp_headers, list) {
 		if (strcasecmp(h->key, name) == 0) {
 			return (h->value);
-			break;
 		}
 	}
 	return (NULL);
@@ -236,7 +233,6 @@ vcl_log(struct logline *l, const char *name)
 	VTAILQ_FOREACH(h, &l->vcl_log, list) {
 		if (strcasecmp(h->key, name) == 0) {
 			return (h->value);
-			break;
 		}
 	}
 	return (NULL);
@@ -796,6 +792,7 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
 					p = tmp;
 					break;
 				}
+				/* FALLTHROUGH */
 			default:
 				fprintf(stderr,
 				    "Unknown format starting at: %s\n", --p);
@@ -923,7 +920,8 @@ main(int argc, char *argv[])
 			/* XXX: Silently ignored: it's required anyway */
 			break;
 		case 'm':
-			m_flag = 1; /* Fall through */
+			m_flag = 1;
+			/* FALLTHOUGH */
 		default:
 			if (VSL_Arg(vd, c, optarg) > 0)
 				break;



More information about the varnish-commit mailing list