Skip to content

Commit

Permalink
Revert "fix detection of cxx11_std_atomic"
Browse files Browse the repository at this point in the history
  • Loading branch information
msimberg committed Jan 18, 2018
1 parent bb55a8b commit bef7f3e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
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

0 comments on commit bef7f3e

Please sign in to comment.