felipe                                   Tue, 15 Nov 2011 20:33:26 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=319271

Log:
- Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs)
  patch by: klightspeed at netspace dot net dot au

Bug: https://bugs.php.net/55874 (Open) GCC does not provide 
__sync_fetch_and_add on some archs
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/configure.in
    U   php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c
    U   php/php-src/branches/PHP_5_4/NEWS
    U   php/php-src/branches/PHP_5_4/configure.in
    U   php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c
    U   php/php-src/trunk/configure.in
    U   php/php-src/trunk/ext/standard/php_crypt_r.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-11-15 20:32:03 UTC (rev 319270)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-11-15 20:33:26 UTC (rev 319271)
@@ -3,6 +3,8 @@
 ?? ??? 2011, PHP 5.3.9

 - Core:
+  . Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs).
+    (klightspeed at netspace dot net dot au)
   . Fixed bug #52624 (tempnam() by-pass open_basedir with inexistent 
directory).
     (Felipe)


Modified: php/php-src/branches/PHP_5_3/configure.in
===================================================================
--- php/php-src/branches/PHP_5_3/configure.in   2011-11-15 20:32:03 UTC (rev 
319270)
+++ php/php-src/branches/PHP_5_3/configure.in   2011-11-15 20:33:26 UTC (rev 
319271)
@@ -661,6 +661,13 @@
   AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
 fi

+dnl Check for the __sync_fetch_and_add builtin
+AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
+[AC_TRY_LINK([],[int 
x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
+if test "$ac_cv_func_sync_fetch_and_add" = yes; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the 
__sync_fetch_and_add function])
+fi
+
 AC_REPLACE_FUNCS(strlcat strlcpy getopt)
 AC_FUNC_UTIME_NULL
 AC_FUNC_ALLOCA

Modified: php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c     2011-11-15 
20:32:03 UTC (rev 319270)
+++ php/php-src/branches/PHP_5_3/ext/standard/php_crypt_r.c     2011-11-15 
20:33:26 UTC (rev 319271)
@@ -94,8 +94,7 @@
        if (!initialized) {
 #ifdef PHP_WIN32
                InterlockedIncrement(&initialized);
-#elif (defined(__GNUC__) && !defined(__hpux) && !defined(__hppa__) && 
(__GNUC__ > 4 || \
-    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && 
__GNUC_PATCHLEVEL__ > 1)))))
+#elif defined(HAVE_SYNC_FETCH_AND_ADD)
                __sync_fetch_and_add(&initialized, 1);
 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
                membar_producer();

Modified: php/php-src/branches/PHP_5_4/NEWS
===================================================================
--- php/php-src/branches/PHP_5_4/NEWS   2011-11-15 20:32:03 UTC (rev 319270)
+++ php/php-src/branches/PHP_5_4/NEWS   2011-11-15 20:33:26 UTC (rev 319271)
@@ -5,6 +5,8 @@
 - Core:
   . Fixed bug #60227 (header() cannot detect the multi-line header with
      CR(0x0D)). (rui)
+  . Fixed bug #55874 (GCC does not provide __sync_fetch_and_add on some archs).
+    (klightspeed at netspace dot net dot au)
   . Fixed bug #52624 (tempnam() by-pass open_basedir with inexistent 
directory).
     (Felipe)


Modified: php/php-src/branches/PHP_5_4/configure.in
===================================================================
--- php/php-src/branches/PHP_5_4/configure.in   2011-11-15 20:32:03 UTC (rev 
319270)
+++ php/php-src/branches/PHP_5_4/configure.in   2011-11-15 20:33:26 UTC (rev 
319271)
@@ -737,6 +737,13 @@
   AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
 fi

+dnl Check for the __sync_fetch_and_add builtin
+AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
+[AC_TRY_LINK([],[int 
x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
+if test "$ac_cv_func_sync_fetch_and_add" = yes; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the 
__sync_fetch_and_add function])
+fi
+
 AC_REPLACE_FUNCS(strlcat strlcpy getopt)
 AC_FUNC_UTIME_NULL
 AC_FUNC_ALLOCA

Modified: php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c     2011-11-15 
20:32:03 UTC (rev 319270)
+++ php/php-src/branches/PHP_5_4/ext/standard/php_crypt_r.c     2011-11-15 
20:33:26 UTC (rev 319271)
@@ -94,8 +94,7 @@
        if (!initialized) {
 #ifdef PHP_WIN32
                InterlockedIncrement(&initialized);
-#elif (defined(__GNUC__) && !defined(__hpux) && !defined(__hppa__) && 
(__GNUC__ > 4 || \
-    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && 
__GNUC_PATCHLEVEL__ > 1)))))
+#elif defined(HAVE_SYNC_FETCH_AND_ADD)
                __sync_fetch_and_add(&initialized, 1);
 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
                membar_producer();

Modified: php/php-src/trunk/configure.in
===================================================================
--- php/php-src/trunk/configure.in      2011-11-15 20:32:03 UTC (rev 319270)
+++ php/php-src/trunk/configure.in      2011-11-15 20:33:26 UTC (rev 319271)
@@ -737,6 +737,13 @@
   AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo function])
 fi

+dnl Check for the __sync_fetch_and_add builtin
+AC_CACHE_CHECK([for __sync_fetch_and_add], ac_cv_func_sync_fetch_and_add,
+[AC_TRY_LINK([],[int 
x;__sync_fetch_and_add(&x,1);],ac_cv_func_sync_fetch_and_add=yes,ac_cv_func_sync_fetch_and_add=no)])
+if test "$ac_cv_func_sync_fetch_and_add" = yes; then
+  AC_DEFINE(HAVE_SYNC_FETCH_AND_ADD,1,[Define if you have the 
__sync_fetch_and_add function])
+fi
+
 AC_REPLACE_FUNCS(strlcat strlcpy getopt)
 AC_FUNC_UTIME_NULL
 AC_FUNC_ALLOCA

Modified: php/php-src/trunk/ext/standard/php_crypt_r.c
===================================================================
--- php/php-src/trunk/ext/standard/php_crypt_r.c        2011-11-15 20:32:03 UTC 
(rev 319270)
+++ php/php-src/trunk/ext/standard/php_crypt_r.c        2011-11-15 20:33:26 UTC 
(rev 319271)
@@ -94,8 +94,7 @@
        if (!initialized) {
 #ifdef PHP_WIN32
                InterlockedIncrement(&initialized);
-#elif (defined(__GNUC__) && !defined(__hpux) && !defined(__hppa__) && 
(__GNUC__ > 4 || \
-    (__GNUC__ == 4 && (__GNUC_MINOR__ > 1 || (__GNUC_MINOR__ == 1 && 
__GNUC_PATCHLEVEL__ > 1)))))
+#elif defined(HAVE_SYNC_FETCH_AND_ADD)
                __sync_fetch_and_add(&initialized, 1);
 #elif defined(HAVE_ATOMIC_H) /* Solaris 10 defines atomic API within */
                membar_producer();

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to