This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: New ARI warning Sat Mar 12 01:53:29 UTC 2011



> -----Message d'origine-----
> De?: Eli Zaretskii [mailto:eliz@gnu.org]
> Envoyé?: lundi 14 mars 2011 13:35
> À?: Pedro Alves
> Cc?: gdb-patches@sourceware.org; pierre.muller@ics-cnrs.unistra.fr
> Objet?: Re: New ARI warning Sat Mar 12 01:53:29 UTC 2011
> 
> > From: Pedro Alves <pedro@codesourcery.com>
> > Date: Mon, 14 Mar 2011 12:13:43 +0000
> > Cc: "Pierre Muller" <pierre.muller@ics-cnrs.unistra.fr>
> >
> > "A function declaration should not have its name in column zero.  A
> >  function definition should have its name in column zero."

> 
> What can I say? it's ugly.

  Eli, the only C coding standard I was ever confronted with 
is GDB coding standards.
  And this is probably one of the first rules
that I understood.
  I find this rule quite useful, as it allows
easy tracking of function implementation.

> 
> At the very least, please reformat the prototypes like this:
> 
> extern whatever_type foo (type1_t,
>        		     	  type2_t, const char **, foobar_t);
> 
> not like Pierre originally suggested.
> 
> That is, let the left paren and at least one argument be on the same
> line as the function name.

  I agree with the principle, but
it is not always possible:

What should we do with this:
$ grep -n -C 3 "^[a-z][a-z0-9_]*[[:space:]]*(.*)" *.h
linux-nat.h-147-/* Create a generic GNU/Linux target using traditional
linux-nat.h-148-   ptrace register access.  */
linux-nat.h-149-struct target_ops *
linux-nat.h:150:linux_trad_target (CORE_ADDR (*register_u_offset)(struct
gdbarch *, int, int));
linux-nat.h-151-
linux-nat.h-152-/* Register the customized GNU/Linux target.  This should be
used
linux-nat.h-153-   instead of calling add_target directly.  */

 OK, I must admit that I cheated, because that did not even appear in the
ARI list,
while it should.
  It should be in the list because it is one of the
functions declarations that are in first column,
it does not appear because I oversimplified the rule
using 
/^[a-z][a-z0-9_]*[[:space:]]*\((|[^*][^()]*)\)[[:space:]]*[^ \t]+/ 
awk pattern to avoid getting all function variables.
  If someone can suggest a more complete pattern that would also
grab the above without matching 
int (*test_var_function (int, int));
I would be grateful.

Pierre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]