forked from Mirror/frr
lib: fix transparent_union for clang++
clang does not accept __attribute__((transparent_union)) in C++ source code. We don't need it there anyway so let's just limit it to C. Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
694df37daf
commit
5d38779233
|
@ -315,10 +315,12 @@ struct prefix_sg {
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#define prefixtype(uname, typename, fieldname) \
|
#define prefixtype(uname, typename, fieldname) \
|
||||||
typename *fieldname;
|
typename *fieldname;
|
||||||
|
#define TRANSPARENT_UNION __attribute__((transparent_union))
|
||||||
#else
|
#else
|
||||||
#define prefixtype(uname, typename, fieldname) \
|
#define prefixtype(uname, typename, fieldname) \
|
||||||
typename *fieldname; \
|
typename *fieldname; \
|
||||||
uname(typename *x) { this->fieldname = x; }
|
uname(typename *x) { this->fieldname = x; }
|
||||||
|
#define TRANSPARENT_UNION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
union prefixptr {
|
union prefixptr {
|
||||||
|
@ -328,7 +330,7 @@ union prefixptr {
|
||||||
prefixtype(prefixptr, struct prefix_evpn, evp)
|
prefixtype(prefixptr, struct prefix_evpn, evp)
|
||||||
prefixtype(prefixptr, struct prefix_fs, fs)
|
prefixtype(prefixptr, struct prefix_fs, fs)
|
||||||
prefixtype(prefixptr, struct prefix_rd, rd)
|
prefixtype(prefixptr, struct prefix_rd, rd)
|
||||||
} __attribute__((transparent_union));
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
union prefixconstptr {
|
union prefixconstptr {
|
||||||
prefixtype(prefixconstptr, const struct prefix, p)
|
prefixtype(prefixconstptr, const struct prefix, p)
|
||||||
|
@ -337,7 +339,10 @@ union prefixconstptr {
|
||||||
prefixtype(prefixconstptr, const struct prefix_evpn, evp)
|
prefixtype(prefixconstptr, const struct prefix_evpn, evp)
|
||||||
prefixtype(prefixconstptr, const struct prefix_fs, fs)
|
prefixtype(prefixconstptr, const struct prefix_fs, fs)
|
||||||
prefixtype(prefixconstptr, const struct prefix_rd, rd)
|
prefixtype(prefixconstptr, const struct prefix_rd, rd)
|
||||||
} __attribute__((transparent_union));
|
} TRANSPARENT_UNION;
|
||||||
|
|
||||||
|
#undef prefixtype
|
||||||
|
#undef TRANSPARENT_UNION
|
||||||
|
|
||||||
#ifndef INET_ADDRSTRLEN
|
#ifndef INET_ADDRSTRLEN
|
||||||
#define INET_ADDRSTRLEN 16
|
#define INET_ADDRSTRLEN 16
|
||||||
|
|
Loading…
Reference in a new issue