Bail out if no atomic operation found

As atomic operations are mandatory now, not-working phony fallback
definitions are not only useless but confusing and harmful.
This commit is contained in:
Nobuyoshi Nakada 2020-04-20 10:44:52 +09:00
parent e92f3e1216
commit 20773a1090
No known key found for this signature in database
GPG Key ID: 7CD2805BFA3770C6
1 changed files with 1 additions and 24 deletions

View File

@ -121,30 +121,7 @@ typedef unsigned int rb_atomic_t;
# endif
#else
typedef int rb_atomic_t;
#define NEED_RUBY_ATOMIC_OPS
extern rb_atomic_t ruby_atomic_exchange(rb_atomic_t *ptr, rb_atomic_t val);
extern rb_atomic_t ruby_atomic_compare_and_swap(rb_atomic_t *ptr,
rb_atomic_t cmp,
rb_atomic_t newval);
# define ATOMIC_SET(var, val) (void)((var) = (val))
# define ATOMIC_INC(var) ((var)++)
# define ATOMIC_DEC(var) ((var)--)
# define ATOMIC_OR(var, val) ((var) |= (val))
# define ATOMIC_EXCHANGE(var, val) ruby_atomic_exchange(&(var), (val))
# define ATOMIC_CAS(var, oldval, newval) ruby_atomic_compare_and_swap(&(var), (oldval), (newval))
# define ATOMIC_SIZE_ADD(var, val) (void)((var) += (val))
# define ATOMIC_SIZE_SUB(var, val) (void)((var) -= (val))
# define ATOMIC_SIZE_EXCHANGE(var, val) ruby_atomic_size_exchange(&(var), (val))
static inline size_t
ruby_atomic_size_exchange(size_t *ptr, size_t val)
{
size_t old = *ptr;
*ptr = val;
return old;
}
# error No atomic operation found
#endif
#ifndef ATOMIC_SIZE_INC