Are you sure that clang-format cannot indent macros? What about

  IndentPPDirectives: PPDIS_AfterHash

It also treats the outmost macro in headers in a special way.

On Sat, 14 Mar 2020, 01:03 Adam Feuer, <a...@starcat.io> wrote:

> David,
>
> Re: whatstyle, I ran it overnight on the c files in sched/ and came up with
> a clang-format that does somewhat ok. Thanks for pointing that program out.
>
> By looking at the output of the diff, I learned a lot about how hard it is
> to manually format programs. :)
>
> Anyway, the biggest problem with clang-format seems to be the way it
> handles C-macros. In NuttX, they are often indented like this:
>
> #ifdef ...
> #  define ...
> #  ifdef ...
> #    define
> #  endif
> #endif
>
> Peter Van Der Perk also mentioned this. There's no stock way to make
> clang-format do that. Maybe a post-processing script that only looked at
> these macros would work. Or a contribution to clang-format. I'll think
> about it some more.
>
> -adam
>
> On Sun, Mar 8, 2020 at 3:40 AM David Sidrane <david.sidr...@nscdg.com>
> wrote:
>
> > Hi Adam,
> >
> > Have a look at https://github.com/mikr/whatstyle
> >
> > I got furthest with clang-format and it. It may be we get a 95% of the
> way
> > there with it and we can add a backend secondary scripts.
> >
> > I was unable to convince Greg to create a master template so my approach
> > was
> > to combine all the files and run it on the set so it would get all the
> > constructs at once.
> >
> > David
> >
>
> --
> Adam Feuer <a...@starcat.io>
>

Reply via email to