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
--VSVNCtZB1QZ8vhj+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 10, 2012 at 08:41:55PM +0200, Tijl Coosemans wrote: > Hi, >=20 > Below is a patch+descriptions for stdatomic.h that I was hoping somebody = could > review. >=20 > > Index: stdatomic.h > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > --- 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 =3D (value) } > > -#define atomic_init(obj, value) do { \ > > - (obj)->__val =3D (value); \ > > -} while (0) > > +#define atomic_init(obj, value) ((void)((obj)->__val =3D (value))) >=20 > 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. --VSVNCtZB1QZ8vhj+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBPP/IACgkQC3+MBN1Mb4i4wwCgyJlE/0GkRGdhNXaEfu1JJK+O lfUAn048+EY+ZpZ8PUNilCh+vtf2ScL/ =Ve7l -----END PGP SIGNATURE----- --VSVNCtZB1QZ8vhj+--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120911134314.GK37286>