From 0b69e50791cbb4fd7c9660aebc5f768d9255edb2 Mon Sep 17 00:00:00 2001 From: Gunnar Kudrjavets Date: Mon, 8 May 2017 16:04:19 -0700 Subject: [PATCH] Define CACHE_LINE_SIZE only when it's not defined Summary: RocksDB is compiled as part of MyRocks (MySQL storage engine) build. MySQL already defines `CACHE_LINE_SIZE` and therefore we're getting a conflict. Change RocksDB definition to be more cognizant of this. Closes https://github.com/facebook/rocksdb/pull/2257 Differential Revision: D5013188 Pulled By: gunnarku fbshipit-source-id: cfa76fe99f90dcd82aa09204e2f1f35e07a82b41 --- port/port_posix.h | 2 ++ port/win/port_win.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/port/port_posix.h b/port/port_posix.h index 80ed3ae9d..d7cd2659e 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -185,7 +185,9 @@ typedef pthread_once_t OnceType; #define LEVELDB_ONCE_INIT PTHREAD_ONCE_INIT extern void InitOnce(OnceType* once, void (*initializer)()); +#ifndef CACHE_LINE_SIZE #define CACHE_LINE_SIZE 64U +#endif #define PREFETCH(addr, rw, locality) __builtin_prefetch(addr, rw, locality) diff --git a/port/win/port_win.h b/port/win/port_win.h index 393a90145..e72a208ac 100644 --- a/port/win/port_win.h +++ b/port/win/port_win.h @@ -237,7 +237,9 @@ struct OnceType { #define LEVELDB_ONCE_INIT port::OnceType::Init() extern void InitOnce(OnceType* once, void (*initializer)()); +#ifndef CACHE_LINE_SIZE #define CACHE_LINE_SIZE 64U +#endif static inline void AsmVolatilePause() { #if defined(_M_IX86) || defined(_M_X64)