[master] d088c084a Appease some compiler warnings we use (yet).

Poul-Henning Kamp phk at FreeBSD.org
Wed Mar 24 09:03:07 UTC 2021


commit d088c084a66f5b89d4437a7c6b2dbde6fcb1c03e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Wed Mar 24 09:01:42 2021 +0000

    Appease some compiler warnings we use (yet).

diff --git a/bin/varnishd/fuzzers/esi_parse_fuzzer.c b/bin/varnishd/fuzzers/esi_parse_fuzzer.c
index b971280e2..a0ddaad11 100644
--- a/bin/varnishd/fuzzers/esi_parse_fuzzer.c
+++ b/bin/varnishd/fuzzers/esi_parse_fuzzer.c
@@ -46,7 +46,9 @@
 
 int LLVMFuzzerTestOneInput(const uint8_t *, size_t);
 
+extern struct VSC_main *VSC_C_main;
 struct VSC_main *VSC_C_main;
+extern struct params *cache_param;
 struct params *cache_param;
 
 void
diff --git a/bin/varnishtest/tests/c00057.vtc b/bin/varnishtest/tests/c00057.vtc
index 280cc3711..a4d1ae1ce 100644
--- a/bin/varnishtest/tests/c00057.vtc
+++ b/bin/varnishtest/tests/c00057.vtc
@@ -23,7 +23,7 @@ static void _accessor(volatile char *p) {
      p[0] = 'V'; p[1] = '\0';
      fprintf(stderr, "%p %s\n", p, p);
 }
-void (*accessor)(volatile char *p) = _accessor;
+static void (*accessor)(volatile char *p) = _accessor;
 
 }C
 	sub vcl_recv { C{
diff --git a/lib/libvarnish/vbh.c b/lib/libvarnish/vbh.c
index 073de5e0a..511e9e7de 100644
--- a/lib/libvarnish/vbh.c
+++ b/lib/libvarnish/vbh.c
@@ -495,7 +495,7 @@ struct foo {
 #define N 131101	/* Number of items */
 #define R -1		/* Random modulus */
 
-struct foo *ff[N];
+static struct foo *ff[N];
 
 static int v_matchproto_(vbh_cmp_t)
 cmp(void *priv, const void *a, const void *b)
diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c
index 213dbc37b..e3720ccf9 100644
--- a/lib/libvcc/vcc_acl.c
+++ b/lib/libvcc/vcc_acl.c
@@ -530,11 +530,15 @@ vcc_acl_emit(struct vcc *tl, const char *name, const char *rname)
 	Fh(tl, 0, "\treturn (0);\n}\n");
 
 	/* Emit the struct that will be referenced */
-	Fh(tl, 0, "\nconst struct vrt_acl %s[] = {{\n", rname);
+	Fh(tl, 0, "\nstatic const struct vrt_acl %s[] = {{\n", rname);
 	Fh(tl, 0, "\t.magic = VRT_ACL_MAGIC,\n");
 	Fh(tl, 0, "\t.match = &%s,\n", VSB_data(func));
 	Fh(tl, 0, "\t.name = \"%s\",\n", name);
 	Fh(tl, 0, "}};\n\n");
+	if (!tl->err_unref) {
+		AN(ifp);
+		VSB_printf(ifp->ini, "\t(void)%s;\n", rname);
+	}
 	VSB_destroy(&func);
 }
 
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index e52c1da4b..906567977 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -199,8 +199,9 @@ vcc_EmitProc(struct vcc *tl, struct proc *p)
 	nsub = tl->nsub++;
 
 	Fh(tl, 1, "vcl_func_f %s;\n", VSB_data(p->cname));
-	Fh(tl, 1, "const struct vcl_sub sub_%s[1] = {{\n",
-	   VSB_data(p->cname));
+	Fh(tl, 1, "extern const struct vcl_sub sub_%s[1];\n",
+	    VSB_data(p->cname));
+	Fh(tl, 1, "const struct vcl_sub sub_%s[1] = {{\n", VSB_data(p->cname));
 	Fh(tl, 1, "\t.magic\t\t= VCL_SUB_MAGIC,\n");
 	Fh(tl, 1, "\t.methods\t= 0x%x,\n", p->okmask);
 	Fh(tl, 1, "\t.name\t\t= \"%.*s\",\n", PF(p->name));
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index d261302b1..5ed4737bc 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -461,4 +461,4 @@ const char *vcc_MarkPriv(struct vcc *, struct procprivhead *,
 #define SkipToken(a, b) \
     do { vcc__Expect(a, b, __LINE__); ERRCHK(a); vcc_NextToken(a); } while (0)
 
-#define ACL_SYMBOL_PREFIX "vrt_acl_named"
+#define ACL_SYMBOL_PREFIX "vrt_acl"
diff --git a/lib/libvcc/vcc_token.c b/lib/libvcc/vcc_token.c
index 167b6ed28..9edff6226 100644
--- a/lib/libvcc/vcc_token.c
+++ b/lib/libvcc/vcc_token.c
@@ -541,7 +541,8 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
 			AZ(VSB_finish(vsb));
 
 			bprintf(namebuf, "blob_%u", tl->unique++);
-			Fh(tl, 0, "\nconst unsigned char %s_data[%zd] = {\n",
+			Fh(tl, 0,
+			    "\nstatic const unsigned char %s_data[%zd] = {\n",
 			    namebuf, VSB_len(vsb));
 			for (u = 0; u < VSB_len(vsb); u++) {
 				Fh(tl, 0, "\t0x%02x,", VSB_data(vsb)[u] & 0xff);
@@ -551,7 +552,8 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
 			if ((u & 7) != 7)
 				Fh(tl, 0, "\n");
 			Fh(tl, 0, "};\n");
-			Fh(tl, 0, "\nconst struct vrt_blob %s[1] = {{\n",
+			Fh(tl, 0,
+			    "\nstatic const struct vrt_blob %s[1] = {{\n",
 			    namebuf);
 			Fh(tl, 0, "\t.len =\t%zd,\n", VSB_len(vsb));
 			Fh(tl, 0, "\t.blob =\t%s_data,\n", namebuf);
diff --git a/lib/libvcc/vcc_xref.c b/lib/libvcc/vcc_xref.c
index 105f45698..e3351ec48 100644
--- a/lib/libvcc/vcc_xref.c
+++ b/lib/libvcc/vcc_xref.c
@@ -411,7 +411,7 @@ vcc_instance_info(struct vcc *tl, const struct symbol *sym)
 void
 VCC_InstanceInfo(struct vcc *tl)
 {
-	Fc(tl, 0, "\nconst struct vpi_ii VGC_instance_info[] = {\n");
+	Fc(tl, 0, "\nstatic const struct vpi_ii VGC_instance_info[] = {\n");
 	VCC_WalkSymbols(tl, vcc_instance_info, SYM_MAIN, SYM_INSTANCE);
 	Fc(tl, 0, "\t{ .p = NULL, .name = \"\" }\n");
 	Fc(tl, 0, "};\n");
diff --git a/vmod/vmod_debug.c b/vmod/vmod_debug.c
index a203af31b..8723481eb 100644
--- a/vmod/vmod_debug.c
+++ b/vmod/vmod_debug.c
@@ -1052,12 +1052,14 @@ xyzzy_get_ip(VRT_CTX)
 
 //lint -save -e9075 external symbol '...' defined without a prior declaration
 
+extern const struct vmod_data Vmod_wrong0_Data;
 const struct vmod_data Vmod_wrong0_Data = {
 	.vrt_major =    0,
 	.vrt_minor =    0,
 };
 
 //lint -save -e835 A zero has been given as left argument to operatorp'+'
+extern const struct vmod_data Vmod_wrong1_Data;
 const struct vmod_data Vmod_wrong1_Data = {
 	.vrt_major =    VRT_MAJOR_VERSION,
 	.vrt_minor =    VRT_MINOR_VERSION + 1,
@@ -1068,6 +1070,7 @@ static const struct foo {
 	int bar;
 } foo_struct[1];
 
+extern const struct vmod_data Vmod_wrong2_Data;
 const struct vmod_data Vmod_wrong2_Data = {
 	.vrt_major =    VRT_MAJOR_VERSION,
 	.vrt_minor =    VRT_MINOR_VERSION,
@@ -1078,6 +1081,7 @@ const struct vmod_data Vmod_wrong2_Data = {
 	.proto =	"blablabla",
 };
 
+extern const struct vmod_data Vmod_wrong3_Data;
 const struct vmod_data Vmod_wrong3_Data = {
 	.vrt_major =    VRT_MAJOR_VERSION,
 	.vrt_minor =    VRT_MINOR_VERSION,


More information about the varnish-commit mailing list