Capture return value from __sync_add_and_fetch in the test
authorMagnus Ahltorp <map@kth.se>
Mon, 15 Oct 2012 16:16:53 +0000 (09:16 -0700)
committerLove Hornquist Astrand <lha@h5l.org>
Mon, 15 Oct 2012 16:18:34 +0000 (09:18 -0700)
__sync_add_and_fetch is treated as a built in function by the compiler if the return value is not used (as in the autoconf test), but it is treated as a regular function when the return value is used

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
configure.ac

index f88da7822a6c06655e35995d43363b5c80f16efd..1ea467a184d8746d49b5d0715a8f1e467fe7300c 100644 (file)
@@ -490,7 +490,7 @@ AC_CHECK_FUNCS([                            \
 
 AC_MSG_CHECKING([checking for __sync_add_and_fetch])
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>]],
-       [[unsigned int foo; __sync_add_and_fetch(&foo, 1);]])],
+       [[unsigned int foo, bar; bar = __sync_add_and_fetch(&foo, 1);]])],
        [ac_rk_have___sync_add_and_fetch=yes], [ac_rk_have___sync_add_and_fetch=no])
 if test "$ac_rk_have___sync_add_and_fetch" = "yes" ; then
        AC_DEFINE_UNQUOTED(HAVE___SYNC_ADD_AND_FETCH, 1, [have __sync_add_and_fetch])