[U-Boot] [PATCH] configs: Remove empty #ifdef/#ifndef blocks from configs
Alex Kiernan
alex.kiernan at gmail.com
Sun Jun 3 14:20:02 UTC 2018
On Sun, Jun 3, 2018 at 12:18 PM Chris Packham <judge.packham at gmail.com> wrote:
>
>
>
> On Sun, 3 Jun 2018, 8:15 AM Alex Kiernan, <alex.kiernan at gmail.com> wrote:
>>
>> Remove empty #ifdef/#ifndef..#endif blocks where the configuration they
>> guarded has been completely removed.
>>
>> Signed-off-by: Alex Kiernan <alex.kiernan at gmail.com>
>
>
> 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).
--
Alex Kiernan
More information about the U-Boot
mailing list