]> git.saurik.com Git - wxWidgets.git/commitdiff
check that the version of __sync_sub_and_fetch that returns a value is supported...
authorVáclav Slavík <vslavik@fastmail.fm>
Wed, 5 Dec 2007 10:51:28 +0000 (10:51 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Wed, 5 Dec 2007 10:51:28 +0000 (10:51 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50480 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

build/aclocal/atomic_builtins.m4
configure

index bf2bcd17e3c8e850cee1cdc6500d1169351083b2..8366eb3ef4b2d6542c8b19cdfc34673bb567ce98 100644 (file)
@@ -6,14 +6,17 @@ AC_DEFUN([WX_ATOMIC_BUILTINS],
 [
   AC_REQUIRE([AC_PROG_CC])
   if test -n "$GCC"; then
 [
   AC_REQUIRE([AC_PROG_CC])
   if test -n "$GCC"; then
-    AC_MSG_CHECKING([for __sync_fetch_* builtins])
+    AC_MSG_CHECKING([for __sync_fetch_and_add and __sync_sub_and_fetch builtins])
     AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [
       AC_TRY_LINK(
         [],
         [
           unsigned int value=0;
     AC_CACHE_VAL(wx_cv_cc_gcc_atomic_builtins, [
       AC_TRY_LINK(
         [],
         [
           unsigned int value=0;
-          __sync_fetch_and_add(&value, 1);
+          /* wxAtomicInc doesn't use return value here */
+          __sync_fetch_and_add(&value, 2);
           __sync_sub_and_fetch(&value, 1);
           __sync_sub_and_fetch(&value, 1);
+          /* but wxAtomicDec does, so mimic that: */
+          unsigned int r2 = __sync_sub_and_fetch(&value, 1);
         ],
         wx_cv_cc_gcc_atomic_builtins=yes,
         wx_cv_cc_gcc_atomic_builtins=no)
         ],
         wx_cv_cc_gcc_atomic_builtins=yes,
         wx_cv_cc_gcc_atomic_builtins=no)
index 56ccf8490410a8f0acdf33ccb1e2b94fe9167378..9ef0e3dfba5d2fccd9ddca0051cacb663ff342bb 100755 (executable)
--- a/configure
+++ b/configure
@@ -24772,8 +24772,8 @@ fi
 
 
   if test -n "$GCC"; then
 
 
   if test -n "$GCC"; then
-    { echo "$as_me:$LINENO: checking for __sync_fetch_* builtins" >&5
-echo $ECHO_N "checking for __sync_fetch_* builtins... $ECHO_C" >&6; }
+    { echo "$as_me:$LINENO: checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins" >&5
+echo $ECHO_N "checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... $ECHO_C" >&6; }
     if test "${wx_cv_cc_gcc_atomic_builtins+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
     if test "${wx_cv_cc_gcc_atomic_builtins+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -24790,8 +24790,11 @@ main ()
 {
 
           unsigned int value=0;
 {
 
           unsigned int value=0;
-          __sync_fetch_and_add(&value, 1);
+          /* wxAtomicInc doesn't use return value here */
+          __sync_fetch_and_add(&value, 2);
           __sync_sub_and_fetch(&value, 1);
           __sync_sub_and_fetch(&value, 1);
+          /* but wxAtomicDec does, so mimic that: */
+          unsigned int r2 = __sync_sub_and_fetch(&value, 1);
 
   ;
   return 0;
 
   ;
   return 0;