-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Zend/zend_types.h: deprecate zend_bool, zend_intptr_t, zend_uintptr_t #10597
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
Conversation
@@ -47,7 +47,6 @@ | |||
# define ZEND_ENDIAN_LOHI_C_4(a, b, c, d) a, b, c, d | |||
#endif | |||
|
|||
typedef bool zend_bool; | |||
typedef unsigned char zend_uchar; |
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.
should be probably deprecated as well
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.
I understand zend_bool
, zend_*inptr_t
were definitions from a time when C99 wasn't required; but unsigned char
has always been available, everywhere. Therefore I figured this is not a compatibility definition, but .... I don't know. This doesn't make any sense to me, but I suggested deprecating only those I understood.
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.
Apparently, zend_uchar
isn't used as an unsigned char ("char" as in "ASCII character" - the C nomenclature is confusing), but as small unsigned integer. This is confusing. I'd recommend using uint_least8_t
everywhere instead, to clearly indicate that this is about small integers and not ASCII characters.
@@ -434,4 +434,10 @@ END_EXTERN_C() | |||
|
|||
#include "php_reentrancy.h" | |||
|
|||
/* the following typedefs are deprecated; use the standard C99 types | |||
* instead */ | |||
typedef bool zend_bool; |
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.
if used, they should emit a compiler warning, also I would add something like "and will be removed in PHP 9.0"
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.
I've added ZEND_ATTRIBUTE_DEPRECATED
, but there appears to be no way to attach a message to this GCC attribute.
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.
GCC should warn implicitly when -Wno-deprecated-declarations
is not passed
php-src CI should not pass if any GCC warning is produced
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.
Yes, but I thought you meant that GCC should write "will be removed in 9" in the message. In C++, the deprecated
attribute can be annotated with a message that is printed (https://en.cppreference.com/w/cpp/language/attributes/deprecated), but not the proprietary GCC attribute.
Will add the 9.0 comment.
034cb2e
to
3544ec4
Compare
These types are standard C99. For compatibility with out-of-tree extensions, keep the typedefs in main/php.h.
3544ec4
to
61e87ca
Compare
AppVeyor failure because |
https://stackoverflow.com/questions/4995868/deprecate-typedef |
Oh hooray, GCC wants the attribute at the end after the name, and MSVC wants it between |
…php#10597) These types are standard C99. For compatibility with out-of-tree extensions, keep the typedefs in main/php.h.
These types are standard C99. For compatibility with out-of-tree extensions, keep the typedefs in main/php.h.