This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patch] *-dis.c: Fix formatting.
- To: Alan Modra <amodra at bigpond dot net dot au>
- Subject: Re: [patch] *-dis.c: Fix formatting.
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Sat, 18 Aug 2001 13:08:15 -0400
- Cc: Kazu Hirata <kazu at hxi dot com>, binutils at sources dot redhat dot com, Eli Zaretskii <eliz at is dot elta dot co dot il>
- References: <200108171934.MAA23915@cygnus.com> <3B7DF02F.90201@cygnus.com> <20010818145846.E31523@bubble.sa.bigpond.net.au>
>
> 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