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