From 65d6a1df03c5a38d30a08477a10f11a12f87de8c Mon Sep 17 00:00:00 2001 From: Jonathon Jongsma Date: Tue, 18 Jun 2019 11:12:53 -0500 Subject: [PATCH] util: log: use #pragma once in headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathon Jongsma Reviewed-by: Ján Tomko Signed-off-by: Ján Tomko --- src/util/virlog.h | 55 ++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/src/util/virlog.h b/src/util/virlog.h index 775a726b06..a30b760fb4 100644 --- a/src/util/virlog.h +++ b/src/util/virlog.h @@ -19,24 +19,23 @@ * */ -#ifndef LIBVIRT_VIRLOG_H -# define LIBVIRT_VIRLOG_H +#pragma once -# include "internal.h" -# include "virbuffer.h" +#include "internal.h" +#include "virbuffer.h" -# ifdef PACKAGER_VERSION -# ifdef PACKAGER -# define VIR_LOG_VERSION_STRING \ +#ifdef PACKAGER_VERSION +# ifdef PACKAGER +# define VIR_LOG_VERSION_STRING \ "libvirt version: " VERSION ", package: " PACKAGER_VERSION " (" PACKAGER ")" -# else -# define VIR_LOG_VERSION_STRING \ - "libvirt version: " VERSION ", package: " PACKAGER_VERSION -# endif # else # define VIR_LOG_VERSION_STRING \ - "libvirt version: " VERSION + "libvirt version: " VERSION ", package: " PACKAGER_VERSION # endif +#else +# define VIR_LOG_VERSION_STRING \ + "libvirt version: " VERSION +#endif /* * To be made public @@ -48,7 +47,7 @@ typedef enum { VIR_LOG_ERROR, } virLogPriority; -# define VIR_LOG_DEFAULT VIR_LOG_WARN +#define VIR_LOG_DEFAULT VIR_LOG_WARN typedef enum { VIR_LOG_TO_STDERR = 0, @@ -73,7 +72,7 @@ struct _virLogSource { * log statements in a file are conditionally disabled * at compile time due to configure options. */ -# define VIR_LOG_INIT(n) \ +#define VIR_LOG_INIT(n) \ static ATTRIBUTE_UNUSED virLogSource virLogSelf = { \ .name = "" n "", \ .priority = VIR_LOG_ERROR, \ @@ -86,10 +85,10 @@ struct _virLogSource { * are printed to stderr for debugging or to an appropriate channel * defined at runtime from the libvirt daemon configuration file */ -# ifdef ENABLE_DEBUG -# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ +#ifdef ENABLE_DEBUG +# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ virLogMessage(src, VIR_LOG_DEBUG, filename, linenr, funcname, NULL, __VA_ARGS__) -# else +#else /** * virLogEatParams: * @@ -100,24 +99,24 @@ static inline void virLogEatParams(virLogSourcePtr unused, ...) /* Silence gcc */ unused = unused; } -# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ +# define VIR_DEBUG_INT(src, filename, linenr, funcname, ...) \ virLogEatParams(src, filename, linenr, funcname, __VA_ARGS__) -# endif /* !ENABLE_DEBUG */ +#endif /* !ENABLE_DEBUG */ -# define VIR_INFO_INT(src, filename, linenr, funcname, ...) \ +#define VIR_INFO_INT(src, filename, linenr, funcname, ...) \ virLogMessage(src, VIR_LOG_INFO, filename, linenr, funcname, NULL, __VA_ARGS__) -# define VIR_WARN_INT(src, filename, linenr, funcname, ...) \ +#define VIR_WARN_INT(src, filename, linenr, funcname, ...) \ virLogMessage(src, VIR_LOG_WARN, filename, linenr, funcname, NULL, __VA_ARGS__) -# define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \ +#define VIR_ERROR_INT(src, filename, linenr, funcname, ...) \ virLogMessage(src, VIR_LOG_ERROR, filename, linenr, funcname, NULL, __VA_ARGS__) -# define VIR_DEBUG(...) \ - VIR_DEBUG_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__) -# define VIR_INFO(...) \ +#define VIR_DEBUG(...) \ + VIR_DEBUG_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__) +#define VIR_INFO(...) \ VIR_INFO_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__) -# define VIR_WARN(...) \ +#define VIR_WARN(...) \ VIR_WARN_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__) -# define VIR_ERROR(...) \ +#define VIR_ERROR(...) \ VIR_ERROR_INT(&virLogSelf, __FILE__, __LINE__, __func__, __VA_ARGS__) @@ -238,5 +237,3 @@ int virLogParseOutputs(const char *src, virLogOutputPtr **outputs) ATTRIBUTE_NONNULL(1); int virLogParseFilters(const char *src, virLogFilterPtr **filters) ATTRIBUTE_NONNULL(1); - -#endif /* LIBVIRT_VIRLOG_H */ -- GitLab