On 08/04/2015 09:57 AM, Markus Armbruster wrote:
> The effect of the next few patches on generated files is hard to
> review, because stuff gets generated in different order, which renders
> diffs of the generated files useless.
> 
> To get reviewable diffs, we need to split the generated files into
> suitable parts: put every top-level declaration in a file named like
> the thing declared, so we can diff top-level declarations regardless
> of their order in the generated files.
> 
> Since I don't feel like parsing C, simply generate a // comment
> identifying the declaration right before each top-level declaration.
> This lets us split with a simple shell loop:
> 

Helpful notes to any other reviewer:

Add 'mkdir -p o' here...

>     for i in q*-{commands,marshal,event,types,visit}.[ch]
>     do
>         csplit -n 4 -s "$i" '/^\/\//' '{*}'
>         for j in xx*
>         do
>             read h t <$j
>             [ "$h" == "//" ] || t=""

[ == ] is not portable shell (hi, dash users!); = works fine.

>             mv $j "$i-${j#xx}-${t/ /-}"

...and modify this line to mv $j "o/$i-..." if you want...

>         done
>     done
> 
> Splits each file F into F-NUMB-ID, where NUMB counts up from 0001, and
> ID comes from the // comment.
> 
> To check the split's sane, we can run
> 
>     for i in q*-{commands,marshal,event,types,visit}.[ch]
>     do cat o/$i-* | diff $i -

...this to work out of the box. (will come in handy later when creating
'n/' for comparing 'o/*' and 'n/*').

>     done
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---

Since this patch gets reverted and won't be in v4, it doesn't need R-b.
 But it definitely helps my review, so thanks for providing it!

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to