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 /sharpd | |
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 'sharpd')
-rw-r--r-- | sharpd/sharp_globals.h | 2 | ||||
-rw-r--r-- | sharpd/sharp_main.c | 2 | ||||
-rw-r--r-- | sharpd/sharp_nht.c | 4 |
3 files changed, 4 insertions, 4 deletions
diff --git a/sharpd/sharp_globals.h b/sharpd/sharp_globals.h index 52561fd45..ecb7053fd 100644 --- a/sharpd/sharp_globals.h +++ b/sharpd/sharp_globals.h @@ -22,7 +22,7 @@ #ifndef __SHARP_GLOBAL_H__ #define __SHARP_GLOBAL_H__ -DECLARE_MGROUP(SHARPD) +DECLARE_MGROUP(SHARPD); struct sharp_routes { /* The original prefix for route installation */ diff --git a/sharpd/sharp_main.c b/sharpd/sharp_main.c index fe7f9851f..c273d3208 100644 --- a/sharpd/sharp_main.c +++ b/sharpd/sharp_main.c @@ -49,7 +49,7 @@ #include "sharp_globals.h" #include "sharp_nht.h" -DEFINE_MGROUP(SHARPD, "sharpd") +DEFINE_MGROUP(SHARPD, "sharpd"); zebra_capabilities_t _caps_p[] = { }; diff --git a/sharpd/sharp_nht.c b/sharpd/sharp_nht.c index bed0ebfa2..a90387186 100644 --- a/sharpd/sharp_nht.c +++ b/sharpd/sharp_nht.c @@ -32,8 +32,8 @@ #include "sharp_globals.h" #include "sharp_zebra.h" -DEFINE_MTYPE_STATIC(SHARPD, NH_TRACKER, "Nexthop Tracker") -DEFINE_MTYPE_STATIC(SHARPD, NHG, "Nexthop Group") +DEFINE_MTYPE_STATIC(SHARPD, NH_TRACKER, "Nexthop Tracker"); +DEFINE_MTYPE_STATIC(SHARPD, NHG, "Nexthop Group"); struct sharp_nh_tracker *sharp_nh_tracker_get(struct prefix *p) { |