[master] a2ef267af Revert "vcc: make vgc probes actual pointers to compound literals"
Nils Goroll
nils.goroll at uplex.de
Wed Dec 3 15:31:05 UTC 2025
commit a2ef267af8142ff43427c485feb6d82c3991e7f4
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Wed Dec 3 16:24:25 2025 +0100
Revert "vcc: make vgc probes actual pointers to compound literals"
The compound literal is not supported as a constant expression by older
compilers, and trying to avoid it (by defining the probe as a struct literal and
then taking a pointer to it) comes with another set of problems around
unreferenced symbols.
So all in all I must say that the single element array "hack" has many more
benefits than were apparent to me and I now changed my mind that they actually
are, objectively, the better solution - except for the fact that arrays can not
be compared, but that will be fixed with #4418.
This reverts commit 7a88cab9fe0ea567e3ceac9fa9a9cd7108e85504.
Ref #4418
Ref #4410
diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c
index 8feb20df4..90d0f6bad 100644
--- a/lib/libvcc/vcc_backend.c
+++ b/lib/libvcc/vcc_backend.c
@@ -214,8 +214,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep)
bprintf(buf, "vgc_probe__%d", tl->nprobe++);
name = buf;
}
- Fh(tl, 0, "static const struct vrt_backend_probe * const %s =\n", name);
- Fh(tl, 0, " &(const struct vrt_backend_probe){\n");
+ Fh(tl, 0, "static const struct vrt_backend_probe %s[] = {{\n", name);
Fh(tl, 0, "\t.magic = VRT_BACKEND_PROBE_MAGIC,\n");
if (sym != NULL) {
Fh(tl, 0, "\t.vcl_name = \"%s\",\n", sym->name);
@@ -340,7 +339,7 @@ vcc_ParseProbeSpec(struct vcc *tl, const struct symbol *sym, char **namep)
if (status > 0)
Fh(tl, 0, "\t.exp_status = %u,\n", status);
Fh(tl, 0, "\t.exp_close = %u,\n", exp_close);
- Fh(tl, 0, "};\n");
+ Fh(tl, 0, "}};\n");
SkipToken(tl, '}');
}
More information about the varnish-commit
mailing list