]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: prepare for plugin-based frr_format check
authorDavid Lamparter <equinox@diac24.net>
Fri, 2 Aug 2019 15:42:06 +0000 (17:42 +0200)
committerDavid Lamparter <equinox@diac24.net>
Sun, 29 Mar 2020 08:45:46 +0000 (10:45 +0200)
Signed-off-by: David Lamparter <equinox@diac24.net>
bgpd/bgp_table.h
lib/agg_table.h
lib/compiler.h
lib/nexthop.h
lib/prefix.h
lib/printfrr.h
lib/table.h
zebra/zebra_rib.c

index 8153ddcd305a73929379ba346aac2a01f87de5d0..da2ca3181a7f09abcc64823f7b828774232c9e2e 100644 (file)
@@ -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 */
index 9fddc975edf81dc6d70b6bef6b81d8848a29b3ee..e98476f1b7d3e0cda389daa41c866194dcc97177 100644 (file)
@@ -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
index e430925e69723a10c3c2e362bfdad38b0cf93d06..217a60d8881651796b848deea65066dcbd04559f 100644 (file)
@@ -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)))
index 6710914e40bd158f2dc63f2d795484b3bc595a81..267f9f28ada7195e47261af97dde224159eb89b8 100644 (file)
@@ -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
index 51b3dacb8d0b26c8ebdf87740a1c7c9ad735b1a5..f2952c38c3710cf36b85945cd1ba3856f09c83f8 100644 (file)
@@ -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
index f9584bcacc921e16576fab8acb002b452cf51824..6fcfbe31fab3a15311f5ddc7d7badb54b0d3b8a1 100644 (file)
@@ -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.)
index 7743d51681ade02a3d57bafe4339585e2d5d3179..9cd950337607947ede53dac465ec5250a7b6a16a 100644 (file)
@@ -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
index 29d59b515fbdda87929d606200f31d713e2fdd32..dc54dee78518d06e344abc544a44974f4abdf0bb 100644 (file)
@@ -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, ...)
 {