From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30782 invoked by alias); 14 Mar 2011 11:26:51 -0000 Received: (qmail 30769 invoked by uid 22791); 14 Mar 2011 11:26:47 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Mar 2011 11:26:42 +0000 Received: from eliz by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Pz5v6-0002FS-Es; Mon, 14 Mar 2011 07:26:40 -0400 Date: Mon, 14 Mar 2011 12:13:00 -0000 Message-Id: From: Eli Zaretskii To: "Pierre Muller" CC: gdb-patches@sourceware.org In-reply-to: <006701cbe220$a1a8dba0$e4fa92e0$@muller@ics-cnrs.unistra.fr> (pierre.muller@ics-cnrs.unistra.fr) Subject: Re: New ARI warning Sat Mar 12 01:53:29 UTC 2011 Reply-to: Eli Zaretskii References: <20110312015329.GA20179@sourceware.org> <010f01cbe157$aebb5cb0$0c321610$@muller@ics-cnrs.unistra.fr> <006701cbe220$a1a8dba0$e4fa92e0$@muller@ics-cnrs.unistra.fr> X-IsSubscribed: yes 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: 2011-03/txt/msg00711.txt.bz2 > From: "Pierre Muller" > Cc: > Date: Mon, 14 Mar 2011 09:20:07 +0100 > > > The rule to detect "()" without a "void" is fine, but why on Earth do > > we need the other rule, about prototypes like this: > > > > int > > foo (bar); > > > > This is a perfectly valid formatting. In your patch, you modify long > > prototypes like this as follows: > > > > extern struct hppa_objfile_private * > > -hppa_init_objfile_priv_data (struct objfile *objfile); > > + hppa_init_objfile_priv_data (struct objfile *objfile); > > > > But that is not a good idea, because if you type TAB in Emacs on the > > line with the function name, Emacs will reindent the name to column > > zero. So I expect this rule to annoy us quite a bit, e.g. if someone > > reindents a large region. > > > > Can you tell why we need this? > > See > http://sourceware.org/ml/gdb-patches/2011-03/msg00651.html That was about _definitions_, not about declarations of prototypes. Anyway, I don't see how is it relevant: that message talks about the need to put the names of the functions in the beginning of a line (a long standing GNU coding style practice), exactly the practice which will according to your change trigger ARI warnings when used with a prototype. > I really thought that prototypes, > either in header or in C sources should not be found by that > pattern and that it shouls thus either be on a single line, > or be indented to avoid being on first column. Are we adding ARI warnings to help ARI find function implementations and skip prototypes? If this is the need, why not look for the semi-colon at the end of the prototype, which will be absent in function definitions? > Would it be better to reformat those as > extern TYPE long_func_name > (with_long_parameters); > instead of > extern TYPE > long_func_name (with_long_parameters); No, that's even uglier. > I would really like to avoid getting both the > prototype and the implementation if I do: > > grep "^func_name " Then let's find a smarter way of finding just the implementation. Forcing some unusual style on our code to help Grep is not a good idea, IMO.