[PATCH 1.12] A coding style for the server

Guillem Jover guillem at hadrons.org
Wed Jan 18 15:25:02 PST 2012


Hi!

On Wed, 2012-01-18 at 14:02:01 +1100, Daniel Stone wrote:
> Most of the code we broadly agrees on most things.  Some things were a
> little more split; for instance, cuddling else was only just outnumbered
> by non-cuddling else, and also braces cuddling if outnumbered
> non-cuddling.

> So, the commit in my coding-style xserver branch is simply the result of
> running this:
> indent -linux -bad -bap -blf -bli0 -br -brs -cbi0 -cdw -nce -cs -i4 -hnl
> -l80 -lc80 -lp -nbbo -nbc -nbfda -nprs -npcs -npsl -saf -sai -saw -nut
> across *.c and *.h in the X server tree.  No more, no less.  The build
> seems to continue to work just fine.  Don't be scared by the -linux;
> it just provides a set of reasonable default options.  Pretty much
> everything else was just done by hand to match what we seem to generally
> do in the server.

I had the impression from skimming over xorg code base that most of it
was using -psl?

> It's obviously too big to attach to this mail, so I haven't done that.

It seems indent is not smart enough and produces some space damage. It
does not seem to be able to handle some unary pointer operators correctly
and thinks they are binary ones appending spaces after them. It also
seems to confuse function pointers with casts placing spaces before the
opening parenthesis. So any such patch might need manual review.

Also, defining a global coding style does not mean the code has to switch
immediately, it could be switched as code gets modfied, which avoids the
«git blame» barrier already mentioned on the thread if that's considered
to be an issue.

In any case a global coding style would be extremely nice.

regards,
guillem


More information about the xorg-devel mailing list