From: Andy Wingo <wingo@pobox.com>
To: Matt Wette <matt.wette@gmail.com>
Cc: guile-devel <guile-devel@gnu.org>
Subject: Re: GNU Guile 2.1.6 released (beta)
Date: Thu, 09 Mar 2017 22:33:08 +0100 [thread overview]
Message-ID: <87d1dquodn.fsf@pobox.com> (raw)
In-Reply-To: <E8563B67-E3AC-4CE8-8F2A-A01E8E9360E4@gmail.com> (Matt Wette's message of "Tue, 24 Jan 2017 19:35:49 -0800")
Hi,
Picking up this topic...
On Wed 25 Jan 2017 04:35, Matt Wette <matt.wette@gmail.com> writes:
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> 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 guile-devel@gnu.org.
>
> 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 */
next prev parent reply other threads:[~2017-03-09 21:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
2017-01-20 3:01 ` Matt Wette
2017-01-20 19:01 ` GNU Guile 2.1.6 released (beta) [numbers.c] Matt Wette
2017-01-20 19:15 ` Amirouche
2017-01-20 20:23 ` Matt Wette
2017-01-28 19:29 ` Matt Wette
2017-01-20 14:10 ` GNU Guile 2.1.6 released (beta) Matt Wette
2017-01-25 3:35 ` Matt Wette
2017-03-09 21:33 ` Andy Wingo [this message]
2017-03-10 2:01 ` Matt Wette
2017-03-10 2:52 ` Matt Wette
2017-03-10 8:13 ` Andy Wingo
2017-03-10 13:10 ` Matt Wette
2017-02-11 20:52 ` Matt Wette
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1dquodn.fsf@pobox.com \
--to=wingo@pobox.com \
--cc=guile-devel@gnu.org \
--cc=matt.wette@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).