STYLE and uncrustify

Tomi Ollila tomi.ollila at iki.fi
Tue Jun 11 12:54:50 PDT 2019


On Fri, Jun 07 2019, David Bremner wrote:

> I'm pondering running uncrustify on all/most of the notmuch codebase,
> but I noticed a few things that uncrustify does are either not
> documented in STYLE, or maybe contradicted.
>
> 1) Should block comments start with '*' ? Uncrustify thinks yes, STYLE
>    is silent, the codebase says mostly yes.  I think update STYLE to
>    match uncrustify here.

agreed.

> 2) Should there be a space after '!'? Uncrustify says yes, STYLE is
>    silent, the codebase is inconsistent. Updating STYLE would be the
>    easy thing here, but I remember previous discussions being
>    inconclusive.

IIRC e.g (! foo) has been the agreed style. Unfortunately uncrustify also
replaces '!!' with '! ! ' and there is no option to suspend this. This
would be super-easy to post-process but then we could not use the checking
option of uncrustify -- one option is to 'ignore' that in config, then
uncrustify won't change...

> 3) Similar for space between '++' and '--' and operand

There perhaps is an uncrustify option for this. I cannot remember for that
either (perhame email/irc logs would tell something...)  I would have
guessed that no space there but ...

> 4) uncrustify wants to move 'const char* foo' to 'const char *foo'.

Again, would have guessed that char *foo is the syntax but...

> That's about all I have patience for at the moment.
>
> When I say 'uncrustify', I really mean 'our current uncrustify
> config'. I don't know offhand how hard any of these items are to change.


We do have quite a few things where we cannot configure uncrustify to 
indent like emacs does: one is:

    variable = function_call
        (arg1, arg2)

which will indent:

    variable = function_call
                   (arg1, arg2)

or, if    

    use_indent_continue_only_once  = true

is set

    variable = function_call
               (arg1, arg2)


(getting all above figured out took like 100 minutes, by checking
Uncrustify-0.68_f options and some trial/error runs...)

before going to sleep (and interrupting diffing *.c w/ corresponding
*.uncrustify files...) we could change all above cases to

    variable = function_call(
        arg1, arg2)

then (IIRC, too tired to re-check) should indent like emacs(1) does...


Tomi

>
> d


More information about the notmuch mailing list