qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 2/3] Replace remaining gcc format attribute by m


From: Blue Swirl
Subject: [Qemu-devel] Re: [PATCH 2/3] Replace remaining gcc format attribute by macro GCC_FMT_ATTR (format checking)
Date: Tue, 12 Oct 2010 18:23:50 +0000

On Thu, Sep 23, 2010 at 7:28 PM, Stefan Weil <address@hidden> wrote:
> Replace the remaining format attribute printf by macro
> GCC_FMT_ATTR which uses gnu_printf (if supported).
>
> This needs additional code changes:
>
> * Add qemu-common.h (which defined GCC_FMT_ATTR) were needed.
>
> * Remove standard includes when qemu-common.h was added.
>  qemu-common.h already provides these includes.
>
> * Remove local definitions which now come from stdio.h.
>  These definitions were needed before tcg was introduced.
>  They raise conflicts when qemu-common.h is included.
>
> Cc: Blue Swirl <address@hidden>
> Signed-off-by: Stefan Weil <address@hidden>
> ---
>  cpu-all.h                     |    2 +-
>  cpu-exec.c                    |    2 ++
>  dyngen-exec.h                 |    9 ---------
>  target-alpha/op_helper.c      |    1 +
>  target-arm/op_helper.c        |    2 ++
>  target-cris/op_helper.c       |    1 +
>  target-i386/op_helper.c       |    1 +
>  target-m68k/op_helper.c       |    2 ++
>  target-microblaze/op_helper.c |    2 +-
>  target-mips/op_helper.c       |    3 ++-
>  target-ppc/op_helper.c        |    3 ++-
>  target-sh4/op_helper.c        |    4 ++--
>  target-sparc/op_helper.c      |    1 +
>  13 files changed, 18 insertions(+), 15 deletions(-)
>
> diff --git a/cpu-all.h b/cpu-all.h
> index 67a3266..11edddc 100644
> --- a/cpu-all.h
> +++ b/cpu-all.h
> @@ -773,7 +773,7 @@ void cpu_dump_statistics (CPUState *env, FILE *f,
>                           int flags);
>
>  void QEMU_NORETURN cpu_abort(CPUState *env, const char *fmt, ...)
> -    __attribute__ ((__format__ (__printf__, 2, 3)));
> +    GCC_FMT_ATTR(2, 3);
>  extern CPUState *first_cpu;
>  extern CPUState *cpu_single_env;
>
> diff --git a/cpu-exec.c b/cpu-exec.c
> index dbdfdcc..1cb36e0 100644
> --- a/cpu-exec.c
> +++ b/cpu-exec.c
> @@ -16,6 +16,8 @@
>  * You should have received a copy of the GNU Lesser General Public
>  * License along with this library; if not, see 
> <http://www.gnu.org/licenses/>.
>  */
> +
> +#include "qemu-common.h"

This and other similar additions are not needed for GCC_FMT_ATTR,
qemu-common is already #included by exec-all.h (included by exec.h).
Only the macro definition needs to move up near QEMU_NORETURN etc so
that it's available to exec code.

>  #include "config.h"
>  #include "exec.h"
>  #include "disas.h"
> diff --git a/dyngen-exec.h b/dyngen-exec.h
> index 5bfef3f..97e2556 100644
> --- a/dyngen-exec.h
> +++ b/dyngen-exec.h
> @@ -40,15 +40,6 @@
>  /* XXX: This may be wrong for 64-bit ILP32 hosts.  */
>  typedef void * host_reg_t;
>
> -#ifdef CONFIG_BSD
> -typedef struct __sFILE FILE;
> -#else
> -typedef struct FILE FILE;
> -#endif
> -extern int fprintf(FILE *, const char *, ...);
> -extern int fputs(const char *, FILE *);
> -extern int printf(const char *, ...);
> -

This should be in a separate patch which removes __DYNGEN_EXEC_H.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]