Commit d088c084 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Appease some compiler warnings we use (yet).

parent ac0b20c4
......@@ -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
......
......@@ -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{
......
......@@ -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)
......
......@@ -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);
}
......
......@@ -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));
......
......@@ -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"
......@@ -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);
......
......@@ -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");
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment