Skip to content

-Wmissing-field-initializers C++ Warning for empty_fcall_info #19085

Closed
@KaseyJenkins

Description

@KaseyJenkins

Description

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.

PR - #19084

PHP Version

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions