com php-src: Fixed test on platforms that don't support fastcall calling convention: ext/ffi/tests/100.phpt
| From: | Dmitry Stogov | Date: | Mon, 13 May 2019 21:21:00 +0000 |
| Subject: | com php-src: Fixed test on platforms that don't support fastcall calling convention: ext/ffi/tests/100.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-106170@lists.php.net to get a copy of this message | ||
Commit: 9b18afcbca80e027859dab3b58f66dd901564be0
Author: Dmitry Stogov <dmitry@zend.com> Tue, 14 May 2019 00:21:00 +0300
Parents: da293a8ec41871ec890663593e320436becf2e7f
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9b18afcbca80e027859dab3b58f66dd901564be0
Log:
Fixed test on platforms that don't support fastcall calling convention
Changed paths:
M ext/ffi/tests/100.phpt
Diff:
diff --git a/ext/ffi/tests/100.phpt b/ext/ffi/tests/100.phpt
index 7a3be47..63fae8c 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]));