Skip to content

Commit

Permalink
vcc: Cross reference VMOD symbols
Browse files Browse the repository at this point in the history
With a default read mask based on the type of symbol. Starting with a
default comprehensive mask should then help implement the $Restrict
stanza from VIP4, simply by AND-ing the masks.
  • Loading branch information
Dridi committed Jan 25, 2021
1 parent 903fa45 commit 5bf609b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/libvcc/vcc_expr.c
Expand Up @@ -455,14 +455,14 @@ vcc_do_arg(struct vcc *tl, struct func_arg *fa)

static void
vcc_func(struct vcc *tl, struct expr **e, const void *priv,
const char *extra, const struct symbol *sym)
const char *extra, struct symbol *sym)
{
vcc_type_t rfmt;
const char *cfunc;
struct expr *e1;
struct func_arg *fa, *fa2;
VTAILQ_HEAD(,func_arg) head;
struct token *t1;
struct token *tf, *t1;
const struct vjsn_val *vv, *vvp;
const char *sa, *extra_sep;
char ssa[64];
Expand Down Expand Up @@ -492,6 +492,7 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
AN((*e)->instance);
extra = (*e)->instance->rname;
}
tf = VTAILQ_PREV(tl->t, tokenhead, list);
SkipToken(tl, '(');
if (extra == NULL) {
extra = "";
Expand Down Expand Up @@ -631,6 +632,7 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
*e = vcc_expr_edit(tl, e1->fmt, "\v1\v-\n)", e1, NULL);
}
SkipToken(tl, ')');
vcc_AddUses(tl, tf, NULL, sym, XREF_READ);
}


Expand Down
2 changes: 2 additions & 0 deletions lib/libvcc/vcc_vmod.c
Expand Up @@ -97,6 +97,7 @@ func_sym(struct vcc *tl, vcc_kind_t kind, const struct symbol *psym,
if (kind == SYM_OBJECT) {
sym->eval_priv = v;
sym->vmod_name = psym->vmod_name;
sym->r_methods = VCL_MET_INIT;
vcc_VmodObject(tl, sym);
vcc_VmodSymbols(tl, sym);
return;
Expand All @@ -118,6 +119,7 @@ func_sym(struct vcc *tl, vcc_kind_t kind, const struct symbol *psym,
assert(v->type == VJSN_STRING);
sym->type = VCC_Type(v->value);
AN(sym->type);
sym->r_methods = VCL_MET_TASK_C|VCL_MET_TASK_B|VCL_MET_TASK_H;
}

static void
Expand Down

0 comments on commit 5bf609b

Please sign in to comment.