Implement #78270: Support __vectorcall convention with FFI

To work around the limitation of the current rudimentary vectorcall
support in our patched libffi, we forbid yet unsupported declarations,
i.e. float/double parameters at certain positions (SIMD vector types
and HVA types are not supported anyway).
This commit is contained in:
Christoph M. Becker 2019-10-14 14:56:37 +02:00
parent 53b1d76144
commit bedbecf56d
8 changed files with 349 additions and 209 deletions

1
NEWS
View File

@ -15,6 +15,7 @@ PHP NEWS
- FFI:
. Fixed bug #78716 (Function name mangling is wrong for some parameter
types). (cmb)
. Implement FR #78270 (Support __vectorcall convention with FFI). (cmb)
- FPM:
. Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).

View File

@ -12,6 +12,9 @@ if (PHP_FFI != 'no') {
AC_DEFINE('HAVE_FFI_MS_CDECL', 1 ,'libffi supports ms_cdecl calling convention');
AC_DEFINE('HAVE_FFI_SYSV', 1 ,'libffi supports sysv calling convention');
}
if (GREP_HEADER("ffitarget.h", "FFI_VECTORCALL_PARTIAL", PHP_PHP_BUILD + "\\include")) {
AC_DEFINE('HAVE_FFI_VECTORCALL_PARTIAL', 1 ,'libffi partially supports vectorcall calling convention');
}
EXTENSION('ffi', 'ffi.c ffi_parser.c', null, '/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
} else {

View File

@ -776,7 +776,7 @@ again:
}
/* }}} */
#if defined(ZEND_WIN32) && (defined(HAVE_FFI_FASTCALL) || defined(HAVE_FFI_STDCALL))
#if defined(ZEND_WIN32) && (defined(HAVE_FFI_FASTCALL) || defined(HAVE_FFI_STDCALL) || defined(HAVE_FFI_VECTORCALL_PARTIAL))
static size_t zend_ffi_arg_size(zend_ffi_type *type) /* {{{ */
{
zend_ffi_type *arg_type;
@ -801,6 +801,10 @@ static zend_always_inline zend_string *zend_ffi_mangled_func_name(zend_string *n
# ifdef HAVE_FFI_STDCALL
case FFI_STDCALL:
return strpprintf(0, "_%s@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
# endif
# ifdef HAVE_FFI_VECTORCALL_PARTIAL
case FFI_VECTORCALL_PARTIAL:
return strpprintf(0, "%s@@%zu", ZSTR_VAL(name), zend_ffi_arg_size(type));
# endif
}
#endif
@ -6008,6 +6012,29 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args, zend_ffi_dcl *n
}
}
#ifdef HAVE_FFI_VECTORCALL_PARTIAL
if (dcl->abi == ZEND_FFI_ABI_VECTORCALL && args) {
zend_ulong i;
zend_ffi_type *arg_type;
ZEND_HASH_FOREACH_NUM_KEY_PTR(args, i, arg_type) {
arg_type = ZEND_FFI_TYPE(arg_type);
# ifdef _WIN64
if (i >= 4 && i <= 5 && (arg_type->kind == ZEND_FFI_TYPE_FLOAT || arg_type->kind == ZEND_FFI_TYPE_DOUBLE)) {
# else
if (i < 6 && (arg_type->kind == ZEND_FFI_TYPE_FLOAT || arg_type->kind == ZEND_FFI_TYPE_DOUBLE)) {
# endif
zend_ffi_cleanup_dcl(nested_dcl);
zend_ffi_cleanup_dcl(dcl);
zend_hash_destroy(args);
pefree(args, FFI_G(persistent));
zend_ffi_parser_error("'float'/'double' type not allowed at position " ZEND_ULONG_FMT " with __vectorcall at line %d", i+1, FFI_G(line));
return;
}
} ZEND_HASH_FOREACH_END();
}
#endif
if (zend_ffi_validate_func_ret_type(ret_type) != SUCCESS) {
zend_ffi_cleanup_dcl(nested_dcl);
zend_ffi_cleanup_dcl(dcl);
@ -6063,6 +6090,11 @@ void zend_ffi_make_func_type(zend_ffi_dcl *dcl, HashTable *args, zend_ffi_dcl *n
case ZEND_FFI_ABI_SYSV:
type->func.abi = FFI_SYSV;
break;
#endif
#ifdef HAVE_FFI_VECTORCALL_PARTIAL
case ZEND_FFI_ABI_VECTORCALL:
type->func.abi = FFI_VECTORCALL_PARTIAL;
break;
#endif
default:
type->func.abi = FFI_DEFAULT_ABI;
@ -6316,6 +6348,7 @@ void zend_ffi_set_abi(zend_ffi_dcl *dcl, uint16_t abi) /* {{{ */
_(stdcall) \
_(ms_abi) \
_(sysv_abi) \
_(vectorcall) \
_(aligned) \
_(packed) \
_(ms_struct) \
@ -6381,6 +6414,9 @@ void zend_ffi_add_attribute(zend_ffi_dcl *dcl, const char *name, size_t name_len
case attr_sysv_abi:
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_SYSV);
break;
case attr_vectorcall:
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);
break;
case attr_aligned:
dcl->align = __BIGGEST_ALIGNMENT__;
break;

View File

@ -135,6 +135,8 @@ declaration_specifiers(zend_ffi_dcl *dcl):
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_FASTCALL);}
| "__thiscall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);}
| "__vectorcall"
{zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);}
| "_Alignas"
"("
( &type_name_start

View File

@ -60,85 +60,86 @@ static void yy_error_sym(const char *msg, int sym);
#define YY___STDCALL 17
#define YY___FASTCALL 18
#define YY___THISCALL 19
#define YY__ALIGNAS 20
#define YY_CONST 21
#define YY___CONST 22
#define YY___CONST__ 23
#define YY_RESTRICT 24
#define YY___RESTRICT 25
#define YY___RESTRICT__ 26
#define YY_VOLATILE 27
#define YY___VOLATILE 28
#define YY___VOLATILE__ 29
#define YY__ATOMIC 30
#define YY_VOID 31
#define YY_CHAR 32
#define YY_SHORT 33
#define YY_INT 34
#define YY_LONG 35
#define YY_FLOAT 36
#define YY_DOUBLE 37
#define YY_SIGNED 38
#define YY_UNSIGNED 39
#define YY__BOOL 40
#define YY__COMPLEX 41
#define YY_COMPLEX 42
#define YY___COMPLEX 43
#define YY___COMPLEX__ 44
#define YY_STRUCT 45
#define YY_UNION 46
#define YY__LBRACE 47
#define YY__RBRACE 48
#define YY__COLON 49
#define YY_ENUM 50
#define YY__EQUAL 51
#define YY__STAR 52
#define YY__LBRACK 53
#define YY__RBRACK 54
#define YY__POINT_POINT_POINT 55
#define YY___ATTRIBUTE 56
#define YY___ATTRIBUTE__ 57
#define YY___DECLSPEC 58
#define YY__POINT 59
#define YY__QUERY 60
#define YY__BAR_BAR 61
#define YY__AND_AND 62
#define YY__BAR 63
#define YY__UPARROW 64
#define YY__AND 65
#define YY__EQUAL_EQUAL 66
#define YY__BANG_EQUAL 67
#define YY__LESS 68
#define YY__GREATER 69
#define YY__LESS_EQUAL 70
#define YY__GREATER_EQUAL 71
#define YY__LESS_LESS 72
#define YY__GREATER_GREATER 73
#define YY__PLUS 74
#define YY__MINUS 75
#define YY__SLASH 76
#define YY__PERCENT 77
#define YY__MINUS_GREATER 78
#define YY__PLUS_PLUS 79
#define YY__MINUS_MINUS 80
#define YY__TILDE 81
#define YY__BANG 82
#define YY_SIZEOF 83
#define YY__ALIGNOF 84
#define YY___ALIGNOF 85
#define YY___ALIGNOF__ 86
#define YY___RESTICT 87
#define YY_ID 88
#define YY_OCTNUMBER 89
#define YY_DECNUMBER 90
#define YY_HEXNUMBER 91
#define YY_FLOATNUMBER 92
#define YY_STRING 93
#define YY_CHARACTER 94
#define YY_EOL 95
#define YY_WS 96
#define YY_ONE_LINE_COMMENT 97
#define YY_COMMENT 98
#define YY___VECTORCALL 20
#define YY__ALIGNAS 21
#define YY_CONST 22
#define YY___CONST 23
#define YY___CONST__ 24
#define YY_RESTRICT 25
#define YY___RESTRICT 26
#define YY___RESTRICT__ 27
#define YY_VOLATILE 28
#define YY___VOLATILE 29
#define YY___VOLATILE__ 30
#define YY__ATOMIC 31
#define YY_VOID 32
#define YY_CHAR 33
#define YY_SHORT 34
#define YY_INT 35
#define YY_LONG 36
#define YY_FLOAT 37
#define YY_DOUBLE 38
#define YY_SIGNED 39
#define YY_UNSIGNED 40
#define YY__BOOL 41
#define YY__COMPLEX 42
#define YY_COMPLEX 43
#define YY___COMPLEX 44
#define YY___COMPLEX__ 45
#define YY_STRUCT 46
#define YY_UNION 47
#define YY__LBRACE 48
#define YY__RBRACE 49
#define YY__COLON 50
#define YY_ENUM 51
#define YY__EQUAL 52
#define YY__STAR 53
#define YY__LBRACK 54
#define YY__RBRACK 55
#define YY__POINT_POINT_POINT 56
#define YY___ATTRIBUTE 57
#define YY___ATTRIBUTE__ 58
#define YY___DECLSPEC 59
#define YY__POINT 60
#define YY__QUERY 61
#define YY__BAR_BAR 62
#define YY__AND_AND 63
#define YY__BAR 64
#define YY__UPARROW 65
#define YY__AND 66
#define YY__EQUAL_EQUAL 67
#define YY__BANG_EQUAL 68
#define YY__LESS 69
#define YY__GREATER 70
#define YY__LESS_EQUAL 71
#define YY__GREATER_EQUAL 72
#define YY__LESS_LESS 73
#define YY__GREATER_GREATER 74
#define YY__PLUS 75
#define YY__MINUS 76
#define YY__SLASH 77
#define YY__PERCENT 78
#define YY__MINUS_GREATER 79
#define YY__PLUS_PLUS 80
#define YY__MINUS_MINUS 81
#define YY__TILDE 82
#define YY__BANG 83
#define YY_SIZEOF 84
#define YY__ALIGNOF 85
#define YY___ALIGNOF 86
#define YY___ALIGNOF__ 87
#define YY___RESTICT 88
#define YY_ID 89
#define YY_OCTNUMBER 90
#define YY_DECNUMBER 91
#define YY_HEXNUMBER 92
#define YY_FLOATNUMBER 93
#define YY_STRING 94
#define YY_CHARACTER 95
#define YY_EOL 96
#define YY_WS 97
#define YY_ONE_LINE_COMMENT 98
#define YY_COMMENT 99
static const char * sym_name[] = {
"<EOF>",
@ -161,6 +162,7 @@ static const char * sym_name[] = {
"__stdcall",
"__fastcall",
"__thiscall",
"__vectorcall",
"_Alignas",
"const",
"__const",
@ -349,7 +351,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___EXTENSION__;
goto _yy_state_381;
goto _yy_state_390;
case 'i':
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
@ -362,11 +364,11 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___INLINE; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___INLINE; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___INLINE__;
goto _yy_state_381;
goto _yy_state_390;
case 'c':
ch = *++YYPOS;
if (ch == 'd') {
@ -377,7 +379,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___CDECL;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'o') {
ch = *++YYPOS;
if (ch == 'm') {
@ -390,22 +392,22 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'x') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___COMPLEX; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___COMPLEX; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___COMPLEX__;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'n') {
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___CONST; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___CONST; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___CONST__;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -426,7 +428,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___STDCALL;
goto _yy_state_381;
goto _yy_state_390;
case 'f':
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
@ -443,7 +445,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___FASTCALL;
goto _yy_state_381;
goto _yy_state_390;
case 't':
ch = *++YYPOS;
if (ch != 'h') goto _yy_tunnel_9;
@ -460,7 +462,50 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___THISCALL;
goto _yy_state_381;
goto _yy_state_390;
case 'v':
ch = *++YYPOS;
if (ch == 'e') {
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'r') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY___VECTORCALL;
goto _yy_state_390;
} else if (ch == 'o') {
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___VOLATILE; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___VOLATILE__;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
case 'a':
ch = *++YYPOS;
if (ch == 'l') {
@ -475,11 +520,11 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___ALIGNOF; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ALIGNOF__;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 's') {
ch = *++YYPOS;
if (ch != 'm') goto _yy_tunnel_9;
@ -488,7 +533,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ASM__;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 't') {
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
@ -505,11 +550,11 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___ATTRIBUTE; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___ATTRIBUTE__;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -529,7 +574,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ret = YY___DECLSPEC;
goto _yy_state_381;
goto _yy_state_390;
case 'r':
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
@ -544,7 +589,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY___RESTICT;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'r') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
@ -553,35 +598,14 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___RESTRICT; goto _yy_tunnel_381;}
if (ch != '_') {ret = YY___RESTRICT; goto _yy_tunnel_390;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___RESTRICT__;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
case 'v':
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != '_') {ret = YY___VOLATILE; goto _yy_tunnel_381;}
ch = *++YYPOS;
if (ch != '_') goto _yy_tunnel_9;
ret = YY___VOLATILE__;
goto _yy_state_381;
default:
goto _yy_tunnel_9;
}
@ -601,7 +625,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
ret = YY__NORETURN;
goto _yy_state_381;
goto _yy_state_390;
case 'A':
ch = *++YYPOS;
if (ch == 'l') {
@ -616,12 +640,12 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ret = YY__ALIGNAS;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'o') {
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ret = YY__ALIGNOF;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -635,7 +659,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ret = YY__ATOMIC;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -647,7 +671,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
ret = YY__BOOL;
goto _yy_state_381;
goto _yy_state_390;
case 'C':
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
@ -662,7 +686,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'x') goto _yy_tunnel_9;
ret = YY__COMPLEX;
goto _yy_state_381;
goto _yy_state_390;
default:
goto _yy_tunnel_9;
}
@ -680,7 +704,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ret = YY_TYPEDEF;
goto _yy_state_381;
goto _yy_state_390;
case 'e':
ch = *++YYPOS;
if (ch == 'x') {
@ -693,14 +717,14 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
ret = YY_EXTERN;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'n') {
ch = *++YYPOS;
if (ch != 'u') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 'm') goto _yy_tunnel_9;
ret = YY_ENUM;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -716,7 +740,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'c') goto _yy_tunnel_9;
ret = YY_STATIC;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'r') {
ch = *++YYPOS;
if (ch != 'u') goto _yy_tunnel_9;
@ -725,7 +749,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY_STRUCT;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -737,7 +761,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY_SHORT;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'i') {
ch = *++YYPOS;
if (ch == 'g') {
@ -748,7 +772,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'd') goto _yy_tunnel_9;
ret = YY_SIGNED;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'z') {
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
@ -757,7 +781,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'f') goto _yy_tunnel_9;
ret = YY_SIZEOF;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -772,7 +796,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
ret = YY_AUTO;
goto _yy_state_381;
goto _yy_state_390;
case 'r':
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
@ -789,7 +813,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'r') goto _yy_tunnel_9;
ret = YY_REGISTER;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 's') {
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
@ -802,7 +826,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY_RESTRICT;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -818,10 +842,10 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ret = YY_INLINE;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 't') {
ret = YY_INT;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -886,7 +910,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'r') goto _yy_tunnel_9;
ret = YY_CHAR;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'o') {
ch = *++YYPOS;
if (ch == 'm') {
@ -899,14 +923,14 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'x') goto _yy_tunnel_9;
ret = YY_COMPLEX;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'n') {
ch = *++YYPOS;
if (ch != 's') goto _yy_tunnel_9;
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY_CONST;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -925,7 +949,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ret = YY_DOUBLE;
goto _yy_state_381;
goto _yy_state_390;
case 'f':
ch = *++YYPOS;
if (ch != 'l') goto _yy_tunnel_9;
@ -936,7 +960,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 't') goto _yy_tunnel_9;
ret = YY_FLOAT;
goto _yy_state_381;
goto _yy_state_390;
case 'l':
ch = *++YYPOS;
if (ch != 'o') goto _yy_tunnel_9;
@ -945,7 +969,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'g') goto _yy_tunnel_9;
ret = YY_LONG;
goto _yy_state_381;
goto _yy_state_390;
case 'u':
ch = *++YYPOS;
if (ch == 'n') {
@ -956,7 +980,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'n') goto _yy_tunnel_9;
ret = YY_UNION;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 's') {
ch = *++YYPOS;
if (ch != 'i') goto _yy_tunnel_9;
@ -969,7 +993,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'd') goto _yy_tunnel_9;
ret = YY_UNSIGNED;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -992,7 +1016,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'd') goto _yy_tunnel_9;
ret = YY_VOID;
goto _yy_state_381;
goto _yy_state_390;
} else if (ch == 'l') {
ch = *++YYPOS;
if (ch != 'a') goto _yy_tunnel_9;
@ -1005,7 +1029,7 @@ _yy_state_start:
ch = *++YYPOS;
if (ch != 'e') goto _yy_tunnel_9;
ret = YY_VOLATILE;
goto _yy_state_381;
goto _yy_state_390;
} else {
goto _yy_tunnel_9;
}
@ -1570,7 +1594,7 @@ _yy_state_156:
accept = YY_HEXNUMBER;
accept_pos = yy_pos;
if (ch == 'L') {
goto _yy_state_263;
goto _yy_state_265;
} else if (ch == 'U' || ch == 'u') {
YYPOS++;
ret = YY_HEXNUMBER;
@ -1588,7 +1612,7 @@ _yy_state_156:
ret = YY_HEXNUMBER;
goto _yy_fin;
} else if (ch == 'l') {
goto _yy_state_263;
goto _yy_state_265;
} else {
ret = YY_HEXNUMBER;
goto _yy_fin;
@ -1620,7 +1644,7 @@ _yy_state_163:
} else {
goto _yy_state_error;
}
_yy_state_263:
_yy_state_265:
ch = *++YYPOS;
if (ch == 'U' || ch == 'u') {
YYPOS++;
@ -1629,9 +1653,9 @@ _yy_state_263:
} else {
goto _yy_state_error;
}
_yy_state_381:
_yy_state_390:
ch = *++YYPOS;
_yy_tunnel_381:
_yy_tunnel_390:
if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z')) {
goto _yy_state_9;
} else {
@ -1988,7 +2012,7 @@ static int synpred_6(int sym) {
}
static int parse_declarations(int sym) {
while (YY_IN_SET(sym, (YY___EXTENSION__,YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\202\377\377\377\377\177\004\007\000\000\000\001\000")) {
while (YY_IN_SET(sym, (YY___EXTENSION__,YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\202\377\377\377\377\377\010\016\000\000\000\002\000")) {
zend_ffi_dcl common_dcl = ZEND_FFI_ATTR_INIT;
if (sym == YY___EXTENSION__) {
sym = get_sym();
@ -2097,17 +2121,21 @@ static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_THISCALL);
break;
case YY___VECTORCALL:
sym = get_sym();
zend_ffi_set_abi(dcl, ZEND_FFI_ABI_VECTORCALL);
break;
case YY__ALIGNAS:
sym = get_sym();
if (sym != YY__LPAREN) {
yy_error_sym("'(' expected, got", sym);
}
sym = get_sym();
if ((YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\340\377\377\177\004\007\000\000\000\001\000")) && synpred_1(sym)) {
if ((YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) && synpred_1(sym)) {
zend_ffi_dcl align_dcl = ZEND_FFI_ATTR_INIT;
sym = parse_type_name(sym, &align_dcl);
zend_ffi_align_as_type(dcl, &align_dcl);
} else if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
zend_ffi_val align_val;
sym = parse_constant_expression(sym, &align_val);
zend_ffi_align_as_val(dcl, &align_val);
@ -2159,7 +2187,7 @@ static int parse_declaration_specifiers(int sym, zend_ffi_dcl *dcl) {
default:
yy_error_sym("unexpected", sym);
}
} while ((YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\200\377\377\377\377\177\004\007\000\000\000\001\000")) && (sym != YY_ID || !(dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS)));
} while ((YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\200\377\377\377\377\377\010\016\000\000\000\002\000")) && (sym != YY_ID || !(dcl->flags & ZEND_FFI_DCL_TYPE_SPECIFIERS)));
return sym;
}
@ -2168,29 +2196,29 @@ static int parse_specifier_qualifier_list(int sym, zend_ffi_dcl *dcl) {
sym = get_sym();
}
do {
if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\200\377\177\004\000\000\000\000\001\000")) {
if (YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID), "\000\000\000\000\377\377\010\000\000\000\000\002\000")) {
sym = parse_type_specifier(sym, dcl);
} else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\340\177\000\000\000\000\000\000\000\000\000")) {
} else if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\300\377\000\000\000\000\000\000\000\000\000")) {
sym = parse_type_qualifier(sym, dcl);
} else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
sym = parse_attributes(sym, dcl);
} else {
yy_error_sym("unexpected", sym);
}
} while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\340\377\377\177\004\007\000\000\000\001\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)));
} while ((YY_IN_SET(sym, (YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\377\377\010\016\000\000\000\002\000")) && (sym != YY_ID || zend_ffi_is_typedef_name((const char*)yy_text, yy_pos - yy_text)));
return sym;
}
static int parse_type_qualifier_list(int sym, zend_ffi_dcl *dcl) {
do {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\340\177\000\000\000\000\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC), "\000\000\300\377\000\000\000\000\000\000\000\000\000")) {
sym = parse_type_qualifier(sym, dcl);
} else if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
sym = parse_attributes(sym, dcl);
} else {
yy_error_sym("unexpected", sym);
}
} while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\340\177\000\000\000\007\000\000\000\000\000"));
} while (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000"));
return sym;
}
@ -2344,7 +2372,7 @@ static int parse_struct_contents(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("'{' expected, got", sym);
}
sym = get_sym();
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\340\377\377\177\004\007\000\000\000\001\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
sym = parse_struct_declaration(sym, dcl);
while (1) {
save_pos = yy_pos;
@ -2362,7 +2390,7 @@ static int parse_struct_contents(int sym, zend_ffi_dcl *dcl) {
yy_error_sym("unexpected", sym2);
}
_yy_state_2_1:
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\340\377\377\177\004\007\000\000\000\001\000")) {
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
alt2 = 3;
goto _yy_state_2;
} else if (sym2 == YY__RBRACE) {
@ -2430,7 +2458,7 @@ static int parse_struct_declarator(int sym, zend_ffi_dcl *struct_dcl, zend_ffi_d
sym = parse_attributes(sym, field_dcl);
}
zend_ffi_add_bit_field(struct_dcl, name, name_len, field_dcl, &bits);
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\140\000\000\000\000\000\001\007\000\000\000\000\000")) {
} else if (YY_IN_SET(sym, (YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__COMMA,YY__SEMICOLON,YY__RBRACE), "\140\000\000\000\000\000\002\016\000\000\000\000\000")) {
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
sym = parse_attributes(sym, field_dcl);
}
@ -2472,7 +2500,7 @@ static int parse_enum_specifier(int sym, zend_ffi_dcl *dcl) {
if (sym == YY___ATTRIBUTE || sym == YY___ATTRIBUTE__ || sym == YY___DECLSPEC) {
sym = parse_attributes(sym, dcl);
}
} else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\371\377\377\377\377\177\067\007\000\000\000\001\000")) {
} else if (YY_IN_SET(sym, (YY_TYPEDEF,YY_EXTERN,YY_STATIC,YY_AUTO,YY_REGISTER,YY_INLINE,YY___INLINE,YY___INLINE__,YY__NORETURN,YY___CDECL,YY___STDCALL,YY___FASTCALL,YY___THISCALL,YY___VECTORCALL,YY__ALIGNAS,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY__STAR,YY__LPAREN,YY__SEMICOLON,YY__COLON,YY__LBRACK,YY__RBRACE,YY__COMMA,YY__RPAREN,YY_EOF), "\371\377\377\377\377\377\156\016\000\000\000\002\000")) {
zend_ffi_declare_tag(name, name_len, dcl, 1);
} else {
yy_error_sym("unexpected", sym);
@ -2499,45 +2527,45 @@ static int parse_enumerator_list(int sym, zend_ffi_dcl *enum_dcl) {
const unsigned char *save_pos;
const unsigned char *save_text;
int save_line;
int alt249;
int alt250;
int64_t min = 0, max = 0, last = -1;
sym = parse_enumerator(sym, enum_dcl, &min, &max, &last);
while (1) {
save_pos = yy_pos;
save_text = yy_text;
save_line = yy_line;
alt249 = -2;
alt250 = -2;
sym2 = sym;
if (sym2 == YY__COMMA) {
sym2 = get_sym();
goto _yy_state_249_1;
goto _yy_state_250_1;
} else if (sym2 == YY__RBRACE) {
alt249 = -1;
goto _yy_state_249;
alt250 = -1;
goto _yy_state_250;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_249_1:
_yy_state_250_1:
if (sym2 == YY_ID) {
alt249 = 250;
goto _yy_state_249;
alt250 = 251;
goto _yy_state_250;
} else if (sym2 == YY__RBRACE) {
alt249 = 252;
goto _yy_state_249;
alt250 = 253;
goto _yy_state_250;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_249:
_yy_state_250:
yy_pos = save_pos;
yy_text = save_text;
yy_line = save_line;
if (alt249 != 250) {
if (alt250 != 251) {
break;
}
sym = get_sym();
sym = parse_enumerator(sym, enum_dcl, &min, &max, &last);
}
if (alt249 == 252) {
if (alt250 == 253) {
sym = get_sym();
}
return sym;
@ -2647,7 +2675,7 @@ static int parse_pointer(int sym, zend_ffi_dcl *dcl) {
do {
sym = get_sym();
zend_ffi_make_pointer_type(dcl);
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\340\177\000\000\000\007\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
sym = parse_type_qualifier_list(sym, dcl);
}
} while (sym == YY__STAR);
@ -2676,13 +2704,13 @@ static int parse_array_or_function_declarators(int sym, zend_ffi_dcl *dcl, zend_
if (sym2 == YY_STATIC) {
alt100 = 101;
goto _yy_state_100;
} else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\340\177\000\000\000\007\000\000\000\000\000")) {
} else if (YY_IN_SET(sym2, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
alt100 = 104;
goto _yy_state_100;
} else if (sym2 == YY__STAR) {
sym2 = get_sym();
goto _yy_state_100_15;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
alt100 = 110;
goto _yy_state_100;
} else if (sym2 == YY__RBRACK) {
@ -2695,7 +2723,7 @@ _yy_state_100_15:
if (sym2 == YY__RBRACK) {
alt100 = 109;
goto _yy_state_100;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
alt100 = 110;
goto _yy_state_100;
} else {
@ -2707,7 +2735,7 @@ _yy_state_100:
yy_line = save_line;
if (alt100 == 101) {
sym = get_sym();
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\340\177\000\000\000\007\000\000\000\000\000")) {
if (YY_IN_SET(sym, (YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\000\000\300\377\000\000\000\016\000\000\000\000\000")) {
sym = parse_type_qualifier_list(sym, &dummy);
}
sym = parse_assignment_expression(sym, &len);
@ -2724,7 +2752,7 @@ _yy_state_100:
} else if (sym2 == YY__STAR) {
sym2 = get_sym();
goto _yy_state_104_2;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER), "\010\000\000\000\000\000\000\000\004\030\377\376\000")) {
alt104 = 108;
goto _yy_state_104;
} else if (sym2 == YY__RBRACK) {
@ -2737,7 +2765,7 @@ _yy_state_104_2:
if (sym2 == YY__RBRACK) {
alt104 = 107;
goto _yy_state_104;
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym2, (YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__STAR), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
alt104 = 108;
goto _yy_state_104;
} else {
@ -2783,8 +2811,8 @@ _yy_state_104:
zend_ffi_make_array_type(dcl, &len);
} else if (sym == YY__LPAREN) {
sym = get_sym();
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__POINT_POINT_POINT), "\002\000\340\377\377\177\204\007\000\000\000\001\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\340\377\377\177\004\007\000\000\000\001\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC,YY__POINT_POINT_POINT), "\002\000\300\377\377\377\010\017\000\000\000\002\000")) {
if (YY_IN_SET(sym, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
sym = parse_parameter_declaration(sym, &args);
while (1) {
save_pos = yy_pos;
@ -2802,7 +2830,7 @@ _yy_state_104:
yy_error_sym("unexpected", sym2);
}
_yy_state_114_1:
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\340\377\377\177\004\007\000\000\000\001\000")) {
if (YY_IN_SET(sym2, (YY___EXTENSION__,YY_VOID,YY_CHAR,YY_SHORT,YY_INT,YY_LONG,YY_FLOAT,YY_DOUBLE,YY_SIGNED,YY_UNSIGNED,YY__BOOL,YY__COMPLEX,YY_COMPLEX,YY___COMPLEX,YY___COMPLEX__,YY_STRUCT,YY_UNION,YY_ENUM,YY_ID,YY_CONST,YY___CONST,YY___CONST__,YY_RESTRICT,YY___RESTRICT,YY___RESTRICT__,YY_VOLATILE,YY___VOLATILE,YY___VOLATILE__,YY__ATOMIC,YY___ATTRIBUTE,YY___ATTRIBUTE__,YY___DECLSPEC), "\002\000\300\377\377\377\010\016\000\000\000\002\000")) {
alt114 = 115;
goto _yy_state_114;
} else if (sym2 == YY__POINT_POINT_POINT) {
@ -2972,13 +3000,13 @@ static int parse_initializer(int sym) {
const unsigned char *save_pos;
const unsigned char *save_text;
int save_line;
int alt342;
int alt343;
zend_ffi_val dummy;
if (sym != YY__EQUAL) {
yy_error_sym("'=' expected, got", sym);
}
sym = get_sym();
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
sym = parse_assignment_expression(sym, &dummy);
} else if (sym == YY__LBRACE) {
sym = get_sym();
@ -2990,32 +3018,32 @@ static int parse_initializer(int sym) {
save_pos = yy_pos;
save_text = yy_text;
save_line = yy_line;
alt342 = -2;
alt343 = -2;
sym2 = sym;
if (sym2 == YY__COMMA) {
sym2 = get_sym();
goto _yy_state_342_1;
goto _yy_state_343_1;
} else if (sym2 == YY__RBRACE) {
alt342 = 347;
goto _yy_state_342;
alt343 = 348;
goto _yy_state_343;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_342_1:
_yy_state_343_1:
if (sym2 == YY__LBRACK || sym2 == YY__POINT || sym2 == YY__EQUAL) {
alt342 = 343;
goto _yy_state_342;
alt343 = 344;
goto _yy_state_343;
} else if (sym2 == YY__RBRACE) {
alt342 = 346;
goto _yy_state_342;
alt343 = 347;
goto _yy_state_343;
} else {
yy_error_sym("unexpected", sym2);
}
_yy_state_342:
_yy_state_343:
yy_pos = save_pos;
yy_text = save_text;
yy_line = save_line;
if (alt342 != 343) {
if (alt343 != 344) {
break;
}
sym = get_sym();
@ -3024,7 +3052,7 @@ _yy_state_342:
}
sym = parse_initializer(sym);
}
if (alt342 == 346) {
if (alt343 == 347) {
sym = get_sym();
}
if (sym != YY__RBRACE) {
@ -3285,7 +3313,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
case YY_ID:
sym = parse_ID(sym, &name, &name_len);
zend_ffi_resolve_const(name, name_len, val);
while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\010\000\000\000\000\000\040\010\000\300\001\000\000")) {
while (YY_IN_SET(sym, (YY__LBRACK,YY__LPAREN,YY__POINT,YY__MINUS_GREATER,YY__PLUS_PLUS,YY__MINUS_MINUS), "\010\000\000\000\000\000\100\020\000\200\003\000\000")) {
switch (sym) {
case YY__LBRACK:
sym = get_sym();
@ -3297,7 +3325,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
break;
case YY__LPAREN:
sym = get_sym();
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
if (YY_IN_SET(sym, (YY__LPAREN,YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
sym = parse_expr_list(sym);
}
if (sym != YY__RPAREN) {
@ -3399,7 +3427,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
}
sym = get_sym();
zend_ffi_expr_sizeof_type(val, &dcl);
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
sym = parse_unary_expression(sym, val);
zend_ffi_expr_sizeof_val(val);
} else {
@ -3430,7 +3458,7 @@ static int parse_unary_expression(int sym, zend_ffi_val *val) {
}
sym = get_sym();
zend_ffi_expr_alignof_type(val, &dcl);
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\020\000\002\214\177\177\000")) {
} else if (YY_IN_SET(sym, (YY_ID,YY_OCTNUMBER,YY_DECNUMBER,YY_HEXNUMBER,YY_FLOATNUMBER,YY_STRING,YY_CHARACTER,YY__LPAREN,YY__PLUS_PLUS,YY__MINUS_MINUS,YY__AND,YY__STAR,YY__PLUS,YY__MINUS,YY__TILDE,YY__BANG,YY_SIZEOF,YY__ALIGNOF,YY___ALIGNOF,YY___ALIGNOF__), "\010\000\000\000\000\000\040\000\004\030\377\376\000")) {
sym = parse_unary_expression(sym, val);
zend_ffi_expr_alignof_val(val);
} else {

View File

@ -132,6 +132,7 @@ ZEND_EXTERN_MODULE_GLOBALS(ffi)
#define ZEND_FFI_ABI_REGISTER 6 // FFI_REGISTER
#define ZEND_FFI_ABI_MS 7 // FFI_MS_CDECL
#define ZEND_FFI_ABI_SYSV 8 // FFI_SYSV
#define ZEND_FFI_ABI_VECTORCALL 9 // FFI_VECTORCALL
#define ZEND_FFI_ATTR_CONST (1<<0)
#define ZEND_FFI_ATTR_INCOMPLETE_TAG (1<<1)

View File

@ -0,0 +1,26 @@
--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");
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
} catch (FFI\ParserException $ex) {
die('skip __vectorcall not supported');
}
?>
--FILE--
<?php
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
$ffi = FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
var_dump($ffi->zend_atoi("17.4", 4));
?>
--EXPECT--
int(17)

View File

@ -0,0 +1,43 @@
--TEST--
FR #78270 (Usage of __vectorcall convention with FFI)
--SKIPIF--
<?php
require_once('skipif.inc');
$dll = 'php7' . (PHP_ZTS ? 'ts' : '') . (PHP_DEBUG ? '_debug' : '') . '.dll';
try {
FFI::cdef(<<<EOC
__vectorcall int zend_atoi(const char *str, size_t str_len);
EOC, $dll);
} 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--