[ovs-dev] [PATCH] gcc: Fix compile errors due to anonymous union initilization.

Ben Pfaff blp at ovn.org
Mon Feb 22 18:06:30 UTC 2016


On Wed, Feb 17, 2016 at 06:00:22PM -0800, William Tu wrote:
> gcc 4.4.7 lets you initialize named fields, and assign to anonymous union members,
> but cannot statically initialize a named member of an anonymous union. This causes
> errors when doing make:
> fproto/fail-open.c: In function ‘send_bogus_packet_ins’:
> ofproto/fail-open.c:130: error: unknown field ‘pin’ specified in initializer
> ofproto/fail-open.c:131: error: unknown field ‘up’ specified in initializer
> ofproto/fail-open.c:132: error: unknown field ‘packet’ specified in initializer
> ofproto/fail-open.c:132: warning: missing braces around initializer
> ofproto/fail-open.c:132: warning: (near initialization for ‘am.<anonymous>.pin.up’)
> ofproto/fail-open.c:134: error: extra brace group at end of initializer
> 
> Examaple: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42875
> We can either assign a name to the union or, in this patch, remove the unnecessary union.
> 
> Signed-off-by: William Tu <u9012063 at gmail.com>

Well, that's going to bite us again.

Thanks for the patch.  Applied!



More information about the dev mailing list