qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure f


From: Jamie Lokier
Subject: Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c
Date: Thu, 4 Feb 2010 12:10:27 +0000
User-agent: Mutt/1.5.13 (2006-08-11)

Sheng Yang wrote:
>     printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 
> Fabrice 
> Bellard\n"
>            "usage: qemu-img command [command options]\n"
>            "QEMU disk image utility\n"
>            "\n"
>            "Command syntax:\n"
> #define DEF(option, callback, arg_string)        \
>            "  " arg_string "\n"
> #include "qemu-img-cmds.h"
> #undef DEF
> #undef GEN_DOCS
> ....
> 
> Seems gcc take "printf" as a marco. I added a "#undef printf" before the 
> line, 
> then it works...
> 
> So any clue on what's happened and how to fix?

You can't have preprocessor directives inside the arguments of a macro
call.  Yes it's occasionally annoying like this.

You can prevent the macro call without #undef by writing:

    (printf)("qemu-img version " ...etc)

I'm not sure if Glibc is compliant with ISO C by
making printf into a macro that takes arguments.

Certain functions such as putchar() are specified as being allowed to
be macros, which implies the other standard functions aren't.

-- Jamie




reply via email to

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