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 /bfdd | |
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 'bfdd')
-rw-r--r-- | bfdd/bfd.c | 8 | ||||
-rw-r--r-- | bfdd/bfd.h | 6 | ||||
-rw-r--r-- | bfdd/bfdd.c | 6 | ||||
-rw-r--r-- | bfdd/config.c | 2 | ||||
-rw-r--r-- | bfdd/dplane.c | 3 |
5 files changed, 13 insertions, 12 deletions
diff --git a/bfdd/bfd.c b/bfdd/bfd.c index 3cbb3691e..5c8a68f6c 100644 --- a/bfdd/bfd.c +++ b/bfdd/bfd.c @@ -32,10 +32,10 @@ #include "bfd.h" -DEFINE_MTYPE_STATIC(BFDD, BFDD_CONFIG, "long-lived configuration memory") -DEFINE_MTYPE_STATIC(BFDD, BFDD_PROFILE, "long-lived profile memory") -DEFINE_MTYPE_STATIC(BFDD, BFDD_SESSION_OBSERVER, "Session observer") -DEFINE_MTYPE_STATIC(BFDD, BFDD_VRF, "BFD VRF") +DEFINE_MTYPE_STATIC(BFDD, BFDD_CONFIG, "long-lived configuration memory"); +DEFINE_MTYPE_STATIC(BFDD, BFDD_PROFILE, "long-lived profile memory"); +DEFINE_MTYPE_STATIC(BFDD, BFDD_SESSION_OBSERVER, "Session observer"); +DEFINE_MTYPE_STATIC(BFDD, BFDD_VRF, "BFD VRF"); /* * Prototypes diff --git a/bfdd/bfd.h b/bfdd/bfd.h index 7c537b40d..b48ae304a 100644 --- a/bfdd/bfd.h +++ b/bfdd/bfd.h @@ -41,9 +41,9 @@ #define BFDD_JSON_CONV_OPTIONS (0) #endif -DECLARE_MGROUP(BFDD) -DECLARE_MTYPE(BFDD_CONTROL) -DECLARE_MTYPE(BFDD_NOTIFICATION) +DECLARE_MGROUP(BFDD); +DECLARE_MTYPE(BFDD_CONTROL); +DECLARE_MTYPE(BFDD_NOTIFICATION); struct bfd_timers { uint32_t desired_min_tx; diff --git a/bfdd/bfdd.c b/bfdd/bfdd.c index 0cac99010..0285e63d6 100644 --- a/bfdd/bfdd.c +++ b/bfdd/bfdd.c @@ -41,9 +41,9 @@ /* * FRR related code. */ -DEFINE_MGROUP(BFDD, "Bidirectional Forwarding Detection Daemon") -DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory") -DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data") +DEFINE_MGROUP(BFDD, "Bidirectional Forwarding Detection Daemon"); +DEFINE_MTYPE(BFDD, BFDD_CONTROL, "long-lived control socket memory"); +DEFINE_MTYPE(BFDD, BFDD_NOTIFICATION, "short-lived control notification data"); /* Master of threads. */ struct thread_master *master; diff --git a/bfdd/config.c b/bfdd/config.c index b71670f01..41baa8c71 100644 --- a/bfdd/config.c +++ b/bfdd/config.c @@ -30,7 +30,7 @@ #include "bfd.h" -DEFINE_MTYPE_STATIC(BFDD, BFDD_LABEL, "long-lived label memory") +DEFINE_MTYPE_STATIC(BFDD, BFDD_LABEL, "long-lived label memory"); /* * Definitions diff --git a/bfdd/dplane.c b/bfdd/dplane.c index 66b79f3b1..20ef06da8 100644 --- a/bfdd/dplane.c +++ b/bfdd/dplane.c @@ -46,7 +46,8 @@ #include "lib/openbsd-queue.h" -DEFINE_MTYPE_STATIC(BFDD, BFDD_DPLANE_CTX, "Data plane client allocated memory") +DEFINE_MTYPE_STATIC(BFDD, BFDD_DPLANE_CTX, + "Data plane client allocated memory"); /** Data plane client socket buffer size. */ #define BFD_DPLANE_CLIENT_BUF_SIZE 8192 |