-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Avoid C99 typedef redeclaration error #15079
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
Changes from all commits
fd04377
8c52e7d
bb878f9
ca2061b
939b283
3516395
5d22529
aca2fe3
c332466
e44882e
13887bd
e94ce69
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,12 @@ | |
|
||
#include "zend_types.h" | ||
|
||
typedef struct _zval_struct zval; | ||
struct _zval_struct; | ||
|
||
zend_result zend_startup_builtin_functions(void); | ||
|
||
BEGIN_EXTERN_C() | ||
ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last, int options, int limit); | ||
ZEND_API void zend_fetch_debug_backtrace(struct _zval_struct *return_value, int skip_last, int options, int limit); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Usage of Note that duplicate declarations were introduced by previous "header clenup" patches (like 6335264). Now you remove them and make sources even worse... |
||
END_EXTERN_C() | ||
|
||
#endif /* ZEND_BUILTIN_FUNCTIONS_H */ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,19 +23,21 @@ | |
|
||
BEGIN_EXTERN_C() | ||
|
||
typedef struct _zend_array zend_array; | ||
typedef struct _zend_class_entry zend_class_entry; | ||
typedef struct _zend_object zend_object; | ||
typedef struct _zend_object_iterator zend_object_iterator; | ||
typedef struct _zval_struct zval; | ||
/* Intentionally avoid typedef because of C99 redeclaration errors. */ | ||
struct _zend_array; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seeing this, I already wondered before: Why is the struct tag even prefixed with an underscore instead of matching the typedef'd name exactly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is just an convention to avoid having identical names. And maybe also as a hint that clients should use the typedef'd name. |
||
struct _zend_class_entry; | ||
struct _zend_object; | ||
struct _zend_object_iterator; | ||
struct _zval_struct; | ||
|
||
typedef enum { | ||
ZEND_PROPERTY_HOOK_GET = 0, | ||
ZEND_PROPERTY_HOOK_SET = 1, | ||
} zend_property_hook_kind; | ||
|
||
ZEND_API zend_object_iterator *zend_hooked_object_get_iterator(zend_class_entry *ce, zval *object, int by_ref); | ||
ZEND_API zend_array *zend_hooked_object_build_properties(zend_object *zobj); | ||
ZEND_API struct _zend_object_iterator *zend_hooked_object_get_iterator( | ||
struct _zend_class_entry *ce, struct _zval_struct *object, int by_ref); | ||
ZEND_API struct _zend_array *zend_hooked_object_build_properties(struct _zend_object *zobj); | ||
|
||
END_EXTERN_C() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid question maybe, but why do we need this at all? The typedef is defined in zend_types.h which is included right above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this one is indeed probably unneeded.