From owner-svn-src-all@FreeBSD.ORG Sun Jun 19 15:17:49 2011 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 23D0A106566C; Sun, 19 Jun 2011 15:17:49 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail03.syd.optusnet.com.au (mail03.syd.optusnet.com.au [211.29.132.184]) by mx1.freebsd.org (Postfix) with ESMTP id B0A838FC14; Sun, 19 Jun 2011 15:17:48 +0000 (UTC) Received: from c122-106-165-191.carlnfd1.nsw.optusnet.com.au (c122-106-165-191.carlnfd1.nsw.optusnet.com.au [122.106.165.191]) by mail03.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id p5JFHjuG016001 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 20 Jun 2011 01:17:46 +1000 Date: Mon, 20 Jun 2011 01:17:45 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ben Laurie In-Reply-To: <4DFDE87E.2050309@links.org> Message-ID: <20110620010724.I1817@besplex.bde.org> References: <201106181356.p5IDuXhW044171@svn.freebsd.org> <20110618174531.GW48734@deviant.kiev.zoral.com.ua> <4DFDE87E.2050309@links.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: Kostik Belousov , Ben Laurie , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, svn-src-head@FreeBSD.org Subject: Re: svn commit: r223262 - in head: cddl/contrib/opensolaris/lib/libdtrace/common contrib/binutils/bfd contrib/binutils/gas contrib/binutils/gas/config contrib/binutils/ld contrib/binutils/opcodes contr... X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Jun 2011 15:17:49 -0000 On Sun, 19 Jun 2011, Ben Laurie wrote: > On 18/06/2011 18:45, Kostik Belousov wrote: >>> Modified: head/sys/sys/param.h >>> ============================================================================== >>> --- head/sys/sys/param.h Sat Jun 18 13:54:36 2011 (r223261) >>> +++ head/sys/sys/param.h Sat Jun 18 13:56:33 2011 (r223262) >>> @@ -319,4 +319,10 @@ __END_DECLS >>> #define member2struct(s, m, x) \ >>> ((struct s *)(void *)((char *)(x) - offsetof(struct s, m))) >>> >>> +/* >>> + * Access a variable length array that has been declared as a fixed >>> + * length array. >>> + */ >>> +#define __PAST_END(array, offset) (((typeof(*(array)) *)(array))[offset]) >>> + >>> #endif /* _SYS_PARAM_H_ */ >> >> The "typeof" there should be "__typeof", most likely. > > Hmm. Clang's own headers use __typeof__, it seems. gcc's docs also use > __typeof__. gcc supports but __foo__ and __foo for most things. The excessive underscores in __foo are style bugs and are not used in FreeBSD if possible. (They are useless, unlike leading underscores which are used to put identifiers in reserved namespaces.) Unfortunately, gcc doesn't actually document the alternative __foo form, at least in gcc*.info, and it doesn't support the __foo form for a few identifiers (notably for attributes). typeof in the above is an error because it is in the application namespace. The above also has some style bugs. Bruce