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

Revert "fix detection of cxx11_std_atomic" #3111

Merged
merged 1 commit into from Jan 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 2 additions & 9 deletions cmake/HPX_AddConfigTest.cmake
Expand Up @@ -9,8 +9,6 @@

set(HPX_ADDCONFIGTEST_LOADED TRUE)

include(CheckLibraryExists)

macro(add_hpx_config_test variable)
set(options FILE EXECUTE)
set(one_value_args SOURCE ROOT CMAKECXXFEATURE)
Expand Down Expand Up @@ -389,20 +387,15 @@ macro(hpx_check_for_cxx11_std_atomic)
# Sometimes linking against libatomic is required for atomic ops, if
# the platform doesn't support lock-free atomics.

# remove REQUIRED so that we don't generate a failure too early
# need to copy ARGN to list in order to remove REQUIRED
set (extra_macro_args ${ARGN})
list(REMOVE_ITEM extra_macro_args REQUIRED)

# First check if atomics work without the library.
add_hpx_config_test(HPX_WITH_CXX11_ATOMIC
SOURCE cmake/tests/cxx11_std_atomic.cpp FILE extra_macro_args)
SOURCE cmake/tests/cxx11_std_atomic.cpp
FILE ${ARGN})

# If not, check if the library exists, and atomics work with it.
if(NOT HPX_WITH_CXX11_ATOMIC)
check_library_exists(atomic __atomic_fetch_add_4 "" HPX_HAVE_LIBATOMIC)
if(HPX_HAVE_LIBATOMIC)
unset(HPX_WITH_CXX11_ATOMIC CACHE)
add_hpx_config_test(HPX_WITH_CXX11_ATOMIC
SOURCE cmake/tests/cxx11_std_atomic.cpp
LIBRARIES "atomic"
Expand Down
7 changes: 0 additions & 7 deletions cmake/tests/cxx11_std_atomic.cpp
Expand Up @@ -7,10 +7,6 @@

#include <atomic>

struct P {
long long x; long long y;
};

int main()
{
std::atomic_flag af = ATOMIC_FLAG_INIT;
Expand All @@ -21,9 +17,6 @@ int main()
ai.store(0);
int i = ai.load();

std::atomic<P> p0;
P p1 = atomic_load(&p0);

std::memory_order mo;
mo = std::memory_order_relaxed;
mo = std::memory_order_acquire;
Expand Down