[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNU Guile 2.1.6 released (beta)
From: |
Andy Wingo |
Subject: |
Re: GNU Guile 2.1.6 released (beta) |
Date: |
Thu, 09 Mar 2017 22:33:08 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hi,
Picking up this topic...
On Wed 25 Jan 2017 04:35, Matt Wette <address@hidden> writes:
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <address@hidden> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to address@hidden
>
> So I am trying to compile using clang. This has detected issues with
> atomics-internal.h. I can fix most issues with casts:
> static inline uint32_t
> scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
> {
> - return atomic_fetch_sub (loc, arg);
> + return atomic_fetch_sub ((_Atomic uint32_t *)loc, arg);
> }
>
> But problems remain with scm_atomic_set_pointer and scm_atomic_ref_pointer
> which use void** and is apparently not defined for use with atomics.
>
> Apparently gcc does not have a problem with this use but I’m guessing the C11
> standard may have an issue with it.
WDYT about this?
Andy
diff --git a/libguile/atomics-internal.h b/libguile/atomics-internal.h
index f2d17e1..da3ebd8 100644
--- a/libguile/atomics-internal.h
+++ b/libguile/atomics-internal.h
@@ -31,46 +31,56 @@
#ifdef HAVE_STDATOMIC_H
#include <stdatomic.h>
+
static inline uint32_t
scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
{
- return atomic_fetch_sub (loc, arg);
+ atomic_uint_least32_t *a_loc = (atomic_uint_least32_t *) loc;
+ return atomic_fetch_sub (a_loc, arg);
}
static inline _Bool
scm_atomic_compare_and_swap_uint32 (uint32_t *loc, uint32_t *expected,
uint32_t desired)
{
- return atomic_compare_exchange_weak (loc, expected, desired);
+ atomic_uint_least32_t *a_loc = (atomic_uint_least32_t *) loc;
+ return atomic_compare_exchange_weak (a_loc, expected, desired);
}
static inline void
scm_atomic_set_pointer (void **loc, void *val)
{
- atomic_store (loc, val);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ atomic_store (a_loc, (uintptr_t) val);
}
static inline void *
scm_atomic_ref_pointer (void **loc)
{
- return atomic_load (loc);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return (void *) atomic_load (a_loc);
}
static inline void
scm_atomic_set_scm (SCM *loc, SCM val)
{
- atomic_store (loc, val);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ atomic_store (a_loc, SCM_UNPACK (val));
}
static inline SCM
scm_atomic_ref_scm (SCM *loc)
{
- return atomic_load (loc);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return SCM_PACK (atomic_load (a_loc));
}
static inline SCM
scm_atomic_swap_scm (SCM *loc, SCM val)
{
- return atomic_exchange (loc, val);
+ return SCM_PACK (atomic_exchange (loc, val));
}
static inline _Bool
scm_atomic_compare_and_swap_scm (SCM *loc, SCM *expected, SCM desired)
{
- return atomic_compare_exchange_weak (loc, expected, desired);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return atomic_compare_exchange_weak (a_loc,
+ (uintptr_t *) expected,
+ SCM_UNPACK (desired));
}
#else /* HAVE_STDATOMIC_H */
- Re: GNU Guile 2.1.6 released (beta),
Andy Wingo <=