Making Netgraph compile with LLVM

Ed Schouten ed at 80386.nl
Sun Mar 1 14:00:26 PST 2009


* Julian Elischer <julian at elischer.org> wrote:
> Ed Schouten wrote:
>> Hello all,
>>
>> It turns out Netgraph uses a language construct that is only allowed
>> with GCC, but not with LLVM. According to the specs, LLVM's behaviour is
>> correct. It is not allowed to do this:
>>
>> 	struct a {
>> 		struct {
>> 			int i;
>> 			char j[];
>> 		} b;
>> 		char k[20];
>> 	};
>>
>> error: variable sized type 'b' must be at end of struct or class
>
> not sure wher eyou are seeing this.
>
> the examples you fix don't seem to be nested structs..  what is the  
> outer struct?

In the Netgraph code, this isn't done in a single declaration, but there
are several structs that (indirectly) nest pppoe_tags. An example is
ng_pppoe.c, line 1179:

	struct {
		struct pppoe_tag hdr;
		union   uniq    data;
	} __packed      uniqtag;

It turns out that this is not valid:

	http://llvm.org/bugs/show_bug.cgi?id=3671

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20090301/85160b07/attachment.pgp


More information about the freebsd-net mailing list