Skip to content

Commit fd7a8d1

Browse files
committed
Fix compile error in UT_COMPILER_BARRIER on Visual Studio compiler.
1 parent 9794cf2 commit fd7a8d1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

storage/innobase/include/ut0ut.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,13 @@ struct ut_when_dtor {
9797
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
9898
# endif
9999

100-
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
100+
#if defined (__GNUC__)
101+
# define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
102+
#elif defined (_MSC_VER)
103+
# define UT_COMPILER_BARRIER() MemoryBarrier()
104+
#else
105+
# define UT_COMPILER_BARRIER()
106+
#endif
101107

102108
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
103109
#include <sys/platform/ppc.h>

storage/xtradb/include/ut0ut.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ struct ut_when_dtor {
9494
# define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */
9595
# endif
9696

97-
#define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
97+
#if defined (__GNUC__)
98+
# define UT_COMPILER_BARRIER() __asm__ __volatile__ ("":::"memory")
99+
#elif defined (_MSC_VER)
100+
# define UT_COMPILER_BARRIER() MemoryBarrier()
101+
#else
102+
# define UT_COMPILER_BARRIER()
103+
#endif
98104

99105
# if defined(HAVE_HMT_PRIORITY_INSTRUCTION)
100106
#include <sys/platform/ppc.h>

0 commit comments

Comments
 (0)