[libvirt] [PATCH 5/7 v2] Add virLogSource variables to all source files
Eric Blake
eblake at redhat.com
Mon Mar 17 17:18:55 UTC 2014
On 03/10/2014 09:01 AM, Daniel P. Berrange wrote:
> Any source file which calls the logging APIs now needs
> to have a VIR_LOG_INIT("source.name") declaration at
> the start of the file. This provides a static variable
> of the virLogSource type.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> 230 files changed, 435 insertions(+), 48 deletions(-)
Big, but mostly mechanical, and the fact that it compiles is good.
>
> diff --git a/cfg.mk b/cfg.mk
> index 2a8957a..7d89515 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -1033,3 +1033,6 @@ exclude_file_name_regexp--sc_prohibit_int_ijk = \
>
> exclude_file_name_regexp--sc_prohibit_getenv = \
> ^tests/.*\.[ch]$$
> +
> +exclude_file_name_regexp--sc_avoid_attribute_unused_in_header = \
> + ^src/util/virlog\.h$$
Yeah, I can see where that comes from.
> +++ b/src/util/virlog.h
> @@ -51,7 +51,15 @@ struct _virLogSource {
> const char *name;
> };
>
> -extern virLogSource virLogSelf;
> +/*
> + * ATTRIBUTE_UNUSED is to make gcc keep quiet if all the
> + * log statements in a file are conditionally disabled
> + * at compile time due to configure options.
> + */
> +# define VIR_LOG_INIT(n) \
> + static ATTRIBUTE_UNUSED virLogSource virLogSelf = { \
> + .name = "" n "", \
> + };
>
ACK
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140317/d7349447/attachment-0001.sig>
More information about the libvir-list
mailing list