RE: [PATCH net-next 5/5] net: dsa: split dsa_port's netdev member

From: David Laight
Date: Fri Oct 13 2017 - 12:11:16 EST


From: Vivien Didelot
> Sent: 13 October 2017 16:29
> Vivien Didelot <vivien.didelot@xxxxxxxxxxxxxxxxxxxx> writes:
>
> >>> How about using:
> >>>
> >>> union {
> >>> struct net_device *master;
> >>> struct net_device *slave;
> >>> } netdev;
> >> ...
> >>
> >> You can remove the 'netdev' all the compilers support unnamed unions.
> >
> > There are issues with older GCC versions, see the commit 42275bd8fcb3
> > ("switchdev: don't use anonymous union on switchdev attr/obj structs")
> >
> > That's why I kept it in the v2 I sent.
>
> At the same time, I can see that struct sk_buff uses anonym union a lot.
>
> It seems weird that one raised a compiler issue for switchdev but not
> for skbuff.h... Do you think it is viable to drop the name here then?

I believe the problem is with initialisers for static structures
that contain anonymous unions.

David