RE: [PHP-DEV] zend.h breaks system headers on OSX in PHP 5.3
| From: | Dmitry Stogov | Date: | Wed, 07 Nov 2007 07:48:52 +0000 |
| Subject: | RE: [PHP-DEV] zend.h breaks system headers on OSX in PHP 5.3 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33045@lists.php.net to get a copy of this message | ||
May be it is better to just define always_inline as inline on OSX.
Something like:
#if defined(__GNUC__) && !defined(OSX)
...
Thanks. Dmitry.
> -----Original Message-----
> From: Wez Furlong [mailto:wez.furlong@messagesystems.com]
> Sent: Wednesday, November 07, 2007 7:43 AM
> To: internals@lists.php.net
> Subject: [PHP-DEV] zend.h breaks system headers on OSX in PHP 5.3
>
>
> The system headers on OSX use __attribute__((always_inline)) and
> zend.h defines always_inline to something else, breaking the build
> when the compiler tries to resolve that attribute name.
>
> A solution is to prefix the defines used in the engine with zend or
> ZEND or other similar namespacing token, which I thought was our
> standard practice, considering everything else in there has a prefix.
>
> If there have been other similar changes elsewhere, they should also
> be fixed
>
> --Wez.
>
> Index: zend.h
> ===================================================================
> RCS file: /repository/ZendEngine2/zend.h,v
> retrieving revision 1.293.2.11.2.9.2.9
> diff -u -p -r1.293.2.11.2.9.2.9 zend.h
> --- zend.h 2 Nov 2007 19:40:37 -0000 1.293.2.11.2.9.2.9
> +++ zend.h 7 Nov 2007 04:36:01 -0000
> @@ -324,42 +324,42 @@ struct _zval_struct {
> #define Z_SET_ISREF_TO(z, isref) Z_SET_ISREF_TO_P(&(z), isref)
>
> #if defined(__GNUC__)
> -#define always_inline inline __attribute__((always_inline))
> +#define zend_always_inline inline __attribute__((always_inline))
> #elif defined(_MSC_VER)
> -#define always_inline __forceinline
> +#define zend_always_inline __forceinline
> #else
> -#define always_inline inline
> +#define zend_always_inline inline
> #endif
>
> -static always_inline zend_uint zval_refcount_p(zval* pz) {
> +static zend_always_inline zend_uint zval_refcount_p(zval* pz) {
> return pz->refcount__gc;
> }
>
> -static always_inline zend_uint zval_set_refcount_p(zval* pz,
> zend_uint rc) {
> +static zend_always_inline zend_uint zval_set_refcount_p(zval* pz,
> zend_uint rc) {
> return pz->refcount__gc = rc;
> }
>
> -static always_inline zend_uint zval_addref_p(zval* pz) {
> +static zend_always_inline zend_uint zval_addref_p(zval* pz) {
> return ++pz->refcount__gc;
> }
>
> -static always_inline zend_uint zval_delref_p(zval* pz) {
> +static zend_always_inline zend_uint zval_delref_p(zval* pz) {
> return --pz->refcount__gc;
> }
>
> -static always_inline zend_bool zval_isref_p(zval* pz) {
> +static zend_always_inline zend_bool zval_isref_p(zval* pz) {
> return pz->is_ref__gc;
> }
>
> -static always_inline zend_bool zval_set_isref_p(zval* pz) {
> +static zend_always_inline zend_bool zval_set_isref_p(zval* pz) {
> return pz->is_ref__gc = 1;
> }
>
> -static always_inline zend_bool zval_unset_isref_p(zval* pz) {
> +static zend_always_inline zend_bool zval_unset_isref_p(zval* pz) {
> return pz->is_ref__gc = 0;
> }
>
> -static always_inline zend_bool zval_set_isref_to_p(zval* pz,
> zend_bool isref) {
> +static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz,
> zend_bool isref) {
> return pz->is_ref__gc = isref;
> }
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>