bug78270_1.phpt 793 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. FR #78270 (Usage of __vectorcall convention with FFI)
  3. --EXTENSIONS--
  4. ffi
  5. zend_test
  6. --SKIPIF--
  7. <?php
  8. if (substr(PHP_OS, 0, 3) != 'WIN') die("skip this test is for Windows platforms only");
  9. require_once('utils.inc');
  10. ob_start();
  11. phpinfo(INFO_GENERAL);
  12. $info = ob_get_clean();
  13. if (preg_match('/Compiler => .*clang.*/', $info)) die("skip not for clang");
  14. try {
  15. FFI::cdef(<<<EOC
  16. __vectorcall int bug78270(const char *str, size_t str_len);
  17. EOC, "php_zend_test.dll");
  18. } catch (FFI\ParserException $ex) {
  19. die('skip __vectorcall not supported');
  20. }
  21. ?>
  22. --FILE--
  23. <?php
  24. require_once('utils.inc');
  25. $ffi = FFI::cdef(<<<EOC
  26. __vectorcall int bug78270(const char *str, size_t str_len);
  27. EOC, "php_zend_test.dll");
  28. var_dump($ffi->bug78270("17.4", 4));
  29. ?>
  30. --EXPECT--
  31. int(17)