Mailing List Archive

[master] 373caaf28 Flexelinting
commit 373caaf28bdd266bd5eb643b2ca2a6ed9a609708
Author: Nils Goroll <nils.goroll@uplex.de>
Date: Mon Aug 15 20:22:09 2022 +0200

Flexelinting

After #3515 merge

I do not understand
Warning 552: Symbol 'vpi_wrk_len' (line 50, file cache/cache_vpi.c) not accessed

It is used for array sizing, so I have silenced the warning.

diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 779079f8d..b93fdb7b1 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -43,7 +43,6 @@

#include "cache_varnishd.h"
#include "cache_transport.h"
-#include "vcc_interface.h"

#include "cache_filter.h"
#include "common/heritage.h"
diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c
index d7a58a5d9..0f3245c8c 100644
--- a/bin/varnishd/cache/cache_vcl.c
+++ b/bin/varnishd/cache/cache_vcl.c
@@ -282,7 +282,7 @@ vcl_find(const char *name)
static void
vcl_panic_conf(struct vsb *vsb, const struct VCL_conf *conf)
{
- int i;
+ unsigned u;
const struct vpi_ii *ii;

if (PAN_dump_struct(vsb, conf, VCL_CONF_MAGIC, "conf"))
@@ -290,8 +290,8 @@ vcl_panic_conf(struct vsb *vsb, const struct VCL_conf *conf)
VSB_printf(vsb, "syntax = \"%u\",\n", conf->syntax);
VSB_cat(vsb, "srcname = {\n");
VSB_indent(vsb, 2);
- for (i = 0; i < conf->nsrc; ++i)
- VSB_printf(vsb, "[%d] = \"%s\",\n", i, conf->srcname[i]);
+ for (u = 0; u < conf->nsrc; ++u)
+ VSB_printf(vsb, "[%u] = \"%s\",\n", u, conf->srcname[u]);
VSB_indent(vsb, -2);
VSB_cat(vsb, "},\n");
VSB_cat(vsb, "instances = {\n");
@@ -947,6 +947,7 @@ vcl_cli_show(struct cli *cli, const char * const *av, void *priv)
struct vcl *vcl;
int verbose = 0;
int i = 2;
+ unsigned u;

ASSERT_CLI();
ASSERT_VCL_ACTIVE();
@@ -984,11 +985,11 @@ vcl_cli_show(struct cli *cli, const char * const *av, void *priv)
}
CHECK_OBJ_NOTNULL(vcl->conf, VCL_CONF_MAGIC);
if (verbose) {
- for (i = 0; i < vcl->conf->nsrc; i++)
- VCLI_Out(cli, "// VCL.SHOW %d %zd %s\n%s\n",
- i, strlen(vcl->conf->srcbody[i]),
- vcl->conf->srcname[i],
- vcl->conf->srcbody[i]);
+ for (u = 0; u < vcl->conf->nsrc; u++)
+ VCLI_Out(cli, "// VCL.SHOW %u %zd %s\n%s\n",
+ u, strlen(vcl->conf->srcbody[u]),
+ vcl->conf->srcname[u],
+ vcl->conf->srcbody[u]);
} else {
VCLI_Out(cli, "%s", vcl->conf->srcbody[0]);
}
diff --git a/bin/varnishd/cache/cache_vpi.c b/bin/varnishd/cache/cache_vpi.c
index 375b4ea4d..3b21037fb 100644
--- a/bin/varnishd/cache/cache_vpi.c
+++ b/bin/varnishd/cache/cache_vpi.c
@@ -124,7 +124,8 @@ vpi_ref_panic(struct vsb *vsb, unsigned n, const struct vcl *vcl)

if (src != NULL) {
w = strlen(src);
- if (ref->offset >= w)
+ assert(w > 0);
+ if (ref->offset >= (unsigned)w)
src = NULL;
}
if (src != NULL) {
diff --git a/bin/varnishd/flint.lnt b/bin/varnishd/flint.lnt
index 65e77d09e..c40188132 100644
--- a/bin/varnishd/flint.lnt
+++ b/bin/varnishd/flint.lnt
@@ -164,6 +164,9 @@

-e441 // for clause irregularity: loop variable '___' not found in 2nd for expression

+// cache_vpi.c
+-esym(552, vpi_wrk_len)
+
// from libvarnish
--emacro((835),VBH_NOIDX)
--emacro((835),O_CLOEXEC)
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 94b0252fe..2199f6a07 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -689,7 +689,7 @@ struct VCL_conf {
unsigned nref;
const struct vpi_ref *ref;

- int nsrc;
+ unsigned nsrc;
unsigned nsub;
const char **srcname;
const char **srcbody;
_______________________________________________
varnish-commit mailing list
varnish-commit@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-commit