X server source code re-indented

Peter Hutterer peter.hutterer at who-t.net
Thu Mar 22 15:54:25 PDT 2012


On Thu, Mar 22, 2012 at 12:17:20AM +0000, Daniel Stone wrote:
> Hi,
> 
> On 21 March 2012 22:27, Chase Douglas <chase.douglas at canonical.com> wrote:
> > On 03/21/2012 02:25 PM, Keith Packard wrote:
> >> I'll also happily take whitespace cleanup patches that recover from
> >> mistakes made by "indent".
> >
> > I haven't made any attempt to learn the new style yet. Is there a guide
> > somewhere?
> 
> The guide is just the indent script, but here's the rough digest:
>   - four-space indents (and I do mean spaces)
>   - braces on the following line for function declarations only,
> everything else on the same line
>   - ... but don't cuddle your elses: the correct form is if (foo) {\n
> [...]\n}\nelse {\n [...]\n}
>   - function name on a separate line from its return type
>   - case labels have zero indentation relative to the switch
> statement; the bodies of every case are indented four spaces as usual
>   - if you need to wrap the parameters to a function call or
> declaration, align the parameters on the next line to the opening
> parenthesis, rather than just tabbing in once
>   - same goes for conditionals

Can you please make sure this ends up in the CodingStyle wiki page (if it
isn't there already, it appears to be down atm). thanks.

Cheers,
  Peter

> 
> Aside from that, I don't think there's anything particularly new or surprising.
> 
> > At first I thought I'd just run my changes through the indent script
> > before committing, but as soon as we start applying indent "fixes" this
> > won't work.
> 
> The fixes are just to cover pretty daft indent corner cases; in
> particular it does totally the wrong thing when faced with luddite
> declarations of the form: void CloseDownClient(ClientPtr /* client
> */).  This confuses the poor thing massively and it spits its drink
> out all over the source code.  The fix, of course, is to fix those
> declarations.
> 
> In general, just follow those rules and you'll be grand.
> 
> Cheers,
> Daniel
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list