[petsc-dev] Style Guide: How to format single-line if/for/while-blocks?

Karl Rupp rupp at mcs.anl.gov
Tue Jan 22 11:21:45 CST 2013


Hi,


 >>>>>     Unfortunately the CPP crap in PETSc messes things up a bit, 
curse that CPP wish we could eliminate it all. And yes CPP is C 
preprocessor not C++.
>>>>
>>>> Does it? For the formatting itself it's just another layer…
>>>
>>>    Yes but it doesn't fit into the C AST.
>>
>> If I'm not mistaken, one can attach a preprocessor to a compiler object and generate some kind of syntax tree as well as a full C AST. This allows some additional back-and-forth operations.
>
>     There is the theory, and then there is the practice :-(

I couldn't find a good way of dealing with the CPP inside Clang without 
getting a lot of headache and ending up interfering with the lexer and 
all the low-level stuff. So, that rabbit hole is A LOT bigger when it 
comes to practice in coding style...

So, so I will continue quickly along the following path:
  -> Bring sources to a clean state
  -> Provide simple and robust guard scripts (pre-commit/pre-push)
  -> Configure uncrustify such that it reports violations (nightly)
  -> Document user-specific uncrustify configs

I don't want to leave things in the current half-done state, this would 
have been a complete waste of time then.

Best regards,
Karli




More information about the petsc-dev mailing list