mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: virprobe.h: use #pragma once in headers
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
5f7b3e0f24
commit
e7bacd3db9
@ -19,17 +19,16 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBVIRT_VIRPROBE_H
|
#pragma once
|
||||||
# define LIBVIRT_VIRPROBE_H
|
|
||||||
|
|
||||||
# include "internal.h"
|
#include "internal.h"
|
||||||
# include "virlog.h"
|
#include "virlog.h"
|
||||||
|
|
||||||
# if WITH_DTRACE_PROBES
|
#if WITH_DTRACE_PROBES
|
||||||
# ifndef LIBVIRT_PROBES_H
|
# ifndef LIBVIRT_PROBES_H
|
||||||
# define LIBVIRT_PROBES_H
|
# define LIBVIRT_PROBES_H
|
||||||
# include "libvirt_probes.h"
|
# include "libvirt_probes.h"
|
||||||
# endif /* LIBVIRT_PROBES_H */
|
# endif /* LIBVIRT_PROBES_H */
|
||||||
|
|
||||||
/* Systemtap 1.2 headers have a bug where they cannot handle a
|
/* Systemtap 1.2 headers have a bug where they cannot handle a
|
||||||
* variable declared with array type. Work around this by casting all
|
* variable declared with array type. Work around this by casting all
|
||||||
@ -39,50 +38,50 @@
|
|||||||
* hopefully, if we ever add a call to PROBE with other than 9
|
* hopefully, if we ever add a call to PROBE with other than 9
|
||||||
* end arguments, you can figure out the pattern to extend this hack.
|
* end arguments, you can figure out the pattern to extend this hack.
|
||||||
*/
|
*/
|
||||||
# define VIR_COUNT_ARGS(...) VIR_ARG11(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
|
# define VIR_COUNT_ARGS(...) VIR_ARG11(__VA_ARGS__, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1)
|
||||||
# define VIR_ARG11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) _11
|
# define VIR_ARG11(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, ...) _11
|
||||||
# define VIR_ADD_CAST_EXPAND(a, b, ...) VIR_ADD_CAST_PASTE(a, b, __VA_ARGS__)
|
# define VIR_ADD_CAST_EXPAND(a, b, ...) VIR_ADD_CAST_PASTE(a, b, __VA_ARGS__)
|
||||||
# define VIR_ADD_CAST_PASTE(a, b, ...) a##b(__VA_ARGS__)
|
# define VIR_ADD_CAST_PASTE(a, b, ...) a##b(__VA_ARGS__)
|
||||||
|
|
||||||
/* The double cast is necessary to silence gcc warnings; any pointer
|
/* The double cast is necessary to silence gcc warnings; any pointer
|
||||||
* can safely go to intptr_t and back to void *, which collapses
|
* can safely go to intptr_t and back to void *, which collapses
|
||||||
* arrays into pointers; while any integer can be widened to intptr_t
|
* arrays into pointers; while any integer can be widened to intptr_t
|
||||||
* then cast to void *. */
|
* then cast to void *. */
|
||||||
# define VIR_ADD_CAST(a) ((void *)(intptr_t)(a))
|
# define VIR_ADD_CAST(a) ((void *)(intptr_t)(a))
|
||||||
# define VIR_ADD_CAST1(a) \
|
# define VIR_ADD_CAST1(a) \
|
||||||
VIR_ADD_CAST(a)
|
VIR_ADD_CAST(a)
|
||||||
# define VIR_ADD_CAST2(a, b) \
|
# define VIR_ADD_CAST2(a, b) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b)
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b)
|
||||||
# define VIR_ADD_CAST3(a, b, c) \
|
# define VIR_ADD_CAST3(a, b, c) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c)
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c)
|
||||||
# define VIR_ADD_CAST4(a, b, c, d) \
|
# define VIR_ADD_CAST4(a, b, c, d) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d)
|
VIR_ADD_CAST(d)
|
||||||
# define VIR_ADD_CAST5(a, b, c, d, e) \
|
# define VIR_ADD_CAST5(a, b, c, d, e) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e)
|
VIR_ADD_CAST(d), VIR_ADD_CAST(e)
|
||||||
# define VIR_ADD_CAST6(a, b, c, d, e, f) \
|
# define VIR_ADD_CAST6(a, b, c, d, e, f) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f)
|
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f)
|
||||||
# define VIR_ADD_CAST7(a, b, c, d, e, f, g) \
|
# define VIR_ADD_CAST7(a, b, c, d, e, f, g) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||||
VIR_ADD_CAST(g)
|
VIR_ADD_CAST(g)
|
||||||
# define VIR_ADD_CAST8(a, b, c, d, e, f, g, h) \
|
# define VIR_ADD_CAST8(a, b, c, d, e, f, g, h) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||||
VIR_ADD_CAST(g), VIR_ADD_CAST(h)
|
VIR_ADD_CAST(g), VIR_ADD_CAST(h)
|
||||||
# define VIR_ADD_CAST9(a, b, c, d, e, f, g, h, i) \
|
# define VIR_ADD_CAST9(a, b, c, d, e, f, g, h, i) \
|
||||||
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
VIR_ADD_CAST(a), VIR_ADD_CAST(b), VIR_ADD_CAST(c), \
|
||||||
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
VIR_ADD_CAST(d), VIR_ADD_CAST(e), VIR_ADD_CAST(f), \
|
||||||
VIR_ADD_CAST(g), VIR_ADD_CAST(h), VIR_ADD_CAST(i)
|
VIR_ADD_CAST(g), VIR_ADD_CAST(h), VIR_ADD_CAST(i)
|
||||||
|
|
||||||
# define VIR_ADD_CASTS(...) \
|
# define VIR_ADD_CASTS(...) \
|
||||||
VIR_ADD_CAST_EXPAND(VIR_ADD_CAST, VIR_COUNT_ARGS(__VA_ARGS__), \
|
VIR_ADD_CAST_EXPAND(VIR_ADD_CAST, VIR_COUNT_ARGS(__VA_ARGS__), \
|
||||||
__VA_ARGS__)
|
__VA_ARGS__)
|
||||||
|
|
||||||
# define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
|
# define PROBE_EXPAND(NAME, ARGS) NAME(ARGS)
|
||||||
# define PROBE(NAME, FMT, ...) \
|
# define PROBE(NAME, FMT, ...) \
|
||||||
VIR_INFO_INT(&virLogSelf, \
|
VIR_INFO_INT(&virLogSelf, \
|
||||||
__FILE__, __LINE__, __func__, \
|
__FILE__, __LINE__, __func__, \
|
||||||
#NAME ": " FMT, __VA_ARGS__); \
|
#NAME ": " FMT, __VA_ARGS__); \
|
||||||
@ -91,18 +90,16 @@
|
|||||||
VIR_ADD_CASTS(__VA_ARGS__)); \
|
VIR_ADD_CASTS(__VA_ARGS__)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
# define PROBE_QUIET(NAME, FMT, ...) \
|
# define PROBE_QUIET(NAME, FMT, ...) \
|
||||||
if (LIBVIRT_ ## NAME ## _ENABLED()) { \
|
if (LIBVIRT_ ## NAME ## _ENABLED()) { \
|
||||||
PROBE_EXPAND(LIBVIRT_ ## NAME, \
|
PROBE_EXPAND(LIBVIRT_ ## NAME, \
|
||||||
VIR_ADD_CASTS(__VA_ARGS__)); \
|
VIR_ADD_CASTS(__VA_ARGS__)); \
|
||||||
}
|
}
|
||||||
# else
|
#else
|
||||||
# define PROBE(NAME, FMT, ...) \
|
# define PROBE(NAME, FMT, ...) \
|
||||||
VIR_INFO_INT(&virLogSelf, \
|
VIR_INFO_INT(&virLogSelf, \
|
||||||
__FILE__, __LINE__, __func__, \
|
__FILE__, __LINE__, __func__, \
|
||||||
#NAME ": " FMT, __VA_ARGS__);
|
#NAME ": " FMT, __VA_ARGS__);
|
||||||
|
|
||||||
# define PROBE_QUIET(NAME, FMT, ...)
|
# define PROBE_QUIET(NAME, FMT, ...)
|
||||||
# endif
|
#endif
|
||||||
|
|
||||||
#endif /* LIBVIRT_VIRPROBE_H */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user