From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54510 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OyVyC-0000Ve-J8 for qemu-devel@nongnu.org; Wed, 22 Sep 2010 16:31:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OyVxl-0006kw-Q5 for qemu-devel@nongnu.org; Wed, 22 Sep 2010 16:30:47 -0400 Received: from mail-qw0-f45.google.com ([209.85.216.45]:62907) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OyVxl-0006kr-JC for qemu-devel@nongnu.org; Wed, 22 Sep 2010 16:30:45 -0400 Received: by qwk4 with SMTP id 4so806171qwk.4 for ; Wed, 22 Sep 2010 13:30:45 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1285100869-11002-1-git-send-email-weil@mail.berlios.de> References: <1285100869-11002-1-git-send-email-weil@mail.berlios.de> From: Blue Swirl Date: Wed, 22 Sep 2010 20:30:24 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] Move macros GCC_ATTR and GCC_FMT_ATTR to common header file List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil Cc: QEMU Developers Thanks, applied. On Tue, Sep 21, 2010 at 8:27 PM, Stefan Weil wrote: > By moving the definition of GCC_ATTR and GCC_FMT_ATTR > from audio_int.h to qemu-common.h these macros are > now generally available for further patches which add > the gcc format attribute. > > Newer gcc versions support format gnu_printf which is > better suited for use in QEMU than format printf > (QEMU always uses standard format strings (even with mingw32)). > > V2: Use correct operator '=3D=3D' (instead of '=3D') > > Cc: Blue Swirl > Signed-off-by: Stefan Weil > --- > =C2=A0audio/audio_int.h | =C2=A0 =C2=A08 -------- > =C2=A0qemu-common.h =C2=A0 =C2=A0 | =C2=A0 16 ++++++++++++++++ > =C2=A02 files changed, 16 insertions(+), 8 deletions(-) > > diff --git a/audio/audio_int.h b/audio/audio_int.h > index 06e313f..d8560b6 100644 > --- a/audio/audio_int.h > +++ b/audio/audio_int.h > @@ -236,14 +236,6 @@ static inline int audio_ring_dist (int dst, int src,= int len) > =C2=A0 =C2=A0 return (dst >=3D src) ? (dst - src) : (len - src + dst); > =C2=A0} > > -#if defined __GNUC__ > -#define GCC_ATTR __attribute__ ((__unused__, __format__ (__printf__, 1, = 2))) > -#define GCC_FMT_ATTR(n, m) __attribute__ ((__format__ (__printf__, n, m)= )) > -#else > -#define GCC_ATTR /**/ > -#define GCC_FMT_ATTR(n, m) > -#endif > - > =C2=A0static void GCC_ATTR dolog (const char *fmt, ...) > =C2=A0{ > =C2=A0 =C2=A0 va_list ap; > diff --git a/qemu-common.h b/qemu-common.h > index dfd3dc0..96be1d4 100644 > --- a/qemu-common.h > +++ b/qemu-common.h > @@ -70,6 +70,22 @@ struct iovec { > =C2=A0#include > =C2=A0#endif > > +#if defined __GNUC__ > +# if (__GNUC__ < 4) || \ > + =C2=A0 =C2=A0 defined(__GNUC_MINOR__) && (__GNUC__ =3D=3D 4) && (__GNUC= _MINOR__ < 4) > + =C2=A0 /* gcc versions before 4.4.x don't support gnu_printf, so use pr= intf. */ > +# =C2=A0define GCC_ATTR __attribute__((__unused__, format(printf, 1, 2))= ) > +# =C2=A0define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m))) > +# else > + =C2=A0 /* Use gnu_printf when supported (qemu uses standard format stri= ngs). */ > +# =C2=A0define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1,= 2))) > +# =C2=A0define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m= ))) > +# endif > +#else > +#define GCC_ATTR /**/ > +#define GCC_FMT_ATTR(n, m) > +#endif > + > =C2=A0#ifdef _WIN32 > =C2=A0#define fsync _commit > =C2=A0#define lseek _lseeki64 > -- > 1.7.1 > >