Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b2a86df6
Commit
b2a86df6
authored
May 16, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce a "reserved" symboltype and wrangle an error message or two.
parent
b072bb7e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
12 deletions
+19
-12
m00001.vtc
bin/varnishtest/tests/m00001.vtc
+1
-1
v00020.vtc
bin/varnishtest/tests/v00020.vtc
+7
-2
symbol_kind.h
include/tbl/symbol_kind.h
+1
-0
vcc_action.c
lib/libvcc/vcc_action.c
+6
-5
vcc_expr.c
lib/libvcc/vcc_expr.c
+3
-3
vcc_parse.c
lib/libvcc/vcc_parse.c
+1
-1
No files found.
bin/varnishtest/tests/m00001.vtc
View file @
b2a86df6
...
...
@@ -66,7 +66,7 @@ varnish v1 -cliok "vcl.discard vcl2"
varnish v1 -cliok "vcl.list"
varnish v1 -cliok "debug.vmod"
varnish v1 -errvcl {Symbol type (vmod) can not be used in expression.} {
varnish v1 -errvcl {Symbol
'std'
type (vmod) can not be used in expression.} {
import std;
sub vcl_recv {
...
...
bin/varnishtest/tests/v00020.vtc
View file @
b2a86df6
...
...
@@ -20,7 +20,7 @@ varnish v1 -errvcl {Found: '0' at} { 0; }
# VCLs tokenstream.
# XXX: A better error message would be desirable
varnish v1 -errvcl {Symbol
not found
} " sub vcl_recv { { } { "
varnish v1 -errvcl {Symbol
cannot be used here
} " sub vcl_recv { { } { "
varnish v1 -errvcl {Comparison of different types: INT '!=' STRING} {
sub vcl_recv {
...
...
@@ -31,7 +31,7 @@ varnish v1 -errvcl {Comparison of different types: INT '!=' STRING} {
}
}
varnish v1 -errvcl {Symbol type (sub) can not be used in expression.} {
varnish v1 -errvcl {Symbol
'vcl_recv'
type (sub) can not be used in expression.} {
sub vcl_recv {
set req.http.foo = vcl_recv;
}
...
...
@@ -307,6 +307,11 @@ varnish v1 -errvcl {'||' must be preceeded by BOOL, found REAL.} {
sub vcl_recv { if (std.random(0,1) || 0) { } }
}
varnish v1 -errvcl {Symbol 'acl' has wrong type (reserved):} {
import std;
sub vcl_recv { call acl; }
}
server s1 {
rxreq
txresp -hdr "bar: X"
...
...
include/tbl/symbol_kind.h
View file @
b2a86df6
...
...
@@ -30,6 +30,7 @@
/*lint -save -e525 -e539 */
VCC_KIND
(
NONE
,
none
)
VCC_KIND
(
RESERVED
,
reserved
)
VCC_KIND
(
ACL
,
acl
)
VCC_KIND
(
ACTION
,
action
)
VCC_KIND
(
BACKEND
,
backend
)
...
...
lib/libvcc/vcc_action.c
View file @
b2a86df6
...
...
@@ -46,11 +46,12 @@ vcc_act_call(struct vcc *tl, struct token *t, struct symbol *sym)
(
void
)
t
;
ExpectErr
(
tl
,
ID
);
sym
=
VCC_SymbolGet
(
tl
,
SYM_SUB
,
SYMTAB_CREATE
,
XREF_REF
);
AN
(
sym
);
vcc_AddCall
(
tl
,
sym
);
VCC_GlobalSymbol
(
sym
,
SUB
,
"VGC_function"
);
Fb
(
tl
,
1
,
"%s(ctx);
\n
"
,
sym
->
rname
);
SkipToken
(
tl
,
';'
);
if
(
sym
!=
NULL
)
{
vcc_AddCall
(
tl
,
sym
);
VCC_GlobalSymbol
(
sym
,
SUB
,
"VGC_function"
);
Fb
(
tl
,
1
,
"%s(ctx);
\n
"
,
sym
->
rname
);
SkipToken
(
tl
,
';'
);
}
}
/*--------------------------------------------------------------------*/
...
...
lib/libvcc/vcc_expr.c
View file @
b2a86df6
...
...
@@ -713,9 +713,9 @@ vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
return
;
}
VSB_printf
(
tl
->
sb
,
"Symbol type (%s) can not be used in expression.
\n
"
,
sym
->
kind
->
name
);
vcc_ErrWhere
(
tl
,
t
l
->
t
);
"Symbol
'%.*s'
type (%s) can not be used in expression.
\n
"
,
PF
(
t
),
sym
->
kind
->
name
);
vcc_ErrWhere
(
tl
,
t
);
if
(
sym
->
def_b
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
"That symbol was defined here:
\n
"
);
vcc_ErrWhere
(
tl
,
sym
->
def_b
);
...
...
lib/libvcc/vcc_parse.c
View file @
b2a86df6
...
...
@@ -434,5 +434,5 @@ vcc_Parse_Init(struct vcc *tl)
struct
toplev
*
tp
;
for
(
tp
=
toplev
;
tp
->
name
!=
NULL
;
tp
++
)
AN
(
VCC_MkSym
(
tl
,
tp
->
name
,
SYM_
NONE
,
tp
->
vcllo
,
tp
->
vclhi
));
AN
(
VCC_MkSym
(
tl
,
tp
->
name
,
SYM_
RESERVED
,
tp
->
vcllo
,
tp
->
vclhi
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment