Re: [libvirt] [RFC PATCH] build: consistently use C99 varargs macros

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

 



According to Daniel Veillard on 3/1/2010 10:13 AM:
> On Mon, Mar 01, 2010 at 08:04:35AM -0700, Eric Blake wrote:
>> Prior to this patch, there was an inconsistent mix between GNU and
>> C99.  For consistency, and potential portability to other compilers,
>> stick with the C99 vararg macro syntax.
>>
>> -#define virStorageReportError(code, fmt...)                             \
>> +#define virStorageReportError(code, ...)                                \
>>      virReportErrorHelper(NULL, VIR_FROM_STORAGE, code, __FILE__,        \
>> -                         __FUNCTION__, __LINE__, fmt)
>> +                         __FUNCTION__, __LINE__, __VA_ARGS__)
>>
>>  int virStoragePoolLoadAllConfigs(virStoragePoolObjListPtr pools,
>>                                   const char *configDir,
> 
>   That sounds a good idea, since mingw is the other compiler we use now,
> we just need to make sure it grok it, can you confirm ? google()[1] on
> the topic seems to be a post from you so I assume you can give a
> definite and quick answer :-)

mingw implies either gcc (supports both syntax styles) or MSVC.  I don't
use MSVC, but a google search[1] found a thread that implies that MSVC
sort-of understands C99 variadic macros as of 2005, but definitely does
not grok gcc variadic macros.  That page also states MSVC has bugs if
__VA_ARGS__ is not the last thing in the expansion, but that appears
irrelevant to libvirt's usage.

MSVC has enough other issues (the biggest in my mind being that it is not
free software, but it has a spate of other standards-compliance issues)
that I'm okay with requiring gcc for doing a mingw compile of libvirt.
But it is still nicer to stick to standards rather than gcc extensions,
when appropriate.

At any rate, it appears I have agreement with the cleanup, so I will
continue on with the rest of the patch and post the entire thing for
review later on.  Should I break it into one directory per patch, or
condense everything into a single giant patch?

[1] http://www.codeguru.com/forum/showthread.php?t=468033

-- 
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]