path: root/src/drivers/driver_wext.c
diff options
authorJouni Malinen <j@w1.fi>2009-11-04 17:49:14 (GMT)
committerJouni Malinen <j@w1.fi>2009-11-04 17:49:14 (GMT)
commit0ae7b0869107d4ae1b28bc417cfe4c5b0fc9e0ed (patch)
tree74cf20ec1500394ccebc957758f8e83986f3633e /src/drivers/driver_wext.c
parenteb999fefcbf919110b53681f8942dab4f0320f39 (diff)
Work around some gcc 4.4 strict-aliasing warnings
gcc 4.4 ends up generating strict-aliasing warnings about some very common networking socket uses that do not really result in a real problem and cannot be easily avoided with union-based type-punning due to struct definitions including another struct in system header files. To avoid having to fully disable strict-aliasing warnings, provide a mechanism to hide the typecast from aliasing for now. A cleaner solution will hopefully be found in the future to handle these cases.
Diffstat (limited to 'src/drivers/driver_wext.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c
index ade8904..a291813 100644
--- a/src/drivers/driver_wext.c
+++ b/src/drivers/driver_wext.c
@@ -65,8 +65,9 @@ static int wpa_driver_wext_send_oper_ifla(struct wpa_driver_wext_data *drv,
req.ifinfo.ifi_change = 0;
if (linkmode != -1) {
- rta = (struct rtattr *)
- ((char *) &req + NLMSG_ALIGN(req.hdr.nlmsg_len));
+ rta = aliasing_hide_typecast(
+ ((char *) &req + NLMSG_ALIGN(req.hdr.nlmsg_len)),
+ struct rtattr);
rta->rta_type = IFLA_LINKMODE;
rta->rta_len = RTA_LENGTH(sizeof(char));
*((char *) RTA_DATA(rta)) = linkmode;