From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13700 invoked by alias); 19 Feb 2009 20:26:24 -0000 Received: (qmail 13690 invoked by uid 22791); 19 Feb 2009 20:26:24 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 19 Feb 2009 20:26:16 +0000 Received: from brahms.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3) with ESMTP id n1JKOrJf008091; Thu, 19 Feb 2009 21:24:54 +0100 (CET) Received: (from kettenis@localhost) by brahms.sibelius.xs4all.nl (8.14.3/8.14.3/Submit) id n1JKOruB026786; Thu, 19 Feb 2009 21:24:53 +0100 (CET) Date: Fri, 20 Feb 2009 00:09:00 -0000 Message-Id: <200902192024.n1JKOruB026786@brahms.sibelius.xs4all.nl> From: Mark Kettenis To: pedro@codesourcery.com CC: gdb-patches@sourceware.org In-reply-to: <200902181425.13598.pedro@codesourcery.com> (message from Pedro Alves on Wed, 18 Feb 2009 14:25:13 +0000) Subject: Re: Fix most -Wmissing-prototypes -Wmissing-declarations warnings References: <200902180201.05118.pedro@codesourcery.com> <200902181012.n1IAC3ow025364@brahms.sibelius.xs4all.nl> <200902181425.13598.pedro@codesourcery.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: 2009-02/txt/msg00398.txt.bz2 > From: Pedro Alves > Date: Wed, 18 Feb 2009 14:25:13 +0000 > > On Wednesday 18 February 2009 10:12:03, Mark Kettenis wrote: > > > From: Pedro Alves > > > Date: Wed, 18 Feb 2009 02:01:04 +0000 > > > > > > 3) several cases of _initialize_foo not being declared. > > > > > > +/* -Wmissing-prototypes */ > > > +extern initialize_file_ftype _initialize_cli_logging; > > > + > > > > I absolutely detest using initialize_file_ftype for this, since my > > brain fails to parse this as a function prototype. > > I'm guessing you detest all function pointer variable declarations > as well then. I'm quite sure you're capable of getting used to > it as well, as this is valid C syntax anyway. You probably have > already, since you hate it so much, but you're probably in > denial. :-) I don't really like those either, but tey're vastly more acceptable, since function pointers are variables. So my brain parsing them as such, is actually ok. Oh, and the fact that something is valid C syntax, doesn't mean it is a good idea of course. > I disagree with you here, and, I absolutelly love using > _initialize_file_ftype for this. The difference between: > > extern initialize_file_ftype _initialize_foo; > void _initialize_foo (void) > {} > > ... and: > > void _initialize_foo (void); > void _initialize_foo (void) > {} Well, that's obvious isn't it. The second example saves you *several* keystrokes! ;). > Is that with the former, if the _initializer_BAR functions prototype > needs to change, we change initialize_file_ftype, and all correctly > declared and prototypes functions will fail to compile, whereas with > the latter form, you may miss the change. the compiler will not > help you. So, I claim that all those instance *not* using > initialize_file_ftype are wrong. A valid point, although the function prototype is unlikely to ever change. > > And, the GNU coding standards still demand full sentences, so in the > > past I've written stuff like: > > > > /* Provide a prototype to silence -Wmissing-prototypes. */ > > void _initialize_i386_tdep (void); > > > > I don't feel too strongly about the last point, but it'd be nice to > > see consistency here. > > > > Well, I happened to copy paste from one of the instances that > does that already, vis (before my patch): > > >grep missing-prototypes * -rn | grep -v "ChangeLog" | grep Provide | wc -l > 74 > > >grep initialize_file_ftype * -rn| grep -v ChangeLog | wc -l > 61 > > (after my patch, there are 84 instances of the _ftype form) > > Most, if not all the initialize_file_ftype variants use shorter > description. It's a bit pedantic, but I'll adjust to use the > full sentence in the comment for the ones I'm adding.