Commit ac82a96a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Also fix "$ABI vrt", and make sure it stays fixed.

parent fcb823b0
......@@ -69,8 +69,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so {
"Vmod_vmod_wrong_Func",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
0,
0
"0",
"0U"
]
]
}
......@@ -87,8 +87,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so {
"Vmod_vmod_wrong_Func",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
1,
0
"1U",
"0"
]
]
}
......@@ -108,8 +108,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so {
"Vmod_vmod_wrong_Func",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
15,
0
"15",
"0"
], [
"$FOOBAR"
]
......@@ -128,8 +128,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so {
"Vmod_vmod_wrong_Func",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
15,
0
"15",
"0"
]
]
}
......@@ -146,8 +146,8 @@ filewrite -a ${tmpdir}/libvmod_wrong.so {
"Vmod_vmod_wrong_Func",
"0000000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000000",
15,
0
"15",
"0"
], [
"$CPROTO"
], [
......
......@@ -131,6 +131,7 @@ vcc_ParseJSON(const struct vcc *tl, const char *jsn, struct vmod_import *vim)
{
const struct vjsn_val *vv, *vv2, *vv3;
const char *err;
char *p;
vim->vj = vjsn_parse(jsn, &err);
if (err != NULL)
......@@ -180,13 +181,15 @@ vcc_ParseJSON(const struct vcc *tl, const char *jsn, struct vmod_import *vim)
vv3 = VTAILQ_NEXT(vv3, list);
AN(vv3);
assert(vjsn_is_number(vv3));
vim->major = atoi(vv3->value);
assert(vjsn_is_string(vv3));
vim->major = strtoul(vv3->value, &p, 10);
assert(p == NULL || *p == '\0' || *p == 'U');
vv3 = VTAILQ_NEXT(vv3, list);
AN(vv3);
assert(vjsn_is_number(vv3));
vim->minor = atoi(vv3->value);
assert(vjsn_is_string(vv3));
vim->minor = strtoul(vv3->value, &p, 10);
assert(p == NULL || *p == '\0' || *p == 'U');
if (!vcc_IdIs(vim->t_mod, vim->name)) {
VSB_printf(tl->sb, "Wrong file for VMOD %.*s\n",
......
......@@ -1100,7 +1100,9 @@ class vcc():
yield i + " "
def json(self, fo, fnx):
fo.write('#define STRINGIFY(arg) #arg\n')
fo.write('#define STRINGIFY3(arg) #arg\n')
fo.write('#define STRINGIFY2(arg) STRINGIFY3(#arg)\n')
fo.write('#define STRINGIFY1(arg) STRINGIFY2(arg)\n')
fo.write("\nstatic const char Vmod_Json[] = {\n")
fo.write('\t"VMOD_JSON_SPEC\x02"\n')
......@@ -1114,8 +1116,8 @@ class vcc():
# Hand-munge the JSON to insert stuff only known by
# the C-compiler at compile-time.
fo.write(',"\n\t" \\"" VMOD_ABI_Version "\\", "\n')
fo.write('\t STRINGIFY(%s) ", "\n' % self.vrt_major)
fo.write('\t STRINGIFY(%s)\n' % self.vrt_minor)
fo.write('\t STRINGIFY1(%s) ", "\n' % self.vrt_major)
fo.write('\t STRINGIFY1(%s)\n' % self.vrt_minor)
else:
fo.write('"\n')
fo.write('\t\"\\n\\x03\"\n};\n')
......
......@@ -27,8 +27,9 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# NB: We use this vmod to test "$ABI vrt" handling.
$ABI strict
$ABI vrt
$Prefix xyzzy
$Module debug 3 "Development, test and debug"
$Synopsis auto
......
......@@ -27,7 +27,8 @@
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
$ABI strict
# NB: Default to strict $ABI handling, so that path is tested in vmodtool.py
$Module vtc 3 "Utility module for varnishtest"
DESCRIPTION
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment