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

Eric Blake eblake at redhat.com
Wed May 11 20:46:14 UTC 2011


On 05/11/2011 02:31 PM, Jiri Denemark wrote:
> 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.

Thanks; I've pushed Lai's cleanup and my followup now.  The remaining
two patches in this series are still worthwhile cleanups, but as of this
patch we're back to the state of no longer relying on gcc extensions.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110511/95e9dedd/attachment-0001.sig>


More information about the libvir-list mailing list