Fix the GCC build (#40)
* Make it compile with GCC. * Add GCC to CI. * Add warning to documentation about using GCC.
This commit is contained in:
committed by
GitHub
parent
0b64536be4
commit
8fcedfc290
@@ -14,7 +14,13 @@
|
||||
# include <emmintrin.h>
|
||||
# define ALWAYSINLINE __attribute__((always_inline))
|
||||
# define NOINLINE __attribute__((noinline))
|
||||
# define HEADER_GLOBAL __attribute__((selectany))
|
||||
# ifdef __clang__
|
||||
# define HEADER_GLOBAL __attribute__((selectany))
|
||||
# else
|
||||
// GCC does not support selectany, weak is almost the correct
|
||||
// attribute, but leaves the global variable preemptible.
|
||||
# define HEADER_GLOBAL __attribute__((weak))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || \
|
||||
@@ -299,7 +305,8 @@ namespace snmalloc
|
||||
# endif
|
||||
#else
|
||||
size_t prod = x * y;
|
||||
return y && (x > ((size_t)-1 / y));
|
||||
overflow = y && (x > ((size_t)-1 / y));
|
||||
return prod;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,14 @@ namespace snmalloc
|
||||
template<class T, Construction c = RequiresInit>
|
||||
class MPMCStack
|
||||
{
|
||||
using ABA = ABA<T, c>;
|
||||
using ABAT = ABA<T, c>;
|
||||
|
||||
private:
|
||||
static_assert(
|
||||
std::is_same<decltype(T::next), std::atomic<T*>>::value,
|
||||
"T->next must be a std::atomic<T*>");
|
||||
|
||||
ABA stack;
|
||||
ABAT stack;
|
||||
|
||||
public:
|
||||
void push(T* item)
|
||||
@@ -29,7 +29,7 @@ namespace snmalloc
|
||||
|
||||
do
|
||||
{
|
||||
T* top = ABA::load(cmp);
|
||||
T* top = ABAT::load(cmp);
|
||||
last->next.store(top, std::memory_order_release);
|
||||
} while (!stack.compare_exchange(cmp, first));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ namespace snmalloc
|
||||
|
||||
do
|
||||
{
|
||||
top = ABA::load(cmp);
|
||||
top = ABAT::load(cmp);
|
||||
|
||||
if (top == nullptr)
|
||||
break;
|
||||
@@ -63,7 +63,7 @@ namespace snmalloc
|
||||
|
||||
do
|
||||
{
|
||||
top = ABA::load(cmp);
|
||||
top = ABAT::load(cmp);
|
||||
|
||||
if (top == nullptr)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user