[glib: 1/2] fix atomic detection on older gcc versions



commit a76cb94308e98f948d19ebef7e0c5c0a58112be9
Author: Antoine Jacoutot <ajacoutot gnome org>
Date:   Sun Jul 14 19:25:28 2019 +0200

    fix atomic detection on older gcc versions
    
    GLib checks for __sync_bool_compare_and_swap, and requires
    __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 to be defined if the function is available,
    except with special cases like Linux armv5.
    Extend the existing workaround to unbreak on old gcc versions that implement
    __sync_bool_compare_and_swap but don't provide __GCC_HAVE_* macros.

 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/meson.build b/meson.build
index b85ff7661..db4f52717 100644
--- a/meson.build
+++ b/meson.build
@@ -1597,8 +1597,8 @@ atomicdefine = '''
 # We know that we can always use real ("lock free") atomic operations with MSVC
 if cc.get_id() == 'msvc' or cc.links(atomictest, name : 'atomic ops')
   have_atomic_lock_free = true
-  if (host_system == 'android' or host_system == 'linux') and not cc.compiles(atomicdefine, name : 'atomic 
ops define')
-    # When building for armv5 on Linux, gcc provides
+  if cc.get_id() == 'gcc' and not cc.compiles(atomicdefine, name : 'atomic ops define')
+    # Old gcc release may provide
     # __sync_bool_compare_and_swap but doesn't define
     # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
     glib_conf.set('__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4', true)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]