Patchwork [1/4] Add fprintf_function for function pointers to fprintf-like functions

login
register
mail settings
Submitter Stefan Weil
Date Oct. 22, 2010, 9:03 p.m.
Message ID <1287781413-26723-1-git-send-email-weil@mail.berlios.de>
Download mbox | patch
Permalink /patch/68966/
State New
Headers show

Comments

Stefan Weil - Oct. 22, 2010, 9:03 p.m.
This kind of function pointers is used very often in qemu.

The new data type uses format checking with GCC_FMT_ATTR
and will be used in later patches.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 qemu-common.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Blue Swirl - Oct. 30, 2010, 9:23 a.m.
Thanks, applied all.

On Fri, Oct 22, 2010 at 9:03 PM, Stefan Weil <weil@mail.berlios.de> wrote:
> This kind of function pointers is used very often in qemu.
>
> The new data type uses format checking with GCC_FMT_ATTR
> and will be used in later patches.
>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  qemu-common.h |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-common.h b/qemu-common.h
> index d5ae420..7eeec8e 100644
> --- a/qemu-common.h
> +++ b/qemu-common.h
> @@ -81,6 +81,9 @@ struct iovec {
>  #define GCC_FMT_ATTR(n, m)
>  #endif
>
> +typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
> +    GCC_FMT_ATTR(2, 3);
> +
>  #ifdef _WIN32
>  #define fsync _commit
>  #define lseek _lseeki64
> --
> 1.7.1
>
>

Patch

diff --git a/qemu-common.h b/qemu-common.h
index d5ae420..7eeec8e 100644
--- a/qemu-common.h
+++ b/qemu-common.h
@@ -81,6 +81,9 @@  struct iovec {
 #define GCC_FMT_ATTR(n, m)
 #endif
 
+typedef int (*fprintf_function)(FILE *f, const char *fmt, ...)
+    GCC_FMT_ATTR(2, 3);
+
 #ifdef _WIN32
 #define fsync _commit
 #define lseek _lseeki64