[libvirt] [RFC PATCH] build: consistently use C99 varargs macros
Daniel P. Berrange
berrange at redhat.com
Mon Mar 1 17:24:22 UTC 2010
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 :|
More information about the libvir-list
mailing list