Edit report at http://bugs.php.net/bug.php?id=51183&edit=1
ID: 51183 Updated by: srina...@php.net Reported by: markus dot schiegl at lbbw dot de Summary: ext/date/php_date.c fails to compile with Sun Studio and PHP 5.2.13 -Status: Assigned +Status: Closed Type: Bug Package: Compile Failure Operating System: Solaris 10 (Sparc) PHP Version: 5.2.13 -Assigned To: derick +Assigned To: srinatar New Comment: Committed revision 300294. - Tested and verified it to compile on linux, mac and solaris. Previous Comments: ------------------------------------------------------------------------ [2010-05-31 17:50:24] srina...@php.net with sun studio 12 update, __inline is now recognized as synonymous for inline. this patch makes this code compilable on all platforms [sn123...@bflat]'php-5.3.2'>diff -u ext/date/php_date.c.ORIG ext/date/php_date.c--- ext/date/php_date.c.ORIG Mon May 31 08:38:45 2010 +++ ext/date/php_date.c Mon May 31 08:33:34 2010 @@ -36,7 +36,7 @@ #elif defined(__GNUC__) && __GNUC__ < 3 static __inline __int64_t php_date_llabs( __int64_t i ) { return i >= 0 ? i : -i; } #else -static __inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; } +static inline long long php_date_llabs( long long i ) { return i >= 0 ? i : -i; } #endif (C99 standard does support inline keyword) I can commit this bug, if no one has any objections to it. ------------------------------------------------------------------------ [2010-03-15 18:16:17] uklaus at hgb-leipzig dot de for the records, Sun Studio 11 compiler on Solaris 10 Sparc: doesn't compile Sun Studio 12 compiler on Solaris 10 Sparc: doesn't compile Sun Studio 12 Update 1 compiler on Solaris 10 Sparc: compiles ------------------------------------------------------------------------ [2010-03-10 11:02:49] jose-marcio dot martins at mines-paristech dot fr I submited this patch as it's simple and will work for every combination of OS and compiler. But the result is that php_date_llabs function isn't defined as inline. This may be an important performance issue only if this function is called very very frequently (I don't know if this hypothesis is true and I don't believe). The correct solution could be to redefine this with some other checks in order to use the correct inline declaration syntax. Another solution, as this is a really simple function is to declare it as a macro. Something of the kind : #define php_date_llabs(i) ((long long) ((i) >= 0 ? (i) : -(i)) ------------------------------------------------------------------------ [2010-03-08 20:26:07] rcshishe at cord dot edu This also affects Solaris 10 x86 with Sun Studio compiler. ------------------------------------------------------------------------ [2010-03-05 11:42:12] markus dot schiegl at lbbw dot de Jose Marcio, thanks for the patch. Compiles and works fine now! ------------------------------------------------------------------------ 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 http://bugs.php.net/bug.php?id=51183 -- Edit this bug report at http://bugs.php.net/bug.php?id=51183&edit=1