[php-src] Issue #12123: Compile error on MacOS with C++ extension when using ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX
| From: | dktapps | Date: | Mon, 04 Sep 2023 18:36:47 +0000 |
| Subject: | [php-src] Issue #12123: Compile error on MacOS with C++ extension when using ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245325@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12123
Author: dktapps
### Description
https://github.com/pmmp/ext-morton/blob/2532e9f09d3bc6f6975d78b6632086b894dcef75/morton.cpp#L45
This code compiles fine with GCC on Ubuntu 20.04 on 8.3.0RC1, but fails on MacOS with clang with the
following errors:
```
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/ext/morton/morton.cpp:45:1:
error: expected '(' for function-style cast or type construction
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_morton2d_encode, 0, 2, IS_LONG, 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_API.h:202:2: note:
expanded from macro 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX'
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2(name, return_reference, required_num_args, type,
allow_null, 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_API.h:199:50: note:
expanded from macro 'ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX2'
{ (const char*)(uintptr_t)(required_num_args), ZEND_TYPE_INIT_CODE(type, allow_null,
_ZEND_ARG_INFO_FLAGS(return_reference, 0, is_tentative_return_type)), NULL },
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_types.h:287:2: note:
expanded from macro 'ZEND_TYPE_INIT_CODE'
ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ( (code) == IS_ITERABLE ?
_ZEND_TYPE_ITERABLE_BIT : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code))))) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_types.h:284:20: note:
expanded from macro 'ZEND_TYPE_INIT_MASK'
_ZEND_TYPE_PREFIX { NULL, (_type_mask) }
~~~~~~~~~~~~~~~~~ ^
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/ext/morton/morton.cpp:46:2:
error: expected '(' for function-style cast or type construction
ZEND_ARG_TYPE_INFO(0, x, IS_LONG, 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_API.h:135:11: note:
expanded from macro 'ZEND_ARG_TYPE_INFO'
{ #name, ZEND_TYPE_INIT_CODE(type_hint, allow_null, _ZEND_ARG_INFO_FLAGS(pass_by_ref, 0,
0)), NULL },
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_types.h:287:2: note:
expanded from macro 'ZEND_TYPE_INIT_CODE'
ZEND_TYPE_INIT_MASK(((code) == _IS_BOOL ? MAY_BE_BOOL : ( (code) == IS_ITERABLE ?
_ZEND_TYPE_ITERABLE_BIT : ((code) == IS_MIXED ? MAY_BE_ANY : (1 << (code))))) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/runner/work/PHP-Binaries/PHP-Binaries/install_data/subdir/php/Zend/zend_types.h:284:20: note:
expanded from macro 'ZEND_TYPE_INIT_MASK'
_ZEND_TYPE_PREFIX { NULL, (_type_mask) }
~~~~~~~~~~~~~~~~~ ^
```
I believe this problem was caused by a change in #11978.
### PHP Version
8.3.0RC1
### Operating System
MacOS 11 (GitHub Actions)