From owner-freebsd-threads@FreeBSD.ORG Tue Sep 11 13:43:20 2012 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id AFA5E106566B for ; Tue, 11 Sep 2012 13:43:20 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id EA26F8FC0A for ; Tue, 11 Sep 2012 13:43:19 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8BDhQIG058317; Tue, 11 Sep 2012 16:43:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8BDhEsg004447; Tue, 11 Sep 2012 16:43:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8BDhEU7004446; Tue, 11 Sep 2012 16:43:14 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 11 Sep 2012 16:43:14 +0300 From: Konstantin Belousov To: Tijl Coosemans Message-ID: <20120911134314.GK37286@deviant.kiev.zoral.com.ua> References: <504E3473.6010107@coosemans.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="VSVNCtZB1QZ8vhj+" Content-Disposition: inline In-Reply-To: <504E3473.6010107@coosemans.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-threads@freebsd.org Subject: Re: review stdatomic.h fixes X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Sep 2012 13:43:20 -0000 --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+--