Date: Tue, 11 Sep 2012 16:43:14 +0300 From: Konstantin Belousov <kostikbel@gmail.com> To: Tijl Coosemans <tijl@coosemans.org> Cc: freebsd-threads@freebsd.org Subject: Re: review stdatomic.h fixes Message-ID: <20120911134314.GK37286@deviant.kiev.zoral.com.ua> In-Reply-To: <504E3473.6010107@coosemans.org> References: <504E3473.6010107@coosemans.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On Mon, Sep 10, 2012 at 08:41:55PM +0200, Tijl Coosemans wrote:
> Hi,
>
> Below is a patch+descriptions for stdatomic.h that I was hoping somebody could
> review.
>
> > Index: stdatomic.h
> > ===================================================================
> > --- stdatomic.h (revision 240316)
> > +++ stdatomic.h (working copy)
> > @@ -54,9 +54,7 @@
> > #define atomic_init(obj, value) __c11_atomic_init(obj, value)
> > #else
> > #define ATOMIC_VAR_INIT(value) { .__val = (value) }
> > -#define atomic_init(obj, value) do { \
> > - (obj)->__val = (value); \
> > -} while (0)
> > +#define atomic_init(obj, value) ((void)((obj)->__val = (value)))
>
> atomic_init() is defined as a (generic) function returning void, so make this
> a void expression instead of using do-while.
Why not define it as static inline function for real ? For some symbols,
e.g.atomic_is_lock_free(), you would need both function and macro, as it
is done for gcc case.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)
iEYEARECAAYFAlBPP/IACgkQC3+MBN1Mb4i4wwCgyJlE/0GkRGdhNXaEfu1JJK+O
lfUAn048+EY+ZpZ8PUNilCh+vtf2ScL/
=Ve7l
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120911134314.GK37286>
