[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 07/17] audio: Replace static functions in header file
From: |
Michael Tokarev |
Subject: |
[Qemu-devel] [PULL 07/17] audio: Replace static functions in header file by macros, remove GCC_ATTR |
Date: |
Sat, 22 Jun 2013 13:24:26 +0400 |
From: Stefan Weil <address@hidden>
Using macros instead of static functions for dolog and for ldebug
simplifies the code and can also reduce the total code size.
GCC_ATTR was only used in audio_int.h, so it is now unused and
the definition can be removed from compiler.h.
Signed-off-by: Stefan Weil <address@hidden>
Signed-off-by: Michael Tokarev <address@hidden>
---
audio/audio_int.h | 31 +++----------------------------
include/qemu/compiler.h | 3 ---
2 files changed, 3 insertions(+), 31 deletions(-)
diff --git a/audio/audio_int.h b/audio/audio_int.h
index b9b0676..fd019a0 100644
--- a/audio/audio_int.h
+++ b/audio/audio_int.h
@@ -243,38 +243,13 @@ static inline int audio_ring_dist (int dst, int src, int
len)
return (dst >= src) ? (dst - src) : (len - src + dst);
}
-static void GCC_ATTR dolog (const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- AUD_vlog (AUDIO_CAP, fmt, ap);
- va_end (ap);
-}
+#define dolog(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
#ifdef DEBUG
-static void GCC_ATTR ldebug (const char *fmt, ...)
-{
- va_list ap;
-
- va_start (ap, fmt);
- AUD_vlog (AUDIO_CAP, fmt, ap);
- va_end (ap);
-}
+#define ldebug(fmt, ...) AUD_log(AUDIO_CAP, fmt, ## __VA_ARGS__)
#else
-#if defined NDEBUG && defined __GNUC__
-#define ldebug(...)
-#elif defined NDEBUG && defined _MSC_VER
-#define ldebug __noop
-#else
-static void GCC_ATTR ldebug (const char *fmt, ...)
-{
- (void) fmt;
-}
+#define ldebug(fmt, ...) (void)0
#endif
-#endif
-
-#undef GCC_ATTR
#define AUDIO_STRINGIFY_(n) #n
#define AUDIO_STRINGIFY(n) AUDIO_STRINGIFY_(n)
diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 6175c24..155b358 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -38,11 +38,9 @@
#if defined __GNUC__
# if !QEMU_GNUC_PREREQ(4, 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)))
# if defined(_WIN32)
/* Map __printf__ to __gnu_printf__ because we want standard format strings
@@ -51,7 +49,6 @@
# endif
# endif
#else
-#define GCC_ATTR /**/
#define GCC_FMT_ATTR(n, m)
#endif
--
1.7.10.4
- [Qemu-devel] [PULL 01/17] vl: reformat SDL ifdeffery a bit, (continued)
- [Qemu-devel] [PULL 01/17] vl: reformat SDL ifdeffery a bit, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 02/17] qemu-options: trivial fix for -mon args help, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 03/17] qemu-img: Add missing GCC_FMT_ATTR, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 04/17] kvm: Fix potential resource leak (missing fclose), Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 05/17] savevm: Fix potential memory leak, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 12/17] vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 17/17] configure: Add signed*signed check to [u]int128_t test, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 16/17] Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 08/17] configure: Fix "ERROR: ERROR: " for missing/incompatible DTC, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 13/17] qemu-char: use bool in qemu_chr_open_socket and simplify code a bit, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 07/17] audio: Replace static functions in header file by macros, remove GCC_ATTR,
Michael Tokarev <=
- [Qemu-devel] [PULL 09/17] acl: acl_add can't insert before last list element, fix, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 06/17] libcacard: Fix cppcheck warning and remove unneeded code, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 15/17] qapi: lack of two commas in dict, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 10/17] qxl: Fix QXLRam initialisation., Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 14/17] sd: pass bool parameter for sd_init, Michael Tokarev, 2013/06/22
- [Qemu-devel] [PULL 11/17] block/nand: Formatting sweep, Michael Tokarev, 2013/06/22