fix compilation of core/bricks with clang++10

* configure.ac: Call CHECK_ATOMIC after setting the C++ options.
This is probably not necessary, but it makes more sense.
* m4/l_atomic.m4: Augment the test body with a scenario
that actually requires -latomic.
This commit is contained in:
Alexandre Duret-Lutz 2021-01-11 19:27:37 +01:00
parent 170a4ac164
commit 92ce384c80
2 changed files with 26 additions and 12 deletions

View file

@ -10,14 +10,28 @@ dnl warranty.
# Sourced from http://bugs.debian.org/797228
m4_define([_CHECK_ATOMIC_testbody], [[
#include <atomic>
#include <cstdint>
int main() {
std::atomic<int64_t> a{};
int64_t v = 5;
int64_t r = a.fetch_add(v);
return static_cast<int>(r);
}
#include <atomic>
#include <cstdint>
template< typename T >
struct Tagged
{
T t;
uint32_t _tag;
static const int tag_bits = 16;
void tag( uint32_t v ) { _tag = v; }
uint32_t tag() { return _tag; }
Tagged() noexcept : t(), _tag( 0 ) {}
Tagged( const T &t ) : t( t ), _tag( 0 ) {}
};
int main() {
std::atomic<int64_t> a{};
int64_t v = 5;
int64_t r = a.fetch_add(v);
std::atomic<Tagged<int>> value;
return static_cast<int>(r) + value.load().t;
}
]])
AC_DEFUN([CHECK_ATOMIC], [