• Dridi Boukelmoune's avatar
    Style(9) and whitespace OCD · dd28fc73
    Dridi Boukelmoune authored
    Dealing with code style violations around the return keyword, I figured
    I could automate that fix, so I tried with my favourite refactoring tool
    and following those steps:
    
        $ cat >return.cocci <<EOF
        @@
        expression rv;
        @@
    
        - return rv;
        + return (rv);
        EOF
        $ spatch --dir . --in-place --sp-file return.cocci
    
    Unfortunately that leads to proper return statements having their return
    value enclosed twice, like `return ((rv))`. So a bit more steps to go:
    
        $ cat >rereturn.cocci <<EOF
        @@
        expression rv;
        @@
    
        - return ((rv));
        + return (rv);
        EOF
        $ spatch --dir . --in-place --sp-file rreeturn.cocci
    
    At this point you don't want to touch bundled code, right? So let's take
    care of libvgz and shout out to teken that saw no changes at all!
    
        $ git checkout -- lib/libvgz/
    
    The next step is to manually review all the changes, because Coccinelle
    is not aware of how we break lines and unbreaks them. That's quite
    tedious but I was waiting for someone and they are still late as I'm
    describing the whole process.
    
    Care was taken not to touch varnishtest to make it easier to sync with
    vtest. A dedicated patch will follow.
    dd28fc73
vnum.c 8.88 KB