From owner-freebsd-net@FreeBSD.ORG Sun Mar 1 22:10:19 2009 Return-Path: Delivered-To: net@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DFDA110656D7 for ; Sun, 1 Mar 2009 22:10:19 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outQ.internet-mail-service.net (outq.internet-mail-service.net [216.240.47.240]) by mx1.freebsd.org (Postfix) with ESMTP id C41A58FC24 for ; Sun, 1 Mar 2009 22:10:19 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id A03F0B4E6; Sun, 1 Mar 2009 14:10:19 -0800 (PST) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 0510A2D600D; Sun, 1 Mar 2009 14:10:18 -0800 (PST) Message-ID: <49AB07CA.4070607@elischer.org> Date: Sun, 01 Mar 2009 14:10:18 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.19 (Macintosh/20081209) MIME-Version: 1.0 To: Ed Schouten References: <20090301161827.GR19161@hoeg.nl> <49AAFF4F.6010400@elischer.org> <20090301220024.GU19161@hoeg.nl> In-Reply-To: <20090301220024.GU19161@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: net@FreeBSD.org Subject: Re: Making Netgraph compile with LLVM X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 01 Mar 2009 22:10:20 -0000 Ed Schouten wrote: > * Julian Elischer 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 then the answer is to create a separate structure 'tag header' that can be used in both places. I think.... >