• Nils Goroll's avatar
    vcc: check for impossible subs at compile time · ae87e52f
    Nils Goroll authored
    We call those subs impossible which use a combination of variables not
    being available together from any of the built-in subroutines (aka
    methods), for example::
    
            sub foo {
                    set req.http.impossible = beresp.reason;
            }
    
    For this example, there is no built-in subroutine for which both req
    and beresp were available, so it can not possibly be valid in any
    context.
    
    As long as subs were actually called directly or indirectly from a
    built-in sub, VCC did already detect the problem. For the above
    example, if `sub vcl_recv { call foo; }` existed, VCC would complain
    about beresp.reason not being accessible from vcl_recv.
    
    Except, when vcc_err_unref was disabled, the example would pass
    without error, and likewise it will with calls which we are about to
    add.
    
    We now add a check to detect impossible subroutines. It happens in a
    second walk over the VCL's SUB symbols in order to keep the more
    precise error messages for calls rooting in one of the built-in subs.
    
    This change also changes the order of error reporting slightly and
    incorporates, indirectly, the vcc_CheckUses() check moved in
    ed36b638.
    
    v00020.vtc now has the "Impossible Subroutine with vcc_err_unref off"
    check, while the newly added m00053.vtc has been changed to test
    failure of the impossible sub at compile time rather than at runtime.
    
    This change was triggered by feedback from Dridi
    ae87e52f
Name
Last commit
Last update
.circleci Loading commit data...
.github Loading commit data...
bin Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
m4 Loading commit data...
man Loading commit data...
tools Loading commit data...
vmod Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
.lgtm.yml Loading commit data...
.syntastic_c_config Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
flint.lnt Loading commit data...
varnish-legacy.m4 Loading commit data...
varnish.m4 Loading commit data...
varnishapi-uninstalled.pc.in Loading commit data...
varnishapi.pc.in Loading commit data...
vtc.am Loading commit data...