Commit c548ef1b authored by vasil's avatar vasil

branches/zip:

Include ut0auxconf.h only if none of the macros it would define is defined.
The check when to include this header was outdated from the time when there
was only one macro involved.

Move the atomics checks that are in univ.i outside of
#if windows ... #else ... #endif
This simplifies the code and removes some duplicates like defining
HAVE_ATOMIC_BUILTINS if HAVE_WINDOWS_ATOMICS is defined in both branches.

Do not define the same macro HAVE_ATOMIC_PTHREAD_T for different events.
Instead define HAVE_IB_ATOMIC_PTHREAD_T_GCC and
HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS.
parent 7f153330
......@@ -78,17 +78,48 @@ the virtual method table (vtable) in GCC 3. */
# define ha_innobase ha_innodb
#endif /* MYSQL_DYNAMIC_PLUGIN */
/* if any of the following macros is defined at this point this means
that the code from the "right" plug.in was executed and we do not
need to include ut0auxconf.h which would either define the same macros
or will be empty */
#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
&& !defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \
&& !defined(HAVE_SOLARIS_ATOMICS) \
&& !defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \
&& !defined(SIZEOF_PTHREAD_T) \
&& !defined(IB_HAVE_PAUSE_INSTRUCTION)
# include "ut0auxconf.h"
#endif
#ifdef HAVE_WINDOWS_ATOMICS
/* windows thread objects can always be passed to windows atomic functions */
# define HAVE_IB_ATOMIC_PTHREAD_T_WINDOWS
#endif /* HAVE_WINDOWS_ATOMICS */
#if defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
|| defined(HAVE_SOLARIS_ATOMICS) \
|| defined(HAVE_WINDOWS_ATOMICS)
/* An auxiliary macro to know that some atomics are present and the
relevant os_*() macros will be defined and can be used */
# define HAVE_ATOMIC_BUILTINS
/* If pthread_t can be passed to any of the atomic functions then we know
that the appropriate macro os_compare_and_swap_thread_id() will be defined
and can be used */
# if defined(HAVE_IB_ATOMIC_PTHREAD_T_GCC) \
|| defined(HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS) \
|| defined(HAVE_IB_ATOMIC_PTHREAD_T_WINDOWS)
# define INNODB_RW_LOCKS_USE_ATOMICS
# endif
#endif /* HAVE_IB_GCC_ATOMIC_BUILTINS
|| HAVE_SOLARIS_ATOMICS
|| HAVE_WINDOWS_ATOMICS */
#if (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) && !defined(MYSQL_SERVER) && !defined(__WIN__)
# undef __WIN__
# define __WIN__
# include <windows.h>
# if defined(HAVE_WINDOWS_ATOMICS)
/* If atomics are defined we use them in InnoDB mutex implementation */
# define HAVE_ATOMIC_BUILTINS
# endif /* HAVE_WINDOWS_ATOMICS */
# ifdef _NT_
# define __NT__
# endif
......@@ -122,31 +153,6 @@ if we are compiling on Windows. */
# include <sched.h>
# endif
/* if any of the following macros is defined at this point this means
that the code from the "right" plug.in was executed and we do not
need to include ut0auxconf.h which would either define the same macros
or will be empty */
#if !defined(HAVE_IB_GCC_ATOMIC_BUILTINS) \
&& !defined(HAVE_ATOMIC_PTHREAD_T) \
&& !defined(HAVE_SOLARIS_ATOMICS) \
&& !defined(SIZEOF_PTHREAD_T) \
&& !defined(IB_HAVE_PAUSE_INSTRUCTION)
# include "ut0auxconf.h"
#endif
# if defined(HAVE_IB_GCC_ATOMIC_BUILTINS) || defined(HAVE_SOLARIS_ATOMICS) \
|| defined(HAVE_WINDOWS_ATOMICS)
/* If atomics are defined we use them in InnoDB mutex implementation */
# define HAVE_ATOMIC_BUILTINS
# endif /* (HAVE_IB_GCC_ATOMIC_BUILTINS) || (HAVE_SOLARIS_ATOMICS)
|| (HAVE_WINDOWS_ATOMICS) */
#ifdef HAVE_ATOMIC_BUILTINS
# ifdef HAVE_ATOMIC_PTHREAD_T
# define INNODB_RW_LOCKS_USE_ATOMICS
# endif /* HAVE_ATOMIC_PTHREAD_T */
#endif /* HAVE_ATOMIC_BUILTINS */
/* We only try to do explicit inlining of functions with gcc and
Sun Studio */
......
......@@ -106,7 +106,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
)
AC_MSG_CHECKING(whether pthread_t can be used by GCC atomic builtins)
# either define HAVE_ATOMIC_PTHREAD_T or not
# either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
AC_TRY_RUN(
[
#include <pthread.h>
......@@ -127,7 +127,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
}
],
[
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_GCC], [1],
[pthread_t can be used by GCC atomic builtins])
AC_MSG_RESULT(yes)
],
......@@ -149,7 +149,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
)
AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
# either define HAVE_ATOMIC_PTHREAD_T or not
# either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not
AC_TRY_RUN(
[
#include <pthread.h>
......@@ -179,7 +179,7 @@ MYSQL_PLUGIN_ACTIONS(innobase, [
],
[
AC_DEFINE([HAVE_ATOMIC_PTHREAD_T], [1],
AC_DEFINE([HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS], [1],
[pthread_t can be used by solaris atomics])
AC_MSG_RESULT(yes)
],
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment