From: Sascha Schumann Date: Thu, 28 Aug 2003 14:53:02 +0000 (+0000) Subject: cleanup & centralize ZEND_GCC_VERSION and ZEND_ATTRIBUTE_MALLOC so that X-Git-Tag: RELEASE_0_7~422 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=169d43e5fa3744e4c9ddd851e6b0f3c7773b65c4;p=php cleanup & centralize ZEND_GCC_VERSION and ZEND_ATTRIBUTE_MALLOC so that they can be used by downstream applications --- diff --git a/Zend/zend.h b/Zend/zend.h index 65dc1ee885..fea87092f3 100644 --- a/Zend/zend.h +++ b/Zend/zend.h @@ -146,6 +146,18 @@ char *alloca (); # endif #endif +#ifdef __GNUC__ +# define ZEND_GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__) +#else +# define ZEND_GCC_VERSION +#endif + +#if ZEND_GCC_VERSION >= 2096 +# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +#else +# define ZEND_ATTRIBUTE_MALLOC +#endif + #if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) # define do_alloca(p) alloca(p) # define free_alloca(p) diff --git a/Zend/zend_alloc.h b/Zend/zend_alloc.h index 15920bb495..57124322f8 100644 --- a/Zend/zend_alloc.h +++ b/Zend/zend_alloc.h @@ -64,18 +64,12 @@ typedef union _align_test { #define MAX_CACHED_ENTRIES 256 #define PRE_INIT_CACHE_ENTRIES 32 -#if __GNUC__ -0 >= 2 +#if ZEND_GCC_VERSION >= 2000 # define PLATFORM_ALIGNMENT (__alignof__ (align_test)) #else # define PLATFORM_ALIGNMENT (sizeof(align_test)) #endif -#if GCC_VERSION - 0 >= 2096 -# define ZEND_ATTRIBUTE_MALLOC __attribute__ ((malloc)) -#else -# define ZEND_ATTRIBUTE_MALLOC -#endif - #define MEM_HEADER_PADDING (((PLATFORM_ALIGNMENT-sizeof(zend_mem_header))%PLATFORM_ALIGNMENT+PLATFORM_ALIGNMENT)%PLATFORM_ALIGNMENT)