mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-12 00:16:05 -06:00
build: avoid gcc preprocessor extensions
Use of ',##__VA_ARGS__' is a gcc extension not guaranteed by C99; thankfully, we can avoid it by lumping the format argument into the var-args set. * src/util/logging.h (VIR_DEBUG_INT, VIR_INFO_INT, VIR_WARN_INT) (VIR_ERROR_INT, VIR_DEBUG, VIR_INFO, VIR_WARN, VIR_ERROR): Stick to C99 var-arg macro syntax. * examples/domain-events/events-c/event-test.c (VIR_DEBUG): Simplify.
This commit is contained in:
parent
b65f37a4a1
commit
bc6bfeaa17
@ -8,8 +8,7 @@
|
|||||||
#include <libvirt/libvirt.h>
|
#include <libvirt/libvirt.h>
|
||||||
#include <libvirt/virterror.h>
|
#include <libvirt/virterror.h>
|
||||||
|
|
||||||
#define VIR_DEBUG(fmt, ...) printf("%s:%d: " fmt "\n", \
|
#define VIR_DEBUG(fmt) printf("%s:%d: " fmt "\n", __func__, __LINE__)
|
||||||
__func__, __LINE__, ##__VA_ARGS__)
|
|
||||||
#define STREQ(a,b) (strcmp(a,b) == 0)
|
#define STREQ(a,b) (strcmp(a,b) == 0)
|
||||||
|
|
||||||
#ifndef ATTRIBUTE_UNUSED
|
#ifndef ATTRIBUTE_UNUSED
|
||||||
|
@ -31,28 +31,28 @@
|
|||||||
* defined at runtime from the libvirt daemon configuration file
|
* defined at runtime from the libvirt daemon configuration file
|
||||||
*/
|
*/
|
||||||
# ifdef ENABLE_DEBUG
|
# ifdef ENABLE_DEBUG
|
||||||
# define VIR_DEBUG_INT(category, f, l, fmt,...) \
|
# define VIR_DEBUG_INT(category, f, l, ...) \
|
||||||
virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, fmt, ##__VA_ARGS__)
|
virLogMessage(category, VIR_LOG_DEBUG, f, l, 0, __VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define VIR_DEBUG_INT(category, f, l, fmt,...) \
|
# define VIR_DEBUG_INT(category, f, l, ...) \
|
||||||
do { } while (0)
|
do { } while (0)
|
||||||
# endif /* !ENABLE_DEBUG */
|
# endif /* !ENABLE_DEBUG */
|
||||||
|
|
||||||
# define VIR_INFO_INT(category, f, l, fmt,...) \
|
# define VIR_INFO_INT(category, f, l, ...) \
|
||||||
virLogMessage(category, VIR_LOG_INFO, f, l, 0, fmt, ##__VA_ARGS__)
|
virLogMessage(category, VIR_LOG_INFO, f, l, 0, __VA_ARGS__)
|
||||||
# define VIR_WARN_INT(category, f, l, fmt,...) \
|
# define VIR_WARN_INT(category, f, l, ...) \
|
||||||
virLogMessage(category, VIR_LOG_WARN, f, l, 0, fmt, ##__VA_ARGS__)
|
virLogMessage(category, VIR_LOG_WARN, f, l, 0, __VA_ARGS__)
|
||||||
# define VIR_ERROR_INT(category, f, l, fmt,...) \
|
# define VIR_ERROR_INT(category, f, l, ...) \
|
||||||
virLogMessage(category, VIR_LOG_ERROR, f, l, 0, fmt, ##__VA_ARGS__)
|
virLogMessage(category, VIR_LOG_ERROR, f, l, 0, __VA_ARGS__)
|
||||||
|
|
||||||
# define VIR_DEBUG(fmt,...) \
|
# define VIR_DEBUG(...) \
|
||||||
VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
|
VIR_DEBUG_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||||
# define VIR_INFO(fmt,...) \
|
# define VIR_INFO(...) \
|
||||||
VIR_INFO_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
|
VIR_INFO_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||||
# define VIR_WARN(fmt,...) \
|
# define VIR_WARN(...) \
|
||||||
VIR_WARN_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
|
VIR_WARN_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||||
# define VIR_ERROR(fmt,...) \
|
# define VIR_ERROR(...) \
|
||||||
VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, fmt, ##__VA_ARGS__)
|
VIR_ERROR_INT("file." __FILE__, __func__, __LINE__, __VA_ARGS__)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To be made public
|
* To be made public
|
||||||
|
Loading…
Reference in New Issue
Block a user