On Sat, Jun 15, 2013 at 05:13:31PM +0800, Chung-Ju Wu wrote:
> 2013/6/14 Joseph S. Myers <jos...@codesourcery.com>:
> > On Thu, 13 Jun 2013, Richard Biener wrote:
> >
> >> Btw, rather than these kind of patches I'd appreciate if someone would look
> >> at a simple pre(post?)-commit hook that enforces those whitespace rules.
> >
> > In the cpp testsuite we definitely want tests with bad whitespace (e.g.
> > gcc.dg/cpp/backslash*.c) and generally I think it's wrong to be changing
> > whitespace in the testsuite without an understanding of what the test is
> > testing and how the whitespace is irrelevant to that (more generally,
> > cleanups of compiler tests are suspect without such an understanding of
> > what is or is not significant in a particular test).  And so you need to
> > allow addition of otherwise bad whitespace there.
> >
> > It's not obvious whether there might be other cases needing such
> > whitespace as well.
> >
> >> Either by adjusting the committed content or by rejecting the commit(?)
> >
> > I don't think hooks adjusting committed content are likely to work at all.
> >
> > --
> > Joseph S. Myers
> > jos...@codesourcery.com
> 
> By having a look at Ondřej's patch, it is nice to fix existing
> codes with proper whitespace/tab rules.
> 
> But it covers too much under whole gcc source tree.
> Like Joseph said, we may accidentally change the cases
> that need bad whitespace.
> 
> Perhaps we should gradually fix them?  i.e. We can only fix
> leading spaces for some obvious cases (gcc/*.c gcc/c-family/*.c ...),
> leaving other source (gcc/testsuite/* gcc/config/* ...) untouched.
>
Here we need a way to clearly mark where preserving whitespaces is
important and where it is not.

You could add files named say

.indent-on .indent-off

to enable or disable formating on per directory basis. I leave decision
if its whitelist or blacklist upto you.

I will follow convention that in files you can selectively disable
formatter by comments:
/*INDENT-OFF*/ /*INDENT-ON*/ 

I now accept only files with .c and .h extensions. If you want to format 
ada/fortran files it is also possible.

> Once Ondřej or others figure out the purpose of those non-obvious cases,
> they can propose another patches to fix them.
> 
> 
> Best regards,
> jasonwucj

Reply via email to