From 81382410ed4203f5cb9283204bed635cb80df7d2 Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Tue, 3 Mar 2015 10:30:27 +0100 Subject: [PATCH] ospf6d: use existing union, avoid strict-aliasing There are preexisting fields u.lp.id and u.lp.adv_router in struct prefix that do the same thing as these type-punning pointer derefs. Use these and shut up the strict-aliasing warnings. Signed-off-by: David Lamparter (cherry picked from commit 0de0138a9146074f268245193e45c9376d998722) --- ospf6d/ospf6_route.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ospf6d/ospf6_route.h b/ospf6d/ospf6_route.h index b3be66c28e..e783b72d8e 100644 --- a/ospf6d/ospf6_route.h +++ b/ospf6d/ospf6_route.h @@ -251,14 +251,13 @@ extern const char *ospf6_path_type_substr[OSPF6_PATH_TYPE_MAX]; #define ospf6_route_is_best(r) (CHECK_FLAG ((r)->flag, OSPF6_ROUTE_BEST)) -/* XXX: This gives GCC heartburn aboutbreaking aliasing rules. */ #define ospf6_linkstate_prefix_adv_router(x) \ - ((x)->u.prefix4.s_addr) + ((x)->u.lp.id.s_addr) #define ospf6_linkstate_prefix_id(x) \ - ((x)->u.prefix6.s6_addr32[1]) + ((x)->u.lp.adv_router.s_addr) #define ADV_ROUTER_IN_PREFIX(x) \ - ((x)->u.prefix4.s_addr) + ((x)->u.lp.id.s_addr) /* Function prototype */ extern void ospf6_linkstate_prefix (u_int32_t adv_router, u_int32_t id, -- 2.39.5