Skip to content

Commit 3ee6a4b

Browse files
committed
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.
1 parent 1671996 commit 3ee6a4b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Zend/zend_API.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *
12821282
zval *_real_arg, *_arg = NULL; \
12831283
zend_expected_type _expected_type = Z_EXPECTED_LONG; \
12841284
char *_error = NULL; \
1285-
ZEND_ATTRIBUTE_UNUSED zend_bool _dummy; \
1285+
zend_bool _dummy = 0; \
12861286
zend_bool _optional = 0; \
12871287
int _error_code = ZPP_ERROR_OK; \
12881288
((void)_i); \
@@ -1291,6 +1291,7 @@ ZEND_API ZEND_COLD void zend_argument_value_error(uint32_t arg_num, const char *
12911291
((void)_expected_type); \
12921292
((void)_error); \
12931293
((void)_optional); \
1294+
((void)_dummy); \
12941295
\
12951296
do { \
12961297
if (UNEXPECTED(_num_args < _min_num_args) || \

0 commit comments

Comments
 (0)