From 2fdf2415ab3c1ce712983bf50e97f75ebd7fabc9 Mon Sep 17 00:00:00 2001 From: Mikhail Fludkov Date: Mon, 6 Nov 2017 13:07:00 +0100 Subject: [PATCH] Fix code generation when using GCC legacy atomic operations https://bugs.freedesktop.org/show_bug.cgi?id=103559 --- build/aclocal.cairo.m4 | 8 ++++---- src/cairo-atomic-private.h | 9 +-------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/build/aclocal.cairo.m4 b/build/aclocal.cairo.m4 index f0ea23c..64c1a2e 100644 --- a/build/aclocal.cairo.m4 +++ b/build/aclocal.cairo.m4 @@ -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 diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h index 723a326..4676185 100644 --- a/src/cairo-atomic-private.h +++ b/src/cairo-atomic-private.h @@ -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)) -- 2.7.4