mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 04:38:04 +02:00
Fix code generation when using GCC legacy atomic operations
https://bugs.freedesktop.org/show_bug.cgi?id=103559
This commit is contained in:
parent
f614f588e6
commit
e5532f5ad7
2 changed files with 5 additions and 12 deletions
|
|
@ -165,7 +165,7 @@ AC_DEFUN([CAIRO_CHECK_NATIVE_ATOMIC_PRIMITIVES],
|
|||
int atomic_add(int i) { return __sync_fetch_and_add (&i, 1); }
|
||||
int atomic_cmpxchg(int i, int j, int k) { return __sync_val_compare_and_swap (&i, j, k); }
|
||||
], [],
|
||||
cairo_cv_atomic_primitives="Intel"
|
||||
cairo_cv_atomic_primitives="gcc-legacy"
|
||||
)
|
||||
|
||||
AC_TRY_LINK([
|
||||
|
|
@ -190,9 +190,9 @@ int atomic_cmpxchg(int i, int j, int k) { return __atomic_compare_exchange_n(&i,
|
|||
[Enable if your compiler supports the GCC __atomic_* atomic primitives])
|
||||
fi
|
||||
|
||||
if test "x$cairo_cv_atomic_primitives" = xIntel; then
|
||||
AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1,
|
||||
[Enable if your compiler supports the Intel __sync_* atomic primitives])
|
||||
if test "x$cairo_cv_atomic_primitives" = xgcc-legacy; then
|
||||
AC_DEFINE(HAVE_GCC_LEGACY_ATOMICS, 1,
|
||||
[Enable if your compiler supports the legacy GCC __sync_* atomic primitives])
|
||||
fi
|
||||
|
||||
if test "x$cairo_cv_atomic_primitives" = "xlibatomic-ops"; then
|
||||
|
|
|
|||
|
|
@ -157,13 +157,12 @@ _cairo_atomic_ptr_cmpxchg_return_old_impl(void **x, void *oldv, void *newv)
|
|||
|
||||
#endif
|
||||
|
||||
#if HAVE_INTEL_ATOMIC_PRIMITIVES
|
||||
#if HAVE_GCC_LEGACY_ATOMICS
|
||||
|
||||
#define HAS_ATOMIC_OPS 1
|
||||
|
||||
typedef int cairo_atomic_int_t;
|
||||
|
||||
#ifdef ATOMIC_OP_NEEDS_MEMORY_BARRIER
|
||||
static cairo_always_inline cairo_atomic_int_t
|
||||
_cairo_atomic_int_get (cairo_atomic_int_t *x)
|
||||
{
|
||||
|
|
@ -189,12 +188,6 @@ _cairo_atomic_ptr_get (void **x)
|
|||
__sync_synchronize ();
|
||||
return *x;
|
||||
}
|
||||
#else
|
||||
# define _cairo_atomic_int_get(x) (*x)
|
||||
# define _cairo_atomic_int_get_relaxed(x) (*x)
|
||||
# define _cairo_atomic_int_set_relaxed(x, val) (*x) = (val)
|
||||
# define _cairo_atomic_ptr_get(x) (*x)
|
||||
#endif
|
||||
|
||||
# define _cairo_atomic_int_inc(x) ((void) __sync_fetch_and_add(x, 1))
|
||||
# define _cairo_atomic_int_dec(x) ((void) __sync_fetch_and_add(x, -1))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue