[php-src] Issue #19085: -Wmissing-field-initializers C++ Warning for empty_fcall_info

From: Date: Thu, 10 Jul 2025 07:16:16 +0000
Subject: [php-src] Issue #19085: -Wmissing-field-initializers C++ Warning for empty_fcall_info
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-250405@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/19085 Author: KaseyJenkins ### Description This [commit ](https://github.com/php/php-src/commit/16c4c066f4d395e4e7bcac4be94e40bbabe4ff9c)introduced the following change: ``` #ifndef __cplusplus # define empty_fcall_info (zend_fcall_info) {0} # define empty_fcall_info_cache (zend_fcall_info_cache) {0} #else # define empty_fcall_info zend_fcall_info {0} # define empty_fcall_info_cache zend_fcall_info_cache {0} #endif ``` When it comes to C++ it generates a -Wmissing-field-initializers [warning](https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wmissing-field-initializers), which is different to C, where this option does not warn about the universal zero initializer ‘{ 0 }’. To sort this issue out while still maintaining the expected (compiler) behaviour the empty { } initializer should be employed instead: ``` #ifndef __cplusplus # define empty_fcall_info (zend_fcall_info) {0} # define empty_fcall_info_cache (zend_fcall_info_cache) {0} #else # define empty_fcall_info zend_fcall_info {} # define empty_fcall_info_cache zend_fcall_info_cache {} #endif ``` This is particularly important since -Wmissing-field-initializers is included in -Wextra, which, coupled with -Werror precludes a successful C++ extension build. PR - https://github.com/php/php-src/pull/19084 ### PHP Version ```plain PHP 8.5.0alpha1 (cli) (built: Jul 4 2025 10:17:12) (NTS) Copyright (c) The PHP Group Zend Engine v4.5.0-dev, Copyright (c) Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#250405) next »