Michael Widenius <monty@askmonty.org> writes:
knielsen> === modified file 'configure.in' knielsen> --- a/configure.in 2009-04-23 13:06:16 +0000 knielsen> +++ b/configure.in 2009-06-10 09:13:53 +0000
knielsen> @@ -1739,28 +1763,9 @@ case "$with_atomic_ops" in knielsen> [Use pthread rwlocks for atomic ops]) ;; knielsen> "smp") ;; knielsen> "") knielsen> - AC_CACHE_CHECK([whether the compiler provides atomic builtins], knielsen> - [mysql_cv_gcc_atomic_builtins], [AC_TRY_RUN([ knielsen> - int main() knielsen> - { knielsen> - int foo= -10; int bar= 10; knielsen> - if (!__sync_fetch_and_add(&foo, bar) || foo) knielsen> - return -1; knielsen> - bar= __sync_lock_test_and_set(&foo, bar); knielsen> - if (bar || foo != 10) knielsen> - return -1; knielsen> - bar= __sync_val_compare_and_swap(&bar, foo, 15); knielsen> - if (bar) knielsen> - return -1; knielsen> - return 0; knielsen> - } knielsen> - ], [mysql_cv_gcc_atomic_builtins=yes_but_disabled], knielsen> - [mysql_cv_gcc_atomic_builtins=no], knielsen> - [mysql_cv_gcc_atomic_builtins=no])]) knielsen> - knielsen> - if test "x$mysql_cv_gcc_atomic_builtins" = xyes; then knielsen> - AC_DEFINE(HAVE_GCC_ATOMIC_BUILTINS, 1, knielsen> - [Define to 1 if compiler provides atomic builtins.]) knielsen> + if test "x$mysql_cv_gcc_atomic_builtins" = xyes_but_disabled; then knielsen> + AC_DEFINE([MY_ATOMIC_MODE_GCC_BUILTINS], [1], knielsen> + [Use GCC atomic builtins for atomic ops])
Under which circumstances could the last 'if' be true? The new code don't seem to be able to set mysql_cv_gcc_atomic_builtins to yes_but_disabled which makes the last if always false and we never define MY_ATOMIC_MODE_GCC_BUILTINS as 1.
You are right that the if can never be true. However, this is unchanged behaviour from before the patch, check the line with [mysql_cv_gcc_atomic_builtins=yes_but_disabled] above. Serg changed the "yes" to "yes_but_disabled" some time ago in the Maria tree. This is a hack to disable the use of GCC intrinsics in my_atomic. Serg told me that the reason is that there were failures in the unit tests when using GCC intrinsics. I did try to run unit tests with this hack removed, but I was not able to repeat any failures. I do think we should remove the hack and instead fix the real issue, if it is still there. However, I wanted to keep this separate from the XtraDB merge, which is quite complicated enough without introducing additional unrelated issues. - Kristian.