Commit 5dbca6f1 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

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 c8174af6
parent 63d35cc9
...@@ -504,7 +504,7 @@ static void ...@@ -504,7 +504,7 @@ static void
vcc_resolve_includes(struct vcc *tl) vcc_resolve_includes(struct vcc *tl)
{ {
struct token *t, *t1, *t2; struct token *t, *t1, *t2;
struct source *sp; struct source *sp, *builtin_sp;
struct vsb *vsb; struct vsb *vsb;
const char *p; const char *p;
...@@ -559,7 +559,9 @@ vcc_resolve_includes(struct vcc *tl) ...@@ -559,7 +559,9 @@ vcc_resolve_includes(struct vcc *tl)
vcc_ErrWhere(tl, t1); vcc_ErrWhere(tl, t1);
return; 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++; sp->idx = tl->nsources++;
tl->t = t2; tl->t = t2;
vcc_Lexer(tl, sp); vcc_Lexer(tl, sp);
......
...@@ -208,6 +208,7 @@ struct inifin { ...@@ -208,6 +208,7 @@ struct inifin {
}; };
VTAILQ_HEAD(inifinhead, inifin); VTAILQ_HEAD(inifinhead, inifin);
VTAILQ_HEAD(sourcehead, source);
struct vcc { struct vcc {
unsigned magic; unsigned magic;
...@@ -228,7 +229,7 @@ struct vcc { ...@@ -228,7 +229,7 @@ struct vcc {
/* Instance section */ /* Instance section */
struct tokenhead tokens; struct tokenhead tokens;
VTAILQ_HEAD(, source) sources; struct sourcehead sources;
unsigned nsources; unsigned nsources;
struct source *src; struct source *src;
struct token *t; struct token *t;
......
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