Pre- or post- processor I meant, depending on what would work best. -adam
On Sun, Mar 8, 2020 at 2:29 PM Adam Feuer <a...@starcat.io> wrote: > Thanks Greg. I haven't tried indent, I will try it with the config you > suggest, if it can get close I'll try a pre-processor script with it too. > > -adam > > On Sun, Mar 8, 2020 at 2:21 PM Gregory Nutt <spudan...@gmail.com> wrote: > >> The best pretty printer for NuttX that I am aware of is still >> tools/indent.sh. It consistently screws up a few things (as listed in >> tools/README.txt). But the screw-ups are relatively easy and probably >> could be postprocesses. The astyle and uncrustify stuff in tools/ is >> pretty must useles. >> >> But none of the tools handle subtle things, like aligned of assignments >> on = operators like: >> >> dog = bat; /* Assign dog */ >> pony = lizard; /* Assign pony */ >> aardvark = pangolin; /* Assign aardvark */ >> >> and none handle this awful case: >> >> #ifdef HAVE_SOMETHINGELSE >> if (something == somethingelse) >> { >> do(somethingelse); >> } >> else >> #endif >> if (something == nothing) >> { >> do(nothing); >> } >> >> It is not clear what the indentation should be for the if outside of the >> #ifdef.. #endif. Most code aligns that if as though the previous >> conditional logic did not exist. >> >> Another issue is the unconditional compound statement which breaks all >> of indentation rules (but this is an nxstyle problem). >> >> { >> int i >> for (i = 0; i < n; i++) >> { >> handle(i); >> } >> } >> >> The outer {} is indented only by two which makes the indentation of all >> of the inner stuff appear wrong to nxstyle. >> >> >> > > -- > Adam Feuer <a...@starcat.io> > -- Adam Feuer <a...@starcat.io>