Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from <cstdatomic> to <atomic> #194

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build_detect_platform
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,11 @@ if [ "$CROSS_COMPILE" = "true" ]; then
else
# If -std=c++0x works, use <cstdatomic>. Otherwise use port_posix.h.
$CXX $CFLAGS -std=c++0x -x c++ - -o /dev/null 2>/dev/null <<EOF
#include <cstdatomic>
#include <atomic>
int main() {}
EOF
if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_CSTDATOMIC_PRESENT"
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX -DLEVELDB_ATOMIC_PRESENT"
PLATFORM_CXXFLAGS="-std=c++0x"
else
COMMON_FLAGS="$COMMON_FLAGS -DLEVELDB_PLATFORM_POSIX"
Expand Down
11 changes: 5 additions & 6 deletions port/atomic_pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
#define PORT_ATOMIC_POINTER_H_

#include <stdint.h>
//#ifdef LEVELDB_CSTDATOMIC_PRESENT
//#include <cstdatomic> ... moved below
//#endif
#ifdef LEVELDB_ATOMIC_PRESENT
#include <atomic>
#endif
#ifdef OS_WIN
#include <windows.h>
#endif
Expand Down Expand Up @@ -114,9 +114,8 @@ class AtomicPointer {
}
};

// AtomicPointer based on <cstdatomic>
#elif defined(LEVELDB_CSTDATOMIC_PRESENT)
#include <cstdatomic>
// AtomicPointer based on <atomic>
#elif defined(LEVELDB_ATOMIC_PRESENT)

class AtomicPointer {
private:
Expand Down