This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


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

Re: [patch] *-dis.c: Fix formatting.


> 
> Oh?
> 
> http://www.gnu.org/prep/standards_23.html#SEC24
> 
> "It is important to put the open-brace that starts the body of a C
> function in column zero, and avoid putting any other open-brace or
> open-parenthesis or open-bracket in column zero. Several tools look
> for open-braces in column zero to find the beginnings of C functions.
> These tools will not work on code not formatted that way."

Ah, we've got a pan-pacific manual throwing competition on our hands :-)

 From the same manual:

> The rest of this section gives our recommendations for other aspects of C formatting style, which is also the default style of the indent program in version 1.2 and newer. It corresponds to the options
> 
> -nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2
> -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -psl -nsc -nsob

These are also the flags you get by default when running GNU indent - 
you shouldn't be overriding these flags.

Anyway, there is an apparent contradiction.  Consulting the reference 
implementation (emacs) I can see:

struct foo
   {
     int arg;
     long sigh;
     double arg;
   };

(Which an old version of indent was generating) and:

struct bar
{
   int eresting;
   int egers;
};

which GNU indent 2.2.6 is generating and clearly documents.  There is 
also the very very occasional:

struct baz {
   int erface;
};

(20 vs 260 from a mindless grep).

I would work on the assumption that one of the first two is correct. A 
brace sharing a line with other junk doesn't exactly look GNU :-)

	Andrew



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