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:
parent
170a4ac164
commit
92ce384c80
2 changed files with 26 additions and 12 deletions
|
|
@ -1,5 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2008-2020, Laboratoire de Recherche et Développement
|
||||
# Copyright (C) 2008-2021, Laboratoire de Recherche et Développement
|
||||
# de l'Epita (LRDE).
|
||||
# Copyright (C) 2003-2007 Laboratoire d'Informatique de Paris 6
|
||||
# (LIP6), département Systèmes Répartis Coopératifs (SRC), Université
|
||||
|
|
@ -79,9 +79,6 @@ AX_CHECK_COMPILE_FLAG([-std=c11], [CFLAGS="$CFLAGS -std=c11"])
|
|||
|
||||
gl_INIT
|
||||
|
||||
dnl Check if -latomic is required for <std::atomic>
|
||||
CHECK_ATOMIC
|
||||
|
||||
# Use -Werror since using -fvisibility under MinGW is only a warning.
|
||||
# (The option is ignored anyway since this does not make sense under windows).
|
||||
AX_CHECK_COMPILE_FLAG([-Werror -fvisibility=hidden],
|
||||
|
|
@ -145,6 +142,9 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl Check if -latomic is required for <std::atomic>
|
||||
CHECK_ATOMIC
|
||||
|
||||
AX_CHECK_BUDDY
|
||||
|
||||
AC_CHECK_HEADERS([sys/times.h valgrind/memcheck.h spawn.h])
|
||||
|
|
|
|||
|
|
@ -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], [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue