4 commits - meson.build src/cairo-atomic-private.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 25 22:18:53 UTC 2024


 meson.build                |   28 +++++++++++++++-------------
 src/cairo-atomic-private.h |   10 +++++-----
 2 files changed, 20 insertions(+), 18 deletions(-)

New commits:
commit 2d7fcf17f756e08c685d0d4ef999d5e7ef272fea
Merge: 027544053 1d20d8f47
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Jul 25 22:18:50 2024 +0000

    Merge branch 'msys-clang-fix' into 'master'
    
    Fix MSYS clang build error
    
    See merge request cairo/cairo!575

commit 1d20d8f476befefc83944d85e8ee8050de223635
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Jul 25 08:27:37 2024 +0930

    meson: use has_define() to check if define exists

diff --git a/meson.build b/meson.build
index f0b7bde75..4051a7c11 100644
--- a/meson.build
+++ b/meson.build
@@ -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 \
commit b69d569c3cd7f0db159f4c9823f21edb9bc18803
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Jul 25 08:25:57 2024 +0930

    Windows should always use win32 atomics
    
    instead of gcc builtins.

diff --git a/meson.build b/meson.build
index fa8745cc1..f0b7bde75 100644
--- a/meson.build
+++ b/meson.build
@@ -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 = []
commit b99f6ff534f02cdb001f229c6883af97e1ed91fb
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Thu Jul 25 08:14:34 2024 +0930

    Fix MSYS clang build error
    
    ../src/cairo-atomic-private.h:210:43: warning: incompatible pointer types passing 'void **' to param
    eter of type 'cairo_atomic_intptr_t *' (aka 'long long *') [-Wincompatible-pointer-types]
      210 |     return __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
    _CST);
          |                                           ^~~~~~~~~
    ../src/cairo-atomic-private.h:210:54: error: incompatible pointer to integer conversion passing 'voi
    d *' to parameter of type 'cairo_atomic_intptr_t' (aka 'long long') [-Wint-conversion]
      210 |     return __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
    _CST);
          |                                                      ^~~~
    ../src/cairo-atomic-private.h:220:43: warning: incompatible pointer types passing 'void **' to param
    eter of type 'cairo_atomic_intptr_t *' (aka 'long long *') [-Wincompatible-pointer-types]
      220 |     (void) __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
    _CST);
          |                                           ^~~~~~~~~
    ../src/cairo-atomic-private.h:220:54: error: incompatible pointer to integer conversion passing 'voi
    d *' to parameter of type 'cairo_atomic_intptr_t' (aka 'long long') [-Wint-conversion]
      220 |     (void) __atomic_compare_exchange_n(x, &expected, newv, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ
    _CST);
          |                                                      ^~~~

diff --git a/src/cairo-atomic-private.h b/src/cairo-atomic-private.h
index feba95691..32cf58b63 100644
--- a/src/cairo-atomic-private.h
+++ b/src/cairo-atomic-private.h
@@ -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) \


More information about the cairo-commit mailing list