Merge branch 'msys-clang-fix' into 'master'

Fix MSYS clang build error

See merge request cairo/cairo!575
This commit is contained in:
Adrian Johnson 2024-07-25 22:18:50 +00:00
commit 2d7fcf17f7
2 changed files with 20 additions and 18 deletions

View file

@ -332,7 +332,7 @@ if freetype_dep.found()
conf.set('CAIRO_CAN_TEST_TTX_FONT', 1)
endif
endif
if cc.get_define('FT_LOAD_NO_SVG', dependencies: freetype_dep, prefix: '#include <freetype/freetype.h>') != ''
if cc.has_define('FT_LOAD_NO_SVG', dependencies: freetype_dep, prefix: '#include <freetype/freetype.h>')
conf.set('HAVE_FT_LOAD_NO_SVG', 1)
endif
if freetype_dep.version().version_compare(freetype_colrv1_required_version) and \
@ -732,18 +732,20 @@ extra_link_args += pthread_link_args
# Atomics are an optional feature in C11. Also need to check that C11 atomics are lock free.
# Windows can't use C11 atomics as some files are compiled with C++.
if host_machine.system() != 'windows' and cc.links(files('meson-cc-tests/atomic-ops-c11.c'), name: 'Atomic ops: c11')
conf.set('HAVE_C11_ATOMIC_PRIMITIVES', 1)
elif cc.links(files('meson-cc-tests/atomic-ops-cxx11.c'), name: 'Atomic ops: cxx11')
conf.set('HAVE_CXX11_ATOMIC_PRIMITIVES', 1)
elif cc.links(files('meson-cc-tests/atomic-ops-gcc-legacy.c'), name: 'Atomic ops: gcc legacy')
conf.set('HAVE_GCC_LEGACY_ATOMICS', 1)
elif cc.has_header('atomic_ops.h')
conf.set('HAVE_LIB_ATOMIC_OPS', 1)
elif cc.has_header('libkern/OSAtomic.h')
conf.set('HAVE_OS_ATOMIC_OPS', 1)
elif host_machine.system() != 'windows'
warning('Atomic ops not supported.')
if host_machine.system() != 'windows'
if cc.links(files('meson-cc-tests/atomic-ops-c11.c'), name: 'Atomic ops: c11')
conf.set('HAVE_C11_ATOMIC_PRIMITIVES', 1)
elif cc.links(files('meson-cc-tests/atomic-ops-cxx11.c'), name: 'Atomic ops: cxx11')
conf.set('HAVE_CXX11_ATOMIC_PRIMITIVES', 1)
elif cc.links(files('meson-cc-tests/atomic-ops-gcc-legacy.c'), name: 'Atomic ops: gcc legacy')
conf.set('HAVE_GCC_LEGACY_ATOMICS', 1)
elif cc.has_header('atomic_ops.h')
conf.set('HAVE_LIB_ATOMIC_OPS', 1)
elif cc.has_header('libkern/OSAtomic.h')
conf.set('HAVE_OS_ATOMIC_OPS', 1)
else
warning('Atomic ops not supported.')
endif
endif
test_mkdir_c_args = []

View file

@ -206,8 +206,8 @@ _cairo_atomic_int_cmpxchg_return_old_impl(cairo_atomic_int_t *x,
static cairo_always_inline cairo_bool_t
_cairo_atomic_ptr_cmpxchg_impl(cairo_atomic_intptr_t *x, void *oldv, void *newv)
{
void *expected = oldv;
return __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
intptr_t expected = (intptr_t)oldv;
return __atomic_compare_exchange_n(x, &expected, (intptr_t)newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
}
#define _cairo_atomic_ptr_cmpxchg(x, oldv, newv) \
@ -216,9 +216,9 @@ _cairo_atomic_ptr_cmpxchg_impl(cairo_atomic_intptr_t *x, void *oldv, void *newv)
static cairo_always_inline void *
_cairo_atomic_ptr_cmpxchg_return_old_impl(cairo_atomic_intptr_t *x, void *oldv, void *newv)
{
void *expected = oldv;
(void) __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return expected;
intptr_t expected = (intptr_t)oldv;
(void) __atomic_compare_exchange_n(x, &expected, (intptr_t)newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
return (void*)expected;
}
#define _cairo_atomic_ptr_cmpxchg_return_old(x, oldv, newv) \