On Sun, Jul 24, 2016 at 11:17:36PM +0900, Masahiro Yamada wrote: > The tools/moveconfig.py has a feature to cleanup #define/#undef's > of moved config options, but I want this tool to do a better job. > > For example, when we are moving CONFIG_FOO and its define is > surrounded by #ifdef ... #endif, like follows: > > #ifdef CONFIG_BAR > # define CONFIG_FOO > #endif > > The header cleanup will leave empty #ifdef ... #endif: > > #ifdef CONFIG_BAR > #endif > > Likewise, if a define line between two blank lines > > <blank line> > #define CONFIG_FOO > <blank lines. > > ... is deleted, the result of the clean-up will be successive empty > lines, which is a coding-style violation.
Thanks! This is mildly annoying to find/fixup with regex, which is how I usually do it. A few comments / questions: [snip] > + # remove empty #ifdef ... #endif, successive blank lines > + pattern_ifdef = re.compile(r'#\s*if(def|ndef)?\s') It starts to get complex to catch if defined/elif defined cases, so we should just leave that to manual review, yes? > + pattern_endif = re.compile(r'#\s*endif\s') > + pattern_blank = re.compile(r'^\s*$') The last pattern will catch multiple blank lines, right? -- Tom
signature.asc
Description: Digital signature
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot