diff options
author | David Lamparter <equinox@diac24.net> | 2021-02-21 06:18:10 +0100 |
---|---|---|
committer | David Lamparter <equinox@diac24.net> | 2021-03-17 06:18:17 +0100 |
commit | bf8d3d6aca3f20255a621ed1c148fd05b3a8ae5c (patch) | |
tree | cd62a7c64fe8eb9f3252e1b608f1fb939c2a772c /ripd | |
parent | *: require ISO C11 (or C++11) (diff) | |
download | frr-bf8d3d6aca3f20255a621ed1c148fd05b3a8ae5c.tar.xz frr-bf8d3d6aca3f20255a621ed1c148fd05b3a8ae5c.zip |
*: require semicolon after DEFINE_MTYPE & co
Back when I put this together in 2015, ISO C11 was still reasonably new
and we couldn't require it just yet. Without ISO C11, there is no
"good" way (only bad hacks) to require a semicolon after a macro that
ends with a function definition. And if you added one anyway, you'd get
"spurious semicolon" warnings on some compilers...
With C11, `_Static_assert()` at the end of a macro will make it so that
the semicolon is properly required, consumed, and not warned about.
Consistently requiring semicolons after "file-level" macros matches
Linux kernel coding style and helps some editors against mis-syntax'ing
these macros.
Signed-off-by: David Lamparter <equinox@diac24.net>
Diffstat (limited to 'ripd')
-rw-r--r-- | ripd/rip_interface.c | 4 | ||||
-rw-r--r-- | ripd/rip_interface.h | 2 | ||||
-rw-r--r-- | ripd/rip_offset.c | 2 | ||||
-rw-r--r-- | ripd/rip_peer.c | 2 | ||||
-rw-r--r-- | ripd/ripd.c | 10 | ||||
-rw-r--r-- | ripd/ripd.h | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 89e7e5dc1..c1cdf27bf 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -43,8 +43,8 @@ #include "ripd/rip_debug.h" #include "ripd/rip_interface.h" -DEFINE_MTYPE_STATIC(RIPD, RIP_INTERFACE, "RIP interface") -DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String") +DEFINE_MTYPE_STATIC(RIPD, RIP_INTERFACE, "RIP interface"); +DEFINE_MTYPE(RIPD, RIP_INTERFACE_STRING, "RIP Interface String"); DEFINE_HOOK(rip_ifaddr_add, (struct connected * ifc), (ifc)) DEFINE_HOOK(rip_ifaddr_del, (struct connected * ifc), (ifc)) diff --git a/ripd/rip_interface.h b/ripd/rip_interface.h index 715daf2e5..fe26a78bd 100644 --- a/ripd/rip_interface.h +++ b/ripd/rip_interface.h @@ -23,7 +23,7 @@ #include "memory.h" #include "zclient.h" -DECLARE_MTYPE(RIP_INTERFACE_STRING) +DECLARE_MTYPE(RIP_INTERFACE_STRING); extern int rip_interface_down(int, struct zclient *, zebra_size_t, vrf_id_t); extern int rip_interface_up(int, struct zclient *, zebra_size_t, vrf_id_t); diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c index 776f121d5..4034fe842 100644 --- a/ripd/rip_offset.c +++ b/ripd/rip_offset.c @@ -29,7 +29,7 @@ #include "ripd/ripd.h" -DEFINE_MTYPE_STATIC(RIPD, RIP_OFFSET_LIST, "RIP offset list") +DEFINE_MTYPE_STATIC(RIPD, RIP_OFFSET_LIST, "RIP offset list"); #define OFFSET_LIST_IN_NAME(O) ((O)->direct[RIP_OFFSET_LIST_IN].alist_name) #define OFFSET_LIST_IN_METRIC(O) ((O)->direct[RIP_OFFSET_LIST_IN].metric) diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c index 23599f087..63493e253 100644 --- a/ripd/rip_peer.c +++ b/ripd/rip_peer.c @@ -29,7 +29,7 @@ #include "ripd/ripd.h" -DEFINE_MTYPE_STATIC(RIPD, RIP_PEER, "RIP peer") +DEFINE_MTYPE_STATIC(RIPD, RIP_PEER, "RIP peer"); static struct rip_peer *rip_peer_new(void) { diff --git a/ripd/ripd.c b/ripd/ripd.c index 4a56efb6f..1c23575bf 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -56,11 +56,11 @@ /* UDP receive buffer size */ #define RIP_UDP_RCV_BUF 41600 -DEFINE_MGROUP(RIPD, "ripd") -DEFINE_MTYPE_STATIC(RIPD, RIP, "RIP structure") -DEFINE_MTYPE_STATIC(RIPD, RIP_VRF_NAME, "RIP VRF name") -DEFINE_MTYPE_STATIC(RIPD, RIP_INFO, "RIP route info") -DEFINE_MTYPE_STATIC(RIPD, RIP_DISTANCE, "RIP distance") +DEFINE_MGROUP(RIPD, "ripd"); +DEFINE_MTYPE_STATIC(RIPD, RIP, "RIP structure"); +DEFINE_MTYPE_STATIC(RIPD, RIP_VRF_NAME, "RIP VRF name"); +DEFINE_MTYPE_STATIC(RIPD, RIP_INFO, "RIP route info"); +DEFINE_MTYPE_STATIC(RIPD, RIP_DISTANCE, "RIP distance"); /* Prototypes. */ static void rip_output_process(struct connected *, struct sockaddr_in *, int, diff --git a/ripd/ripd.h b/ripd/ripd.h index 99718f7b9..97806abc8 100644 --- a/ripd/ripd.h +++ b/ripd/ripd.h @@ -97,7 +97,7 @@ #define RIP_INSTANCE "/frr-ripd:ripd/instance" #define RIP_IFACE "/frr-interface:lib/interface/frr-ripd:rip" -DECLARE_MGROUP(RIPD) +DECLARE_MGROUP(RIPD); /* RIP structure. */ struct rip { |