[cmake-developers] Development pause for sweeping style changes

Stephen Kelly steveire at gmail.com
Fri Aug 10 11:32:16 EDT 2012


David Cole wrote:

> On Fri, Aug 10, 2012 at 10:57 AM, Brad King
> <brad.king at kitware.com> wrote:
>>> Do you also have a script to clear the contents of endforeach(),
>>> endif(), endmacro(), endfunction()? Or do you not want to do that?
>>
>> That's a bit more risky because sometimes they span multiple lines.
>> I'd rather not tackle it now.
>>

I looked through the git grep output for the end commands and saw none in 
the Modules dir which spanned multiple lines (there's a small handful in 
Tests/BuildDepends/CMakeLists.txt, but that's it). 

I then ran the following script to strip them:

git grep -l "endif([^\)]\+)" Modules | xargs sed -i 's|endif(.*|endif()|'
git grep -l "endforeach([^\)]\+)" Modules | xargs sed -i 's|endforeach(.*|
endforeach()|'
git grep -l "endfunction([^\)]\+)" Modules | xargs sed -i 's|endfunction(.*|
endfunction()|'
git grep -l "endmacro([^\)]\+)" Modules | xargs sed -i 's|endmacro(.*|
endmacro()|'
git grep -l "endwhile([^\)]\+)" Modules | xargs sed -i 's|endwhile(.*|
endwhile()|'

The script is a bit naive, but on manual review I saw no mistakes. This one 
doesn't catch the cases which have whitespace between the 'endif' and the 
'(', but I also ran the script catching those without finding a problem on 
manual review. The question of whether that style should be normalized too, 
ie should 

if (Foo)
endif ()

be changed to 

if(Foo)
endif()

now. (should be an easy script).

> But after the sweeping changes, I would certainly welcome clean up
> commits that clear the end*() arguments. "Clean up" topics are always
> welcome. We won't merge them in during the middle of "release
> candidates" -- but we'll do it immediately after a release for sure.

Sounds good, but such commits have to go in immediately when they are made 
or they will go stale and have to be rebased/regenerated/re-reviewed. So 
it's kind of hard to coordinate.

Thanks,

Steve.





More information about the cmake-developers mailing list