From owner-svn-src-all@FreeBSD.ORG Fri Nov 28 09:59:20 2008 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 8EEAB1065670; Fri, 28 Nov 2008 09:59:20 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 2937B8FC16; Fri, 28 Nov 2008 09:59:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-107-119-232.carlnfd1.nsw.optusnet.com.au [122.107.119.232]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id mAS9x5Ob018699 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Nov 2008 20:59:09 +1100 Date: Fri, 28 Nov 2008 20:59:05 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= In-Reply-To: <86ej0x112s.fsf@ds4.des.no> Message-ID: <20081128204657.H1116@besplex.bde.org> References: <9bbcef730811270220h1a7f812k2ba340737132ff82@mail.gmail.com> <8663m94g30.fsf@ds4.des.no> <9bbcef730811270238k61c3e59fqee7715f017d70ccf@mail.gmail.com> <20081127.105534.188222755.imp@bsdimp.com> <86ej0x112s.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="0-238254834-1227866345=:1116" Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, ivoras@gmail.com, "M. Warner Losh" Subject: Re: svn commit: r185356 - head/sys/dev/ixgbe 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: Fri, 28 Nov 2008 09:59:20 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-238254834-1227866345=:1116 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Thu, 27 Nov 2008, [utf-8] Dag-Erling Sm=C3=B8rgrav wrote: > "M. Warner Losh" writes: >> I personally really dislike the style (and yes, I know all the >> arguments for it). If you really want something that complex inside a >> block to need block scoped variables, then that really argues for a >> function oft times... > > There is one particular situation where it is very convenient: > > int > foo(struct sockaddr *sa) > { > switch (s->sa_family) { > case AF_INET: { > struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; > /* ... */ > break; > } Switch statements are 1 case (the only case?) where the braces needed for non-C99 declarations don't require extra indentation. However, indent(1) doesn't understand this and mangles the above to: int foo(struct sockaddr *sa) { =09switch (s->sa_family) { =09=09case AF_INET:{ =09=09=09struct sockaddr_in *sin =3D (struct sockaddr_in *)sa; =09=09=09/* ... */ =09=09=09break; =09=09} indent(1) has fixed a style bug in the above (the missing blank line after the declarations) but it has introduced 2 (the missing space before "{" and the unwanted indentation). Fixing the other style bug in the above (the initialization in the declaration) is beyond the scope of indent(1). gindent-2.2.9 -npro gives the same style bugs and 1 more (it misformats the comment to a block one, but that may be due to a bad default). Bruce --0-238254834-1227866345=:1116--