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
df1455d1
Commit
df1455d1
authored
Aug 22, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve VCC error messages.
Fixes: #2696
parent
13d519c6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
11 deletions
+17
-11
v00018.vtc
bin/varnishtest/tests/v00018.vtc
+2
-2
v00020.vtc
bin/varnishtest/tests/v00020.vtc
+1
-1
v00021.vtc
bin/varnishtest/tests/v00021.vtc
+2
-2
vcc_parse.c
lib/libvcc/vcc_parse.c
+12
-6
No files found.
bin/varnishtest/tests/v00018.vtc
View file @
df1455d1
...
...
@@ -83,7 +83,7 @@ varnish v1 -errvcl {Unknown token '<<' when looking for STRING} {
sub vcl_recv { ban (<<); }
}
varnish v1 -errvcl {
Expected an action, 'if', '{' or '}'
} {
varnish v1 -errvcl {
Symbol not found
} {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { ban_hash (if); }
}
...
...
@@ -93,7 +93,7 @@ varnish v1 -vcl {
sub vcl_recv { ban ("req.url ~ foo"); }
}
varnish v1 -errvcl
{Expected an action, 'if', '{' or '}'}
{
varnish v1 -errvcl
"Symbol not found"
{
backend b { .host = "127.0.0.1"; }
sub vcl_recv { kluf ; }
}
...
...
bin/varnishtest/tests/v00020.vtc
View file @
df1455d1
...
...
@@ -20,7 +20,7 @@ varnish v1 -errvcl {Found: '0' at} { 0; }
# VCLs tokenstream.
# XXX: A better error message would be desirable
varnish v1 -errvcl {
Expected an action, 'if',
} " sub vcl_recv { { } { "
varnish v1 -errvcl {
Symbol not found
} " sub vcl_recv { { } { "
varnish v1 -errvcl {Comparison of different types: INT '!=' STRING} {
sub vcl_recv {
...
...
bin/varnishtest/tests/v00021.vtc
View file @
df1455d1
...
...
@@ -12,13 +12,13 @@ varnish v1 -errvcl {Variable is read only.} {
sub vcl_recv { call foo ; }
}
varnish v1 -errvcl "
Expected an action, 'if', '{' or '}'
" {
varnish v1 -errvcl "
Symbol not found
" {
backend b { .host = "127.0.0.1"; }
sub vcl_recv { discard; }
}
varnish v1 -errvcl "
Expected an action, 'if', '{' or '}'
" {
varnish v1 -errvcl "
Symbol not found
" {
backend b { .host = "127.0.0.1"; }
sub foo { discard; }
...
...
lib/libvcc/vcc_parse.c
View file @
df1455d1
...
...
@@ -160,7 +160,7 @@ vcc_Compound(struct vcc *tl)
vcc_NextToken
(
tl
);
tl
->
indent
-=
INDENT
;
Fb
(
tl
,
1
,
"}
\n
"
);
return
;
break
;
case
CSRC
:
if
(
tl
->
allow_inline_c
)
{
Fb
(
tl
,
1
,
"%.*s
\n
"
,
...
...
@@ -177,25 +177,31 @@ vcc_Compound(struct vcc *tl)
VSB_printf
(
tl
->
sb
,
"End of input while in compound statement
\n
"
);
tl
->
err
=
1
;
return
;
break
;
case
ID
:
sym
=
VCC_SymbolGet
(
tl
,
SYM_NONE
,
SYMTAB_NOERR
,
XREF_NONE
);
if
(
sym
!=
NULL
&&
sym
->
action
!=
NULL
)
{
if
(
sym
==
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Symbol not found.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
}
else
if
(
sym
->
action
==
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Symbol cannot be used here.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
}
else
{
if
(
sym
->
action_mask
!=
0
)
vcc_AddUses
(
tl
,
t
,
NULL
,
sym
->
action_mask
,
"Not a valid action"
);
sym
->
action
(
tl
,
t
,
sym
);
break
;
}
/* FALLTHROUGH */
break
;
default:
/* We deliberately do not mention inline C */
VSB_printf
(
tl
->
sb
,
"Expected an action, 'if', '{' or '}'
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
break
;
}
Fb
(
tl
,
1
,
"if (*ctx->handling) return;
\n
"
);
}
...
...
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