Skip to content

Fix empty_fcall_info C++ missing-field-initializers warning #19084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

KaseyJenkins
Copy link
Contributor

This commit 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, 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.

@KaseyJenkins KaseyJenkins requested a review from dstogov as a code owner July 10, 2025 07:02
@iluuu1994 iluuu1994 merged commit cea0918 into php:master Jul 10, 2025
9 checks passed
@iluuu1994
Copy link
Member

Thank you @KaseyJenkins!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants