summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compiler.h4
-rw-r--r--lib/prefix.h26
2 files changed, 16 insertions, 14 deletions
diff --git a/lib/compiler.h b/lib/compiler.h
index 0a54c02d20..617b0c265b 100644
--- a/lib/compiler.h
+++ b/lib/compiler.h
@@ -424,10 +424,10 @@ _Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8,
* type.)
*/
#ifndef __cplusplus
-#define prefixtype(uname, typename, fieldname) typename *fieldname;
+#define uniontype(uname, typename, fieldname) typename *fieldname;
#define TRANSPARENT_UNION __attribute__((transparent_union))
#else
-#define prefixtype(uname, typename, fieldname) \
+#define uniontype(uname, typename, fieldname) \
typename *fieldname; \
uname(typename *x) \
{ \
diff --git a/lib/prefix.h b/lib/prefix.h
index fc6e32dd54..14f2695933 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -286,23 +286,25 @@ struct prefix_sg {
struct in_addr grp;
};
+/* clang-format off */
union prefixptr {
- prefixtype(prefixptr, struct prefix, p)
- prefixtype(prefixptr, struct prefix_ipv4, p4)
- prefixtype(prefixptr, struct prefix_ipv6, p6)
- prefixtype(prefixptr, struct prefix_evpn, evp)
- prefixtype(prefixptr, struct prefix_fs, fs)
- prefixtype(prefixptr, struct prefix_rd, rd)
+ uniontype(prefixptr, struct prefix, p)
+ uniontype(prefixptr, struct prefix_ipv4, p4)
+ uniontype(prefixptr, struct prefix_ipv6, p6)
+ uniontype(prefixptr, struct prefix_evpn, evp)
+ uniontype(prefixptr, struct prefix_fs, fs)
+ uniontype(prefixptr, struct prefix_rd, rd)
} TRANSPARENT_UNION;
union prefixconstptr {
- prefixtype(prefixconstptr, const struct prefix, p)
- prefixtype(prefixconstptr, const struct prefix_ipv4, p4)
- prefixtype(prefixconstptr, const struct prefix_ipv6, p6)
- prefixtype(prefixconstptr, const struct prefix_evpn, evp)
- prefixtype(prefixconstptr, const struct prefix_fs, fs)
- prefixtype(prefixconstptr, const struct prefix_rd, rd)
+ uniontype(prefixconstptr, const struct prefix, p)
+ uniontype(prefixconstptr, const struct prefix_ipv4, p4)
+ uniontype(prefixconstptr, const struct prefix_ipv6, p6)
+ uniontype(prefixconstptr, const struct prefix_evpn, evp)
+ uniontype(prefixconstptr, const struct prefix_fs, fs)
+ uniontype(prefixconstptr, const struct prefix_rd, rd)
} TRANSPARENT_UNION;
+/* clang-format on */
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16