On Mon, Jun 4, 2018 at 2:20 AM Alex Kiernan <[email protected]> wrote:
>
> On Sun, Jun 3, 2018 at 12:18 PM Chris Packham <[email protected]> wrote:
> >
> >
> >
> > On Sun, 3 Jun 2018, 8:15 AM Alex Kiernan, <[email protected]> wrote:
> >>
> >> Remove empty #ifdef/#ifndef..#endif blocks where the configuration they
> >> guarded has been completely removed.
> >>
> >> Signed-off-by: Alex Kiernan <[email protected]>
> >
> >
> > Just out of interest how did you perform these changes? I sent a similar 
> > patch for some kirkwood boards (manually generated) but I knew there was 
> > bound to be more. If we could automate the process it could be integrated 
> > with moveconfig.py.
>
> Some horrid (and pretty dumb) sed & awk, something like:
>
> for f in include/configs/*.h; do awk '/^\s*#\s*if/ {n=NR};
> /^\s*#\s*endif/ && NR == n+1 {print n"d;"NR"d;"}' $f | sed -f - -i $f;
> done
>
> It was seeing yours that reminded I'd tripped over a few of them when
> doing moveconfig.py manipulations and I should probably clean them up.
> I did wonder if unifdef could be persuaded to do it, but I couldn't
> immediately see a way of making it (without explicitly adding support
> for it).

Python has a multi-line regex support so I think I've figured out a
way to automate it using that.
_______________________________________________
U-Boot mailing list
[email protected]
https://lists.denx.de/listinfo/u-boot

Reply via email to