[Top][All Lists]
[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: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c |
Date: |
Thu, 04 Feb 2010 18:52:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) |
Jamie Lokier <address@hidden> writes:
> 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)
Yup.
> I'm not sure if Glibc is compliant with ISO C by
> making printf into a macro that takes arguments.
It is. 7.1.4 "Use of library functions" says "Any function declared in
a header may be additionally implemented as a function-like macro
defined in the header".
> Certain functions such as putchar() are specified as being allowed to
> be macros, which implies the other standard functions aren't.
You mean putc(), don't you? 7.19.7.8:
The putc function is equivalent to fputc, except that if it is
implemented as a macro, it may evaluate stream more than once, so
that argument should never be an expression with side effects.
The general license-to-macro in 7.1.4 wouldn't allow a macro that
evaluates the argument more than once, so we need a special license
here.
- [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c, Sheng Yang, 2010/02/04
- [Qemu-devel] Re: "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c, Paolo Bonzini, 2010/02/04
- Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c, Jamie Lokier, 2010/02/04
- Re: [Qemu-devel] "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c,
Markus Armbruster <=
- [Qemu-devel] Re: "Enable _FORTIFY_SOURCE=2" result in building failure for qemu-img.c, Juan Quintela, 2010/02/04
- [Qemu-devel] [PATCH] qemu-img: avoid preprocessor directives in a printf call, Paolo Bonzini, 2010/02/04
- [Qemu-devel] Re: [PATCH] qemu-img: avoid preprocessor directives in a printf call, Sheng Yang, 2010/02/04
- [Qemu-devel] [PATCH 0/4] Fix printf calls embedding preprocessor directives, Paolo Bonzini, 2010/02/04
- [Qemu-devel] Re: [PATCH 0/4] Fix printf calls embedding preprocessor directives, Sheng Yang, 2010/02/04
- Re: [Qemu-devel] Re: [PATCH 0/4] Fix printf calls embedding preprocessor directives, Kevin Wolf, 2010/02/05
- [Qemu-devel] Re: [PATCH 0/4] Fix printf calls embedding preprocessor directives, Paolo Bonzini, 2010/02/05
- [Qemu-devel] [PATCH 1/4] qemu-img: avoid preprocessor directives in a printf call, Paolo Bonzini, 2010/02/04
- [Qemu-devel] [PATCH 2/4] cope with printf macro definition in readline.c, Paolo Bonzini, 2010/02/04
- [Qemu-devel] [PATCH 3/4] do not interpolate % from vl.c to qemu-options.h, Paolo Bonzini, 2010/02/04