diff options
author | Stefan Weil <weil@mail.berlios.de> | 2010-09-21 22:27:49 +0200 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2010-09-22 20:15:11 +0000 |
commit | 9c9e7d51bf01afdd4902bc9832c4a6ec19f68d0b (patch) | |
tree | c711a024a47dfda080c4bd694fc47f29e4dad867 /qemu-common.h | |
parent | 80bb8cba0af8a77341ef91ff9d5a2d84cad1880f (diff) | |
download | qemu-9c9e7d51bf01afdd4902bc9832c4a6ec19f68d0b.zip qemu-9c9e7d51bf01afdd4902bc9832c4a6ec19f68d0b.tar.gz qemu-9c9e7d51bf01afdd4902bc9832c4a6ec19f68d0b.tar.bz2 |
Move macros GCC_ATTR and GCC_FMT_ATTR to common header file
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 '==' (instead of '=')
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'qemu-common.h')
-rw-r--r-- | qemu-common.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/qemu-common.h b/qemu-common.h index 5544ffd..88c5207 100644 --- a/qemu-common.h +++ b/qemu-common.h @@ -70,6 +70,22 @@ struct iovec { #include <sys/uio.h> #endif +#if defined __GNUC__ +# if (__GNUC__ < 4) || \ + defined(__GNUC_MINOR__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 4) + /* gcc versions before 4.4.x don't support gnu_printf, so use printf. */ +# define GCC_ATTR __attribute__((__unused__, format(printf, 1, 2))) +# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m))) +# else + /* Use gnu_printf when supported (qemu uses standard format strings). */ +# define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2))) +# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) +# endif +#else +#define GCC_ATTR /**/ +#define GCC_FMT_ATTR(n, m) +#endif + #ifdef _WIN32 #define fsync _commit #define lseek _lseeki64 |