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

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. * src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU vararg macro syntax. * src/conf/domain_conf.c (virDomainReportError): Likewise. * src/conf/domain_event.c (eventReportError): Likewise. * src/conf/interface_conf.c (virInterfaceReportError): Likewise. * src/conf/network_conf.c (virNetworkReportError): Likewise. * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise. * src/conf/secret_conf.h (virSecretReportError): Likewise. * src/conf/storage_conf.h (virStorageReportError): Likewise. --- Any objections to expanding this into a full-blown patch series? This touches 8 files; I counted 43 more files that could be altered, using: $ git grep -l 'define.*[a-zA-Z]\.\.\.' src/conf/cpu_conf.c | 4 ++-- src/conf/domain_conf.c | 4 ++-- src/conf/domain_event.c | 5 +++-- src/conf/interface_conf.c | 4 ++-- src/conf/network_conf.c | 6 +++--- src/conf/node_device_conf.h | 5 +++-- src/conf/secret_conf.h | 6 +++--- src/conf/storage_conf.h | 6 +++--- 8 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index ed83188..612e376 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -31,9 +31,9 @@ #define VIR_FROM_THIS VIR_FROM_CPU -#define virCPUReportError(code, fmt...) \ +#define virCPUReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST, "minimum", diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4420445..ea84863 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -232,9 +232,9 @@ VIR_ENUM_IMPL(virDomainNetdevMacvtap, VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST, "private", "bridge") -#define virDomainReportError(code, fmt...) \ +#define virDomainReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) #ifndef PROXY diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index b474b1c..e791cab 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -1,6 +1,7 @@ /* * domain_event.c: domain event queue processing helpers * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 VirtualIron * * This library is free software; you can redistribute it and/or @@ -30,9 +31,9 @@ #define VIR_FROM_THIS VIR_FROM_NONE -#define eventReportError(conn, code, fmt...) \ +#define eventReportError(conn, code, ...) \ virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) /** diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index a0d2dfa..bc9e958 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -45,9 +45,9 @@ static int virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDefPtr def, int level); -#define virInterfaceReportError(code, fmt...) \ +#define virInterfaceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) static void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 6d3c3c0..39ebd62 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1,7 +1,7 @@ /* * network_conf.c: network XML handling * - * Copyright (C) 2006-2009 Red Hat, Inc. + * Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -53,9 +53,9 @@ VIR_ENUM_IMPL(virNetworkForward, VIR_NETWORK_FORWARD_LAST, "none", "nat", "route" ) -#define virNetworkReportError(code, fmt...) \ +#define virNetworkReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, const unsigned char *uuid) diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 3a5432c..cbaad9b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -1,6 +1,7 @@ /* * node_device_conf.h: config handling for node devices * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 Virtual Iron Software, Inc. * Copyright (C) 2008 David F. Lively * @@ -217,9 +218,9 @@ struct _virDeviceMonitorState { void *privateData; /* driver-specific private data */ }; -#define virNodeDeviceReportError(code, fmt...) \ +#define virNodeDeviceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap); diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h index da00920..afcf8f1 100644 --- a/src/conf/secret_conf.h +++ b/src/conf/secret_conf.h @@ -1,7 +1,7 @@ /* * secret_conf.h: internal <secret> XML handling API * - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009-2010 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,9 +26,9 @@ #include "internal.h" #include "util.h" -#define virSecretReportError(code, fmt...) \ +#define virSecretReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__) VIR_ENUM_DECL(virSecretUsageType) diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index c643984..5441c8e 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -1,7 +1,7 @@ /* * storage_conf.h: config handling for storage driver * - * Copyright (C) 2006-2008 Red Hat, Inc. + * Copyright (C) 2006-2008, 2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -318,9 +318,9 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) { return pool->active; } -#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, -- 1.6.6.1

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.
* src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU vararg macro syntax. * src/conf/domain_conf.c (virDomainReportError): Likewise. * src/conf/domain_event.c (eventReportError): Likewise. * src/conf/interface_conf.c (virInterfaceReportError): Likewise. * src/conf/network_conf.c (virNetworkReportError): Likewise. * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise. * src/conf/secret_conf.h (virSecretReportError): Likewise. * src/conf/storage_conf.h (virStorageReportError): Likewise. ---
Any objections to expanding this into a full-blown patch series? This touches 8 files; I counted 43 more files that could be altered, using: $ git grep -l 'define.*[a-zA-Z]\.\.\.'
src/conf/cpu_conf.c | 4 ++-- src/conf/domain_conf.c | 4 ++-- src/conf/domain_event.c | 5 +++-- src/conf/interface_conf.c | 4 ++-- src/conf/network_conf.c | 6 +++--- src/conf/node_device_conf.h | 5 +++-- src/conf/secret_conf.h | 6 +++--- src/conf/storage_conf.h | 6 +++--- 8 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index ed83188..612e376 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -31,9 +31,9 @@
#define VIR_FROM_THIS VIR_FROM_CPU
-#define virCPUReportError(code, fmt...) \ +#define virCPUReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST, "minimum", diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4420445..ea84863 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -232,9 +232,9 @@ VIR_ENUM_IMPL(virDomainNetdevMacvtap, VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST, "private", "bridge")
-#define virDomainReportError(code, fmt...) \ +#define virDomainReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
#ifndef PROXY
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index b474b1c..e791cab 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -1,6 +1,7 @@ /* * domain_event.c: domain event queue processing helpers * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 VirtualIron * * This library is free software; you can redistribute it and/or @@ -30,9 +31,9 @@
#define VIR_FROM_THIS VIR_FROM_NONE
-#define eventReportError(conn, code, fmt...) \ +#define eventReportError(conn, code, ...) \ virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
/** diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index a0d2dfa..bc9e958 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -45,9 +45,9 @@ static int virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDefPtr def, int level);
-#define virInterfaceReportError(code, fmt...) \ +#define virInterfaceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
static void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 6d3c3c0..39ebd62 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1,7 +1,7 @@ /* * network_conf.c: network XML handling * - * Copyright (C) 2006-2009 Red Hat, Inc. + * Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -53,9 +53,9 @@ VIR_ENUM_IMPL(virNetworkForward, VIR_NETWORK_FORWARD_LAST, "none", "nat", "route" )
-#define virNetworkReportError(code, fmt...) \ +#define virNetworkReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, const unsigned char *uuid) diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 3a5432c..cbaad9b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -1,6 +1,7 @@ /* * node_device_conf.h: config handling for node devices * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 Virtual Iron Software, Inc. * Copyright (C) 2008 David F. Lively * @@ -217,9 +218,9 @@ struct _virDeviceMonitorState { void *privateData; /* driver-specific private data */ };
-#define virNodeDeviceReportError(code, fmt...) \ +#define virNodeDeviceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap);
diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h index da00920..afcf8f1 100644 --- a/src/conf/secret_conf.h +++ b/src/conf/secret_conf.h @@ -1,7 +1,7 @@ /* * secret_conf.h: internal <secret> XML handling API * - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009-2010 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,9 +26,9 @@ #include "internal.h" #include "util.h"
-#define virSecretReportError(code, fmt...) \ +#define virSecretReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
VIR_ENUM_DECL(virSecretUsageType)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index c643984..5441c8e 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -1,7 +1,7 @@ /* * storage_conf.h: config handling for storage driver * - * Copyright (C) 2006-2008 Red Hat, Inc. + * Copyright (C) 2006-2008, 2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -318,9 +318,9 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) { return pool->active; }
-#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 :-) thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Mon, Mar 01, 2010 at 06:13:45PM +0100, Daniel Veillard wrote:
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.
* src/conf/cpu_conf.c (virCPUReportError): Use C99 rather than GNU vararg macro syntax. * src/conf/domain_conf.c (virDomainReportError): Likewise. * src/conf/domain_event.c (eventReportError): Likewise. * src/conf/interface_conf.c (virInterfaceReportError): Likewise. * src/conf/network_conf.c (virNetworkReportError): Likewise. * src/conf/node_device_conf.h (virNodeDeviceReportError): Likewise. * src/conf/secret_conf.h (virSecretReportError): Likewise. * src/conf/storage_conf.h (virStorageReportError): Likewise. ---
Any objections to expanding this into a full-blown patch series? This touches 8 files; I counted 43 more files that could be altered, using: $ git grep -l 'define.*[a-zA-Z]\.\.\.'
src/conf/cpu_conf.c | 4 ++-- src/conf/domain_conf.c | 4 ++-- src/conf/domain_event.c | 5 +++-- src/conf/interface_conf.c | 4 ++-- src/conf/network_conf.c | 6 +++--- src/conf/node_device_conf.h | 5 +++-- src/conf/secret_conf.h | 6 +++--- src/conf/storage_conf.h | 6 +++--- 8 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index ed83188..612e376 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -31,9 +31,9 @@
#define VIR_FROM_THIS VIR_FROM_CPU
-#define virCPUReportError(code, fmt...) \ +#define virCPUReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_CPU, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
VIR_ENUM_IMPL(virCPUMatch, VIR_CPU_MATCH_LAST, "minimum", diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4420445..ea84863 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -232,9 +232,9 @@ VIR_ENUM_IMPL(virDomainNetdevMacvtap, VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST, "private", "bridge")
-#define virDomainReportError(code, fmt...) \ +#define virDomainReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_DOMAIN, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
#ifndef PROXY
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index b474b1c..e791cab 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -1,6 +1,7 @@ /* * domain_event.c: domain event queue processing helpers * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 VirtualIron * * This library is free software; you can redistribute it and/or @@ -30,9 +31,9 @@
#define VIR_FROM_THIS VIR_FROM_NONE
-#define eventReportError(conn, code, fmt...) \ +#define eventReportError(conn, code, ...) \ virReportErrorHelper(conn, VIR_FROM_THIS, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
/** diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index a0d2dfa..bc9e958 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -45,9 +45,9 @@ static int virInterfaceDefDevFormat(virBufferPtr buf, const virInterfaceDefPtr def, int level);
-#define virInterfaceReportError(code, fmt...) \ +#define virInterfaceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_INTERFACE, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
static void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index 6d3c3c0..39ebd62 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1,7 +1,7 @@ /* * network_conf.c: network XML handling * - * Copyright (C) 2006-2009 Red Hat, Inc. + * Copyright (C) 2006-2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -53,9 +53,9 @@ VIR_ENUM_IMPL(virNetworkForward, VIR_NETWORK_FORWARD_LAST, "none", "nat", "route" )
-#define virNetworkReportError(code, fmt...) \ +#define virNetworkReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NETWORK, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, const unsigned char *uuid) diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h index 3a5432c..cbaad9b 100644 --- a/src/conf/node_device_conf.h +++ b/src/conf/node_device_conf.h @@ -1,6 +1,7 @@ /* * node_device_conf.h: config handling for node devices * + * Copyright (C) 2010 Red Hat, Inc. * Copyright (C) 2008 Virtual Iron Software, Inc. * Copyright (C) 2008 David F. Lively * @@ -217,9 +218,9 @@ struct _virDeviceMonitorState { void *privateData; /* driver-specific private data */ };
-#define virNodeDeviceReportError(code, fmt...) \ +#define virNodeDeviceReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_NODEDEV, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
int virNodeDeviceHasCap(const virNodeDeviceObjPtr dev, const char *cap);
diff --git a/src/conf/secret_conf.h b/src/conf/secret_conf.h index da00920..afcf8f1 100644 --- a/src/conf/secret_conf.h +++ b/src/conf/secret_conf.h @@ -1,7 +1,7 @@ /* * secret_conf.h: internal <secret> XML handling API * - * Copyright (C) 2009 Red Hat, Inc. + * Copyright (C) 2009-2010 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -26,9 +26,9 @@ #include "internal.h" #include "util.h"
-#define virSecretReportError(code, fmt...) \ +#define virSecretReportError(code, ...) \ virReportErrorHelper(NULL, VIR_FROM_SECRET, code, __FILE__, \ - __FUNCTION__, __LINE__, fmt) + __FUNCTION__, __LINE__, __VA_ARGS__)
VIR_ENUM_DECL(virSecretUsageType)
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index c643984..5441c8e 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -1,7 +1,7 @@ /* * storage_conf.h: config handling for storage driver * - * Copyright (C) 2006-2008 Red Hat, Inc. + * Copyright (C) 2006-2008, 2010 Red Hat, Inc. * Copyright (C) 2006-2008 Daniel P. Berrange * * This library is free software; you can redistribute it and/or @@ -318,9 +318,9 @@ static inline int virStoragePoolObjIsActive(virStoragePoolObjPtr pool) { return pool->active; }
-#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 == gcc built as a cross-compiler, so there's no issue there. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On 03/01/2010 06:24 PM, Daniel P. Berrange wrote:
mingw == gcc built as a cross-compiler, so there's no issue there.
Unfortunately, _native_ mingw (i.e. building under MSYS) uses a hideously old version of GCC (3.4.x), so it's not always a non-issue. But it is fine in this case: http://gcc.gnu.org/onlinedocs/gcc-3.4.6/cpp/Variadic-Macros.html Paolo

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@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (4)
-
Daniel P. Berrange
-
Daniel Veillard
-
Eric Blake
-
Paolo Bonzini