From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1228 invoked by alias); 26 Jun 2012 13:31:06 -0000 Received: (qmail 1219 invoked by uid 22791); 26 Jun 2012 13:31:05 -0000 X-SWARE-Spam-Status: No, hits=-0.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD,URIBL_BLACK X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Jun 2012 13:30:40 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q5QDUBYT024222; Tue, 26 Jun 2012 15:30:11 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q5QDU9hC017485; Tue, 26 Jun 2012 15:30:10 +0200 (CEST) Date: Tue, 26 Jun 2012 13:31:00 -0000 Message-Id: <201206261330.q5QDU9hC017485@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: brobecker@adacore.com CC: tromey@redhat.com, mark.kettenis@xs4all.nl, dje@google.com, pierre.muller@ics-cnrs.unistra.fr, gdb-patches@sourceware.org In-reply-to: <20120622190228.GM2799@adacore.com> (message from Joel Brobecker on Fri, 22 Jun 2012 12:02:28 -0700) Subject: Re: New ARI warning Wed May 23 01:55:03 UTC 2012 References: <4fbc9d77.0853b40a.641e.ffff90dbSMTPIN_ADDED@mx.google.com> <87bold8l4d.fsf@fleche.redhat.com> <201205282043.q4SKhksB010254@glazunov.sibelius.xs4all.nl> <87ipejib8o.fsf@fleche.redhat.com> <20120622171922.GK2799@adacore.com> <20120622173049.GL2799@adacore.com> <877guzgs7r.fsf@fleche.redhat.com> <20120622190228.GM2799@adacore.com> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00800.txt.bz2 > Date: Fri, 22 Jun 2012 12:02:28 -0700 > From: Joel Brobecker > > > >> * configure.ac (build_warnings): Add -Wdeclaration-after-statement. > > >> * configure: Regenerate. > > > > Yes, ok. Thanks; I hadn't realized there was a flag for this already :) > > Thanks, checked in. > > > Discussion on irc pointed out that this is still allowed: > > > > for (int i = 0; ...) > > > > I think this doesn't suffer from the readability problems that > > declarations in the code generally do; and in fact usually makes the > > code cleaner, by restricting the scope of the loop variable. > > Agreed. > > Note that this is only going to be accepted if we compile in > C99 mode, I think. Otherwise, you'll get a warning which is > unrelated declarations being used after statements. > > error: 'for' loop initial declarations are only allowed in C99 mode > > > How about we flip the switch to C99 for 7.6? > > Sounds good to me. Do we want to be exclusive, rather than inclusive? > In other words, say: The following C99 constructs are allowed, and > maintain that list, rather that allow all of C99, and then list > the features not allowed. I understand that some features are still > not implemented (or portable?). I'm not aware of any C99 language features that aren't widely implemented by the halfway modern compilers. But there might be some obscure corners of the standard that I'm not familiar with. I think only the approach of listing features that we don't allow makes sense. That list should be very short. C99 library functions and header files are a different matter though. Those may not be available on older systems. We can only use those if we provide proper replacement functions (e.g. gnulib).