Avoid MSVC unused variable warning in FastZPP

MSVC doesn't support __attribute__((unused)), so this can cause
a lot of warnings for extensions. Use the (void) trick instead.
However, this requires us to initialize the variable as well,
to ensure that ubsan does not read a trap representation.
This commit is contained in:
Nikita Popov 2021-06-08 10:12:21 +02:00
parent 1671996ed7
commit 3ee6a4b35f

View file

@ -1282,7 +1282,7 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *
zval *_real_arg, *_arg = NULL; \
zend_expected_type _expected_type = Z_EXPECTED_LONG; \
char *_error = NULL; \
ZEND_ATTRIBUTE_UNUSED zend_bool _dummy; \
zend_bool _dummy = 0; \
zend_bool _optional = 0; \
int _error_code = ZPP_ERROR_OK; \
((void)_i); \
@ -1291,6 +1291,7 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *
((void)_expected_type); \
((void)_error); \
((void)_optional); \
((void)_dummy); \
\
do { \
if (UNEXPECTED(_num_args < _min_num_args) || \