Bug #68987 [Asn]: Failed to compile zend.c with gcc-4.9.2

From: Date: Fri, 06 Feb 2015 14:38:03 +0000
Subject: Bug #68987 [Asn]: Failed to compile zend.c with gcc-4.9.2
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190487@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68987&edit=1 ID: 68987 User updated by: 191919 at gmail dot com Reported by: 191919 at gmail dot com Summary: Failed to compile zend.c with gcc-4.9.2 Status: Assigned Type: Bug Package: Compile Failure Operating System: OS X PHP Version: master-Git-2015-02-05 (Git) Assigned To: dmitry Block user comment: N Private report: N New Comment: Confirmed working. clang 3.7 svn trunk and gcc-4.9.2 on OS X 10.10.2, both worked. Didn't try under other OS. Previous Comments: ------------------------------------------------------------------------ [2015-02-06 14:31:33] laruence@php.net should be fixed now. thanks for reporting ------------------------------------------------------------------------ [2015-02-06 09:41:55] laruence@php.net The following patch has been added/updated: Patch Name: bug68987.patch Revision: 1423215715 URL: https://bugs.php.net/patch-display.php?bug=68987&patch=bug68987.patch&revision=1423215715 ------------------------------------------------------------------------ [2015-02-06 02:42:13] 191919 at gmail dot com I submitted the form before finishing it. Continue: That's why in most cases under OS X where the compiler is clang-gcc (which has __has_attribute) or clang, the compilation will succeed, and if you have vanilla gcc, it will complain the duplicated definition of zend_error. ------------------------------------------------------------------------ [2015-02-06 02:39:17] 191919 at gmail dot com Perhaps because in OS X, the default compiler is clang or clang-gcc. In this case, gcc-4.9.2 is from my own compilation (you can see the ./configure statement in the original post). In zend_portability.h: #if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) || __has_attribute(noreturn) # define HAVE_NORETURN # define ZEND_NORETURN __attribute__((noreturn)) #elif defined(ZEND_WIN32) # define HAVE_NORETURN # define ZEND_NORETURN __declspec(noreturn) #else # define ZEND_NORETURN #endif 1. In OS X (with DARWIN defined) with clang which has __has_attribute(noreturn)'s value is true, HAVE_NORETURN is defined. 2. In OS X with gcc which does not have __has_attribute, HAVE_NORETURN is not defined. zend.h includes zend_portability.h, and in zend.h: #ifdef HAVE_NORETURN # if defined(ZEND_WIN32) ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...); # else void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN; # endif #else # define zend_error_noreturn zend_error #endif So we have zend_error_noreturn defined as zend_error. Finally in zend.c: #if (defined(__GNUC__) && __GNUC__ >= 3 && !defined(__INTEL_COMPILER) && !defined(DARWIN) && !defined(__hpux) && !defined(_AIX) && !defined(__osf__)) void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((alias("zend_error"),noreturn)); #elif defined(ZEND_WIN32) || defined(DARWIN) ZEND_API void zend_error(int type, const char *format, ...) /* {{{ */ { va_list va; va_start(va, format); zend_error_va_list(type, format, va); va_end(va); } ZEND_API ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) { va_list va; va_start(va, format); zend_error_va_list(type, format, va); va_end(va); } /* }}} */ #endif Because zend_error_noreturn has been defined to zend_error, there *IS* the duplicated definition. ------------------------------------------------------------------------ [2015-02-05 08:48:23] laruence@php.net interesting , but why no such error before... ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=68987 -- Edit this bug report at https://bugs.php.net/bug.php?id=68987&edit=1

« previous php.bugs (#190487) next »