[master] 26fcf62 Minor flexelint nit-picking, while trying to make sure there was nothing major lurking.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Sep 5 08:47:08 CEST 2016
commit 26fcf62958b33569d4570621a4869f7ef8a0456b
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Sep 5 06:45:54 2016 +0000
Minor flexelint nit-picking, while trying to make sure there was nothing
major lurking.
diff --git a/bin/varnishtest/flint.lnt b/bin/varnishtest/flint.lnt
index a02b3be..a527ec3 100644
--- a/bin/varnishtest/flint.lnt
+++ b/bin/varnishtest/flint.lnt
@@ -5,6 +5,8 @@
-esym(850, av)
-esym(528, iter_call) // Flexelint bug
+-esym(534, snprintf) // Only for varnishtest, and not really nice
+
-e712 // 14 Info 712 Loss of precision (___) (___ to ___)
-e747 // 16 Info 747 Significant prototype coercion (___) ___ to ___
diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h
index a614cd0..49dff08 100644
--- a/bin/varnishtest/vtc.h
+++ b/bin/varnishtest/vtc.h
@@ -113,7 +113,6 @@ void extmacro_def(const char *name, const char *fmt, ...)
__v_printflike(2, 3);
struct http;
-extern const struct cmds http_cmds[];
void cmd_stream(CMD_ARGS);
void start_h2(struct http *hp);
void stop_h2(struct http *hp);
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index 67c86d1..d3c3f8b 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -78,7 +78,7 @@ proxy_cb(void *priv, const struct suckaddr *sa)
}
static void
-client_proxy(struct vtclog *vl, int fd, int version, char *spec)
+client_proxy(struct vtclog *vl, int fd, int version, const char *spec)
{
struct suckaddr *sac, *sas;
const char *err;
diff --git a/bin/varnishtest/vtc_h2_tbl.c b/bin/varnishtest/vtc_h2_tbl.c
index 0a50d1c..21bcbd9 100644
--- a/bin/varnishtest/vtc_h2_tbl.c
+++ b/bin/varnishtest/vtc_h2_tbl.c
@@ -44,7 +44,7 @@
#undef STAT_HDRS
/*lint -save -e778 */
-struct hpk_hdr sttbl[] = {
+const struct hpk_hdr sttbl[] = {
{{NULL, 0, 0}, {NULL, 0, 0}, hpk_idx, 0},
#define STAT_HDRS(j, k, v) \
{ \
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 1dad7a5..15e48f5 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -49,6 +49,8 @@
#include "vtcp.h"
#include "hpack.h"
+static const struct cmds http_cmds[];
+
/* SECTION: client-server client/server
*
* Client and server threads are fake HTTP entities used to test your Varnish
@@ -738,11 +740,8 @@ cmd_http_rxresphdrs(CMD_ARGS)
* Ungzip rx'ed body
*/
-#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
-
#define OVERHEAD 64L
-
static void
cmd_http_gunzip_body(CMD_ARGS)
{
@@ -1679,7 +1678,7 @@ cmd_http_fatal(CMD_ARGS)
* Same as for the top-level barrier
*/
-char PREFACE[] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
+const char PREFACE[] = "PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n";
/* SECTION: client-server.spec.txpri txpri (client)
*
@@ -1785,7 +1784,7 @@ cmd_http_stream(CMD_ARGS)
* Execute HTTP specifications
*/
-const struct cmds http_cmds[] = {
+static const struct cmds http_cmds[] = {
{ "timeout", cmd_http_timeout },
{ "txreq", cmd_http_txreq },
@@ -1856,7 +1855,8 @@ http_process(struct vtclog *vl, const char *spec, int sock, int *sfd)
hp->gziplevel = 0;
hp->gzipresidual = -1;
- VTCP_hisname(sock, hp->rem_ip, VTCP_ADDRBUFSIZE, hp->rem_port, VTCP_PORTBUFSIZE);
+ VTCP_hisname(sock,
+ hp->rem_ip, VTCP_ADDRBUFSIZE, hp->rem_port, VTCP_PORTBUFSIZE);
parse_string(spec, http_cmds, hp, vl);
if (hp->h2)
stop_h2(hp);
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index b8a0349..6f7cc04 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -52,7 +52,6 @@
#include "hpack.h"
#include "vend.h"
-#define MAX_HDR 50
#define ERR_MAX 13
#define BUF_SIZE (1024*2048)
@@ -102,7 +101,6 @@ struct stream {
pthread_cond_t cond;
struct frame *frame;
pthread_t tp;
- unsigned reading;
struct http *hp;
int64_t ws;
@@ -509,7 +507,7 @@ parse_hdr(struct stream *s, struct frame *f, struct vsb *vsb)
if (f->type == TYPE_HEADERS && f->flags & PRIORITY){
shift += 5;
n = vbe32dec(f->data);
- s->dependency = n & ~(1 << 31);
+ s->dependency = n & ~(1U << 31);
exclusive = n >> 31;
s->weight = f->data[4];
@@ -521,7 +519,7 @@ parse_hdr(struct stream *s, struct frame *f, struct vsb *vsb)
} else if (f->type == TYPE_PUSH_PROMISE){
shift += 4;
n = vbe32dec(f->data);
- f->md.promised = n & ~(1 << 31);
+ f->md.promised = n & ~(1U << 31);
}
AZ(VSB_bcat(vsb, data + shift, size - shift));
@@ -545,7 +543,7 @@ parse_prio(struct stream *s, struct frame *f)
AN(buf);
n = vbe32dec(f->data);
- f->md.prio.stream = n & ~(1 << 31);
+ f->md.prio.stream = n & ~(1U << 31);
s->dependency = f->md.prio.stream;
if (n >> 31){
@@ -838,14 +836,14 @@ receive_frame(void *priv)
} \
} while (0)
-#define STRTOU32_CHECK(n, sp, p, v, c, l) \
-do { \
- sp++; \
- AN(*sp); \
- STRTOU32(n, *sp, p, v, c); \
- if (l && n >= (1 << l)) \
- vtc_log(v, 0, c " must be a %d-bits integer (found %s)", \
- l, *sp); \
+#define STRTOU32_CHECK(n, sp, p, v, c, l) \
+do { \
+ sp++; \
+ AN(*sp); \
+ STRTOU32(n, *sp, p, v, c); \
+ if (l && n >= (1U << l)) \
+ vtc_log(v, 0, \
+ c " must be a %d-bits integer (found %s)", l, *sp); \
} while (0)
#define CHECK_LAST_FRAME(TYPE) \
@@ -1471,7 +1469,7 @@ cmd_tx11obj(CMD_ARGS)
}
else if (AV_IS("-litIdxHdr")) {
av++;
- if (AV_IS("inc")) { hdr.t = hpk_inc; }
+ if (AV_IS("inc")) { hdr.t = hpk_inc; }
else if (AV_IS("not")) { hdr.t = hpk_not; }
else if (AV_IS("never")) { hdr.t = hpk_never; }
else
@@ -1489,7 +1487,7 @@ cmd_tx11obj(CMD_ARGS)
}
else if (AV_IS("-litHdr")) {
av++;
- if (AV_IS("inc")) { hdr.t = hpk_inc; }
+ if (AV_IS("inc")) { hdr.t = hpk_inc; }
else if (AV_IS("not")) { hdr.t = hpk_not; }
else if (AV_IS("never")) { hdr.t = hpk_never; }
else
@@ -1538,7 +1536,7 @@ cmd_tx11obj(CMD_ARGS)
f.flags |= PRIORITY;
}
else if (AV_IS("-ex")) {
- exclusive = 1 << 31;
+ exclusive = 1U << 31;
f.flags |= PRIORITY;
}
else if (AV_IS("-weight")) {
@@ -2527,7 +2525,7 @@ stream_new(const char *name, struct http *h)
s->dependency = 0;
STRTOU32(s->id, name, p, h->vl, "stream");
- if (s->id & (1 << 31))
+ if (s->id & (1U << 31))
vtc_log(h->vl, 0, "Stream id must be a 31-bits integer "
"(found %s)", name);
More information about the varnish-commit
mailing list