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
192bfb64
Commit
192bfb64
authored
May 30, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of a single use, special case, symbol table lookup function.
parent
21956d6c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
96 deletions
+19
-96
m00008.vtc
bin/varnishtest/tests/m00008.vtc
+1
-1
vcc_compile.h
lib/libvcc/vcc_compile.h
+0
-2
vcc_symb.c
lib/libvcc/vcc_symb.c
+0
-62
vcc_vmod.c
lib/libvcc/vcc_vmod.c
+18
-31
No files found.
bin/varnishtest/tests/m00008.vtc
View file @
192bfb64
...
...
@@ -2,7 +2,7 @@ varnishtest "VCL compiler vmod coverage / vmod loading"
feature topbuild
varnish v1 -errvcl {
Module debug conflicts with other symbol.
} {
varnish v1 -errvcl {
Symbol 'debug' has wrong type (sub):
} {
backend b { .host = "127.0.0.1"; }
sub debug {}
import debug;
...
...
lib/libvcc/vcc_compile.h
View file @
192bfb64
...
...
@@ -357,8 +357,6 @@ extern const char SYMTAB_NOERR[];
extern
const
char
SYMTAB_CREATE
[];
struct
symbol
*
VCC_SymbolGet
(
struct
vcc
*
,
vcc_kind_t
,
const
char
*
,
const
char
*
);
struct
symbol
*
VCC_SymbolGetTok
(
struct
vcc
*
,
vcc_kind_t
,
const
char
*
,
const
char
*
,
const
struct
token
*
);
typedef
void
symwalk_f
(
struct
vcc
*
tl
,
const
struct
symbol
*
s
);
void
VCC_WalkSymbols
(
struct
vcc
*
tl
,
symwalk_f
*
func
,
vcc_kind_t
);
...
...
lib/libvcc/vcc_symb.c
View file @
192bfb64
...
...
@@ -278,68 +278,6 @@ vcc_symxref(struct symbol *sym, const char *x, const struct token *t)
}
}
struct
symbol
*
VCC_SymbolGetTok
(
struct
vcc
*
tl
,
vcc_kind_t
kind
,
const
char
*
e
,
const
char
*
x
,
const
struct
token
*
t
)
{
struct
symbol
*
sym
;
AN
(
e
);
if
(
tl
->
syntax
>=
VCL_41
&&
e
==
SYMTAB_CREATE
&&
kind
!=
SYM_SUB
&&
(
t
->
b
[
0
]
==
'v'
||
t
->
b
[
0
]
==
'V'
)
&&
(
t
->
b
[
1
]
==
'c'
||
t
->
b
[
1
]
==
'C'
)
&&
(
t
->
b
[
2
]
==
'l'
||
t
->
b
[
2
]
==
'L'
)
&&
(
t
->
b
[
3
]
==
'_'
))
{
VSB_printf
(
tl
->
sb
,
"Symbols named 'vcl_*' are reserved.
\n
At:"
);
vcc_ErrWhere
(
tl
,
t
);
return
(
NULL
);
}
sym
=
VCC_Symbol
(
tl
,
t
->
b
,
t
->
e
,
kind
,
e
==
SYMTAB_CREATE
?
1
:
0
,
tl
->
syntax
,
tl
->
syntax
);
if
(
sym
==
NULL
&&
e
==
SYMTAB_NOERR
)
return
(
sym
);
if
(
sym
==
NULL
)
{
VSB_printf
(
tl
->
sb
,
"%s: "
,
e
);
vcc_ErrToken
(
tl
,
t
);
sym
=
VCC_Symbol
(
tl
,
t
->
b
,
t
->
e
,
kind
,
0
,
VCL_LOW
,
VCL_HIGH
);
if
(
sym
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
" (Only available when"
);
if
(
sym
->
lorev
>=
VCL_LOW
)
VSB_printf
(
tl
->
sb
,
" %.1f <="
,
.
1
*
sym
->
lorev
);
VSB_printf
(
tl
->
sb
,
" VCL syntax"
);
if
(
sym
->
hirev
<=
VCL_HIGH
)
VSB_printf
(
tl
->
sb
,
" <= %.1f"
,
.
1
*
sym
->
hirev
);
VSB_printf
(
tl
->
sb
,
")"
);
}
VSB_cat
(
tl
->
sb
,
"
\n
At: "
);
vcc_ErrWhere
(
tl
,
t
);
return
(
NULL
);
}
assert
(
sym
->
lorev
<=
tl
->
syntax
&&
sym
->
hirev
>=
tl
->
syntax
);
if
(
kind
!=
SYM_NONE
&&
kind
!=
sym
->
kind
)
{
VSB_printf
(
tl
->
sb
,
"Symbol "
);
vcc_ErrToken
(
tl
,
t
);
VSB_printf
(
tl
->
sb
,
" has wrong type (%s): "
,
sym
->
kind
->
name
);
VSB_cat
(
tl
->
sb
,
"
\n
At: "
);
vcc_ErrWhere
(
tl
,
t
);
if
(
sym
->
def_b
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Symbol was defined here: "
);
vcc_ErrWhere
(
tl
,
sym
->
def_b
);
}
else
if
(
sym
->
ref_b
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Symbol was declared here: "
);
vcc_ErrWhere
(
tl
,
sym
->
ref_b
);
}
else
{
VSB_printf
(
tl
->
sb
,
"Symbol was builtin
\n
"
);
}
return
(
NULL
);
}
vcc_symxref
(
sym
,
x
,
t
);
return
(
sym
);
}
struct
symbol
*
VCC_SymbolGet
(
struct
vcc
*
tl
,
vcc_kind_t
kind
,
const
char
*
e
,
const
char
*
x
)
{
...
...
lib/libvcc/vcc_vmod.c
View file @
192bfb64
...
...
@@ -232,16 +232,17 @@ vcc_ParseImport(struct vcc *tl)
ExpectErr
(
tl
,
ID
);
/* "vmod_name" */
mod
=
tl
->
t
;
vcc_NextToken
(
tl
);
if
(
tl
->
t
->
tok
==
ID
&&
vcc_IdIs
(
tl
->
t
,
"as"
))
{
SkipToken
(
tl
,
ID
);
/* "as" */
tmod
=
VTAILQ_NEXT
(
mod
,
list
);
if
(
tmod
->
tok
==
ID
&&
vcc_IdIs
(
tmod
,
"as"
))
{
vcc_NextToken
(
tl
);
/* "vmod_name" */
vcc_NextToken
(
tl
);
/* "as" */
ExpectErr
(
tl
,
ID
);
/* "vcl_name" */
tmod
=
tl
->
t
;
vcc_NextToken
(
tl
);
}
else
{
tmod
=
mod
;
}
tmod
=
tl
->
t
;
msym
=
VCC_SymbolGet
(
tl
,
SYM_VMOD
,
SYMTAB_CREATE
,
XREF_NONE
);
ERRCHK
(
tl
);
AN
(
msym
);
if
(
tl
->
t
->
tok
==
ID
)
{
if
(
!
vcc_IdIs
(
tl
->
t
,
"from"
))
{
...
...
@@ -293,33 +294,19 @@ vcc_ParseImport(struct vcc *tl)
return
;
}
msym
=
VCC_SymbolGetTok
(
tl
,
SYM_NONE
,
SYMTAB_NOERR
,
XREF_NONE
,
tmod
);
if
(
msym
!=
NULL
&&
msym
->
kind
==
SYM_VMOD
&&
!
strcmp
(
msym
->
extra
,
vmd
->
file_id
))
{
/* Identical import is OK */
AZ
(
dlclose
(
vop
->
hdl
));
free
(
fnpx
);
return
;
}
else
if
(
msym
!=
NULL
&&
msym
->
kind
==
SYM_VMOD
)
{
VSB_printf
(
tl
->
sb
,
"Another module already imported as %.*s.
\n
"
,
PF
(
tmod
));
vcc_ErrWhere2
(
tl
,
t1
,
tl
->
t
);
AZ
(
dlclose
(
vop
->
hdl
));
free
(
fnpx
);
return
;
}
else
if
(
msym
!=
NULL
)
{
VSB_printf
(
tl
->
sb
,
"Module %.*s conflicts with other symbol.
\n
"
,
PF
(
tmod
));
vcc_ErrWhere2
(
tl
,
t1
,
tl
->
t
);
if
(
msym
->
extra
!=
NULL
)
{
if
(
!
strcmp
(
msym
->
extra
,
vmd
->
file_id
))
{
/* Identical import is OK */
}
else
{
VSB_printf
(
tl
->
sb
,
"Another module already imported as %.*s.
\n
"
,
PF
(
tmod
));
vcc_ErrWhere2
(
tl
,
t1
,
tl
->
t
);
}
AZ
(
dlclose
(
vop
->
hdl
));
free
(
fnpx
);
return
;
}
msym
=
VCC_SymbolGetTok
(
tl
,
SYM_VMOD
,
SYMTAB_CREATE
,
XREF_NONE
,
tmod
);
ERRCHK
(
tl
);
AN
(
msym
);
msym
->
def_b
=
t1
;
msym
->
def_e
=
tl
->
t
;
...
...
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