
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@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