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

Re: [libvirt] [PATCH 1/3] build: avoid gcc preprocessor extensions



On Wed, May 11, 2011 at 14:13:28 -0600, Eric Blake wrote:
> Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by
> C99; thankfully, we can avoid it by lumping the format argument
> into the var-args set.
> 
> * src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT)
> (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick
> to C99 var-arg macro syntax.
> * examples/domain-events/events-c/event-test.c (VIR_DEBUG):
> Simplify.
> ---
> 
> This one turned out to be much simpler than I was fearing; any
> time we guarantee that (fmt,...) expands to (fmt,##__VA_ARGS__),
> then we just use one fewer argument (...) expanding to (__VA_ARGS__).
> 
>  examples/domain-events/events-c/event-test.c |    3 +-
>  src/util/logging.h                           |   34 +++++++++++++-------------
>  2 files changed, 18 insertions(+), 19 deletions(-)

Nice and simple, ACK.

Jirka


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