]> git.proxmox.com Git - mirror_frr.git/blame - nhrpd/debug.h
Merge pull request #5776 from volta-networks/fix_ldp_topol_test
[mirror_frr.git] / nhrpd / debug.h
CommitLineData
2fb975da
TT
1#include "log.h"
2
3#if defined(__GNUC__) && (__GNUC__ >= 3)
4#define likely(_x) __builtin_expect(!!(_x), 1)
5#define unlikely(_x) __builtin_expect(!!(_x), 0)
6#else
7#define likely(_x) !!(_x)
8#define unlikely(_x) !!(_x)
9#endif
10
11#define NHRP_DEBUG_COMMON (1 << 0)
12#define NHRP_DEBUG_KERNEL (1 << 1)
13#define NHRP_DEBUG_IF (1 << 2)
14#define NHRP_DEBUG_ROUTE (1 << 3)
15#define NHRP_DEBUG_VICI (1 << 4)
16#define NHRP_DEBUG_EVENT (1 << 5)
17#define NHRP_DEBUG_ALL (0xFFFF)
18
19extern unsigned int debug_flags;
20
21#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
22
996c9314
LB
23#define debugf(level, ...) \
24 do { \
25 if (unlikely(debug_flags & level)) \
26 zlog_debug(__VA_ARGS__); \
27 } while (0)
2fb975da
TT
28
29#elif defined __GNUC__
30
996c9314
LB
31#define debugf(level, _args...) \
32 do { \
33 if (unlikely(debug_flags & level)) \
34 zlog_debug(_args); \
35 } while (0)
2fb975da
TT
36
37#else
38
996c9314
LB
39static inline void debugf(int level, const char *format, ...)
40{
41}
2fb975da
TT
42
43#endif