From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 27 00:18:22 2008 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9C9F21065670 for ; Sun, 27 Apr 2008 00:18:22 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.179]) by mx1.freebsd.org (Postfix) with ESMTP id 34A9A8FC0C for ; Sun, 27 Apr 2008 00:18:22 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-064-188-042.pools.arcor-ip.net [88.64.188.42]) by mrelayeu.kundenserver.de (node=mrelayeu7) with ESMTP (Nemesis) id 0ML2xA-1JpuOn11qo-0003da; Sun, 27 Apr 2008 02:05:45 +0200 Received: (qmail 84117 invoked from network); 27 Apr 2008 00:04:25 -0000 Received: from myhost.laiers.local (192.168.4.151) by mx.laiers.local with SMTP; 27 Apr 2008 00:04:25 -0000 From: Max Laier Organization: FreeBSD To: freebsd-hackers@freebsd.org Date: Sun, 27 Apr 2008 02:01:53 +0200 User-Agent: KMail/1.9.9 References: <20080426213557.GA88577@marvin.blogreen.org> In-Reply-To: <20080426213557.GA88577@marvin.blogreen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200804270201.53271.max@love2party.net> X-Provags-ID: V01U2FsdGVkX19BZx5+PlUKH1G/Ek32lad7qjzhv4lCH8ee+3p qIoHbilQ6XjxfGCfw3lDDaggJjT0BUsAUEKEofo3RGBVAV51HQ /o2BQAvMSfOrY2mStmRFg== Cc: hackers@freebsd.org, Romuald Conty , Romain =?utf-8?q?Tarti=C3=A8re?= Subject: Re: indent(1) support for gcc(1) 0b prefix X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2008 00:18:22 -0000 On Saturday 26 April 2008 23:35:57 Romain Tarti=C3=A8re wrote: > Hello FreeBSD hackers! > > I'm using avr-gcc from the ports and relying on the 0b prefix notation > for binary constants, that is: > > foo =3D 0b00101010; > > Thanks to /usr/ports/devel/avr-gcc/files/patch-0b-constants this is > possible :-) > > But I would like to use indent(1) to reformat contributed code > automatically. Unfortunately, the 0b notation is not supported by that > program, and the resulting code looks like this: > > foo =3D 0 b00101010; > > ... then compilation fails, bla bla bla... I can't think of a case (outside of "0x...." context) where "...0b..."=20 would be valid C code, let alone better formated as "...0 b...". Hence I=20 see no harm in adding your patch to the base indent(1). Does anyone have an example where "...0 b..." is valid C code? > A quick look at indent(1) source code leaded me to tweak > /usr/src/usr.bin/indent/lexi.c so that the 0b notation is supported > (patch attached). > > I was so wondering how useful(less) it was to support this extension in > FreeBSD indent(1) program. The version of gcc provided with the base > system does not support this syntax, and AFAIK, only the avr-gcc port > support this kind of constructs... > > So options are: > - Add support for 0b notation to FreeBSD indent(1) (maybe requiring > the use of an extra command line argument to support this feature); > - Provide a patch for indent(1) that can be conditionally applied on > the code when compiling the world; > - Create another port, say avr-indent(1), that is not more than a > copy of indent(1) with support of 0b constructs; > - Do nothing: tweaking indent(1) for supporting this is so trivial > that the few individuals interested in this can have their local > version of indent. > > Can you please tell me your opinion about this? > > Thank you in advance, > Romain > > PS: I also took a look at GNU indent (gindent(1) from the ports), but > it does not support 0b notation too. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News