summaryrefslogtreecommitdiff
path: root/lib/prefix.h
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@users.noreply.github.com>2021-06-01 19:08:32 +0000
committerGitHub <noreply@github.com>2021-06-01 19:08:32 +0000
commitc99313762a9663ad3749eca2c51a44c546a93fe7 (patch)
tree6fca73b00e6b737c794b1467025698ab2e4e8362 /lib/prefix.h
parent465d4a6c5b341de72fdd2a7de6458fc3968cf5cd (diff)
parentb0b14dfdd13963ab07889602d132ac218ce8526c (diff)
Merge pull request #8353 from opensourcerouting/llvm-20210327
Diffstat (limited to 'lib/prefix.h')
-rw-r--r--lib/prefix.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/prefix.h b/lib/prefix.h
index d7ee1b8e4c..217a23d561 100644
--- a/lib/prefix.h
+++ b/lib/prefix.h
@@ -315,10 +315,12 @@ struct prefix_sg {
#ifndef __cplusplus
#define prefixtype(uname, typename, fieldname) \
typename *fieldname;
+#define TRANSPARENT_UNION __attribute__((transparent_union))
#else
#define prefixtype(uname, typename, fieldname) \
typename *fieldname; \
uname(typename *x) { this->fieldname = x; }
+#define TRANSPARENT_UNION
#endif
union prefixptr {
@@ -328,7 +330,7 @@ union prefixptr {
prefixtype(prefixptr, struct prefix_evpn, evp)
prefixtype(prefixptr, struct prefix_fs, fs)
prefixtype(prefixptr, struct prefix_rd, rd)
-} __attribute__((transparent_union));
+} TRANSPARENT_UNION;
union prefixconstptr {
prefixtype(prefixconstptr, const struct prefix, p)
@@ -337,7 +339,10 @@ union prefixconstptr {
prefixtype(prefixconstptr, const struct prefix_evpn, evp)
prefixtype(prefixconstptr, const struct prefix_fs, fs)
prefixtype(prefixconstptr, const struct prefix_rd, rd)
-} __attribute__((transparent_union));
+} TRANSPARENT_UNION;
+
+#undef prefixtype
+#undef TRANSPARENT_UNION
#ifndef INET_ADDRSTRLEN
#define INET_ADDRSTRLEN 16