1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
--TEST--
FR #78270 (Usage of __vectorcall convention with FFI)
--SKIPIF--
<?php
require_once('skipif.inc');
if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
require_once('utils.inc');
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, ffi_get_php_dll_name());
} catch (FFI\ParserException $ex) {
die('skip __vectorcall not supported');
}
?>
--FILE--
<?php
$x86 = (PHP_INT_SIZE === 4);
$arglists = array(
'int, int, int, int, int, int, int' => true,
'double, int, int, int, int, int, int' => !$x86,
'int, double, int, int, int, int, int' => !$x86,
'int, int, double, int, int, int, int' => !$x86,
'int, int, int, double, int, int, int' => !$x86,
'int, int, int, int, double, int, int' => false,
'int, int, int, int, int, double, int' => false,
'int, int, int, int, int, int, double' => true,
);
foreach ($arglists as $arglist => $allowed) {
$signature = "__vectorcall void foobar($arglist);";
try {
$ffi = FFI::cdef($signature);
} catch (FFI\ParserException $ex) {
if ($allowed) {
echo "($arglist): unexpected ParserException\n";
}
} catch (FFI\Exception $ex) {
if (!$allowed) {
echo "($arglist): unexpected Exception\n";
}
}
}
?>
--EXPECT--
|