forked from Mirror/frr
lib: prepare for plugin-based frr_format check
Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
47466c571f
commit
07ef3e34ae
|
@ -448,4 +448,8 @@ static inline const struct prefix *bgp_node_get_prefix(struct bgp_node *node)
|
|||
return &node->p;
|
||||
}
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#pragma FRR printfrr_ext "%pRN" (struct bgp_node *)
|
||||
#endif
|
||||
|
||||
#endif /* _QUAGGA_BGP_TABLE_H */
|
||||
|
|
|
@ -161,6 +161,10 @@ agg_node_get_prefix(const struct agg_node *node)
|
|||
return &node->p;
|
||||
}
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#pragma FRR printfrr_ext "%pRN" (struct agg_node *)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -305,7 +305,14 @@ extern "C" {
|
|||
#include <inttypes.h>
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#define PRINTFRR(a, b) __attribute__((printfrr(a, b)))
|
||||
#define PRINTFRR(a, b) __attribute__((frr_format("frr_printf", a, b)))
|
||||
|
||||
#undef PRIu64
|
||||
#undef PRId64
|
||||
#undef PRIx64
|
||||
#define PRIu64 "Lu"
|
||||
#define PRId64 "Ld"
|
||||
#define PRIx64 "Lx"
|
||||
|
||||
#else /* !_FRR_ATTRIBUTE_PRINTFRR */
|
||||
#define PRINTFRR(a, b) __attribute__((format(printf, a, b)))
|
||||
|
|
|
@ -201,6 +201,10 @@ extern struct nexthop *nexthop_dup(const struct nexthop *nexthop,
|
|||
extern struct nexthop *nexthop_dup_no_recurse(const struct nexthop *nexthop,
|
||||
struct nexthop *rparent);
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#pragma FRR printfrr_ext "%pNH" (struct nexthop *)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
16
lib/prefix.h
16
lib/prefix.h
|
@ -544,6 +544,22 @@ static inline int is_default_host_route(const struct prefix *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#pragma FRR printfrr_ext "%pI4" (struct in_addr *)
|
||||
#pragma FRR printfrr_ext "%pI4" (in_addr_t *)
|
||||
|
||||
#pragma FRR printfrr_ext "%pI6" (struct in6_addr *)
|
||||
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix *)
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix_ipv4 *)
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix_ipv6 *)
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix_eth *)
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix_evpn *)
|
||||
#pragma FRR printfrr_ext "%pFX" (struct prefix_fs *)
|
||||
|
||||
#pragma FRR printfrr_ext "%pSG4" (struct prefix_sg *)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -31,7 +31,7 @@ struct fbuf {
|
|||
};
|
||||
|
||||
#define at(a, b) \
|
||||
__attribute__((format(printf, a, b)))
|
||||
PRINTFRR(a, b)
|
||||
#define atn(a, b) \
|
||||
at(a, b) __attribute__((nonnull(1) _RET_NONNULL))
|
||||
#define atm(a, b) \
|
||||
|
@ -75,6 +75,7 @@ char *asnprintfrr(struct memtype *mt, char *out, size_t sz,
|
|||
|
||||
#undef at
|
||||
#undef atm
|
||||
#undef atn
|
||||
|
||||
/* extension specs must start with a capital letter (this is a restriction
|
||||
* for both performance's and human understanding's sake.)
|
||||
|
|
|
@ -331,6 +331,10 @@ static inline int route_table_iter_started(route_table_iter_t *iter)
|
|||
return iter->state != RT_ITER_STATE_INIT;
|
||||
}
|
||||
|
||||
#ifdef _FRR_ATTRIBUTE_PRINTFRR
|
||||
#pragma FRR printfrr_ext "%pRN" (struct route_node *)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -112,7 +112,7 @@ static const struct {
|
|||
/* no entry/default: 150 */
|
||||
};
|
||||
|
||||
static void __attribute__((format(printf, 5, 6)))
|
||||
static void PRINTFRR(5, 6)
|
||||
_rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
|
||||
int priority, const char *msgfmt, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue