From 3ee6a4b35fd54bdda84abb47ee5768c64b211100 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 8 Jun 2021 10:12:21 +0200 Subject: [PATCH] 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. --- Zend/zend_API.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 290db040b2f..0afb6cc65c7 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -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) || \