[U-Boot] [RFC PATCH] moveconfig: add a second pass for empty #if/#endif blocks

Chris Packham judge.packham at gmail.com
Tue Jun 5 00:56:09 UTC 2018


On Mon, Jun 4, 2018 at 9:49 PM Andy Shevchenko
<andriy.shevchenko at linux.intel.com> wrote:
>
> On Mon, 2018-06-04 at 21:27 +1200, Chris Packham wrote:
> > Moveconfig already attempts to remove empty #if/#endif blocks when
> > there
> > is a matching CONFIG_ being moved. Add a second pass which covers
> > files
> > without a match.
>
> > +    pattern = r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*'
>
> Any reason not to use re.compile() ?

Laziness on my part. Will do in v2.

> > +    with open(header_path) as f:
> > +        data = f.read()
> > +
> > +    new_data = re.sub(pattern, '\n', data, flags=re.M)
>
> --
> Andy Shevchenko <andriy.shevchenko at linux.intel.com>
> Intel Finland Oy


More information about the U-Boot mailing list