浏览代码

Use __APPLE__ instead of OS_MACOS. The former is compiler-provided.

Use __APPLE__ instead of OS_MACOS when testing for the Apple platform and
remove the latter symbol from the BUILD file. This fixes incompatibility issues
when using the library on an Apple device.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=162958094
main
scrubbed 7 年前
committed by Victor Costan
父节点
当前提交
0b402e96a7
共有 3 个文件被更改,包括 7 次插入7 次删除
  1. +2
    -2
      build_detect_platform
  2. +2
    -2
      port/atomic_pointer.h
  3. +3
    -3
      port/port_posix.h

+ 2
- 2
build_detect_platform 查看文件

@ -82,7 +82,7 @@ case "$TARGET_OS" in
;;
Darwin)
PLATFORM=OS_MACOSX
COMMON_FLAGS="$MEMCMP_FLAG -DOS_MACOSX"
COMMON_FLAGS="$MEMCMP_FLAG"
PLATFORM_SHARED_EXT=dylib
[ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd`
PLATFORM_SHARED_LDFLAGS="-dynamiclib -install_name $INSTALL_PATH/"
@ -150,7 +150,7 @@ case "$TARGET_OS" in
;;
IOS)
PLATFORM=IOS
COMMON_FLAGS="$MEMCMP_FLAG -DOS_MACOSX"
COMMON_FLAGS="$MEMCMP_FLAG"
[ -z "$INSTALL_PATH" ] && INSTALL_PATH=`pwd`
PORT_FILE=port/port_posix.cc
PORT_SSE_FILE=port/port_posix_sse.cc

+ 2
- 2
port/atomic_pointer.h 查看文件

@ -25,7 +25,7 @@
#ifdef OS_WIN
#include <windows.h>
#endif
#ifdef OS_MACOSX
#ifdef __APPLE__
#include <libkern/OSAtomic.h>
#endif
@ -54,7 +54,7 @@ namespace port {
#define LEVELDB_HAVE_MEMORY_BARRIER
// Mac OS
#elif defined(OS_MACOSX)
#elif defined(__APPLE__)
inline void MemoryBarrier() {
OSMemoryBarrier();
}

+ 3
- 3
port/port_posix.h 查看文件

@ -8,7 +8,7 @@
#define STORAGE_LEVELDB_PORT_PORT_POSIX_H_
#undef PLATFORM_IS_LITTLE_ENDIAN
#if defined(OS_MACOSX)
#if defined(__APPLE__)
#include <machine/endian.h>
#if defined(__DARWIN_LITTLE_ENDIAN) && defined(__DARWIN_BYTE_ORDER)
#define PLATFORM_IS_LITTLE_ENDIAN \
@ -50,7 +50,7 @@
#define PLATFORM_IS_LITTLE_ENDIAN (__BYTE_ORDER == __LITTLE_ENDIAN)
#endif
#if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
#if defined(__APPLE__) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\
defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\
defined(OS_ANDROID) || defined(OS_HPUX) || defined(CYGWIN)
// Use fread/fwrite/fflush on platforms without _unlocked variants
@ -59,7 +59,7 @@
#define fflush_unlocked fflush
#endif
#if defined(OS_MACOSX) || defined(OS_FREEBSD) ||\
#if defined(__APPLE__) || defined(OS_FREEBSD) ||\
defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
// Use fsync() on platforms without fdatasync()
#define fdatasync fsync

正在加载...
取消
保存