diff options
author | Dmitry Stogov <dmitry@zend.com> | 2019-05-14 00:21:00 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2019-05-14 00:21:00 +0300 |
commit | 9b18afcbca80e027859dab3b58f66dd901564be0 (patch) | |
tree | ea2e996887d1e1bd8fec7475de1e727bf0bdb7a0 | |
parent | da293a8ec41871ec890663593e320436becf2e7f (diff) | |
download | php-git-9b18afcbca80e027859dab3b58f66dd901564be0.tar.gz |
Fixed test on platforms that don't support fastcall calling convention
-rw-r--r-- | ext/ffi/tests/100.phpt | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/ffi/tests/100.phpt b/ext/ffi/tests/100.phpt index 7a3be47ec3..63fae8c215 100644 --- a/ext/ffi/tests/100.phpt +++ b/ext/ffi/tests/100.phpt @@ -13,14 +13,21 @@ try { ffi.enable=1 --FILE-- <?php +// Check if target supports "fastcall" calling convention +try { + FFI::cdef("extern size_t __attribute__((fastcall)) (*zend_printf)(const char *format);"); + $fastcall = "__attribute__((fastcall)) "; +} catch (Throwable $e) { + $fastcall = ""; +} $zend = FFI::cdef(" const char *get_zend_version(void); //char *get_zend_version(void); extern size_t (*zend_printf)(const char *format, ...); - unsigned long __attribute__((fastcall)) zend_hash_func(const char *str, size_t len); + unsigned long $fastcall zend_hash_func(const char *str, size_t len); - void __attribute__((fastcall)) zend_str_tolower(char *str, size_t length); + void $fastcall zend_str_tolower(char *str, size_t length); "); var_dump(trim(explode("\n",$zend->get_zend_version())[0])); |