[6.0] 5dbca6f17 vcc: Insert the built-in source last
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Fri Aug 20 14:32:06 UTC 2021
commit 5dbca6f173bee9be9c0b5bd5a116a7e1bfa443e7
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Wed Aug 4 17:32:38 2021 +0200
vcc: Insert the built-in source last
In the output of vcl.show -v, it means that the least useful file (in the
sense that it is common to every single vcl.load) is now printed last.
This change originates from a larger and more intrusive refactoring.
It also helps get rid of spurious Wstring-contatenation warnings from
clang 12 in the test suite, instead of disabling it altogether.
Refs c8174af68956206115972e72e75ceddbd758116e
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 50288c6ef..81a088c2e 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -504,7 +504,7 @@ static void
vcc_resolve_includes(struct vcc *tl)
{
struct token *t, *t1, *t2;
- struct source *sp;
+ struct source *sp, *builtin_sp;
struct vsb *vsb;
const char *p;
@@ -559,7 +559,9 @@ vcc_resolve_includes(struct vcc *tl)
vcc_ErrWhere(tl, t1);
return;
}
- VTAILQ_INSERT_TAIL(&tl->sources, sp, list);
+ builtin_sp = VTAILQ_LAST(&tl->sources, sourcehead);
+ AN(builtin_sp);
+ VTAILQ_INSERT_BEFORE(builtin_sp, sp, list);
sp->idx = tl->nsources++;
tl->t = t2;
vcc_Lexer(tl, sp);
diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h
index 52e0dd282..5d0186294 100644
--- a/lib/libvcc/vcc_compile.h
+++ b/lib/libvcc/vcc_compile.h
@@ -208,6 +208,7 @@ struct inifin {
};
VTAILQ_HEAD(inifinhead, inifin);
+VTAILQ_HEAD(sourcehead, source);
struct vcc {
unsigned magic;
@@ -228,7 +229,7 @@ struct vcc {
/* Instance section */
struct tokenhead tokens;
- VTAILQ_HEAD(, source) sources;
+ struct sourcehead sources;
unsigned nsources;
struct source *src;
struct token *t;
More information about the varnish-commit
mailing list