netlink.c:97: error: cast increases required alignment of target type

andrzej zaborowski balrogg at gmail.com
Mon Nov 9 07:45:25 PST 2009


Hi,
resurrecting this thread because I think there's no reason ofono
should not build on cpus with strict alignment rules, the netlink code
is actually aligned correctly.  These warnings are a result of
-Wcast-align, the compiler can't know that the casts in the macros are
safe, but they obviously are if you look at the arithmetics there.  In
the case of the netlink warnings they can be turned off for all users
of <linux/netlink.h> using a pragma or only for this cast by casting
to void * first (the only way according to gcc people), the first
attached file adds them (against linux), I'll send it to linux if
there's no better idea.  There are also similar warnings when casting
struct sockaddr_pn * to struct sockaddr * and these can be worked
around in ofono, see second patch, but probably should also be in
linux's include/linux/phonet.h instead.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux-netlink-alignment-no-warn.patch
Type: text/x-patch
Size: 1910 bytes
Desc: not available
URL: <http://lists.ofono.org/pipermail/ofono/attachments/20091109/c36328f4/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ofono-sockaddr_pn-alignment-no-warn.patch
Type: text/x-patch
Size: 1770 bytes
Desc: not available
URL: <http://lists.ofono.org/pipermail/ofono/attachments/20091109/c36328f4/attachment-0001.bin>


More information about the ofono mailing list