From owner-freebsd-hackers@FreeBSD.ORG Fri May 2 02:14:52 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DE317106566C; Fri, 2 May 2008 02:14:52 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 518FE8FC19; Fri, 2 May 2008 02:14:51 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (adsl62-8.kln.forthnet.gr [77.49.189.8]) (authenticated bits=128) by igloo.linux.gr (8.14.2/8.14.2/Debian-4) with ESMTP id m422C1GK031582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 2 May 2008 05:12:08 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.2/8.14.2) with ESMTP id m422C1UA033641; Fri, 2 May 2008 05:12:01 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.2/8.14.2/Submit) id m422BwsB033048; Fri, 2 May 2008 05:11:58 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Max Laier References: <20080426213557.GA88577@marvin.blogreen.org> <200804270201.53271.max@love2party.net> Date: Fri, 02 May 2008 05:11:57 +0300 In-Reply-To: <200804270201.53271.max@love2party.net> (Max Laier's message of "Sun, 27 Apr 2008 02:01:53 +0200") Message-ID: <8763txlaj6.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=cp851 Content-Transfer-Encoding: quoted-printable X-MailScanner-ID: m422C1GK031582 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.907, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.49, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-hackers@freebsd.org, hackers@freebsd.org, Romuald Conty , Romain =?cp851?Q?Tarti=8Are?= 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: Fri, 02 May 2008 02:14:53 -0000 On Sun, 27 Apr 2008 02:01:53 +0200, Max Laier wrote: > On Saturday 26 April 2008 23:35:57 Romain Tarti=8Are 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..." > would be valid C code, let alone better formated as "...0 b...". > Hence I see no harm in adding your patch to the base indent(1). > > Does anyone have an example where "...0 b..." is valid C code? The only case I can think of is when the "b..." is an existing macro, i.e. something like: 1 #include 2 3 #define b0101 + 3 4 5 int 6 main(void) 7 { 8 printf("%u\n", 0 b0101); 9 return 0; 10 } But that's a rather contrived example. Making the "0b...." support tunable through a command-line option seems ok for me.