Commit Graph

32 Commits

Author SHA1 Message Date
Kitware Robot d9fd2f5402 Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update
all our C++ code to a new style defined by `.clang-format`.
Use `clang-format` version 3.8.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.
2016-05-16 16:05:19 -04:00
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
Sort include directives within each block (separated by a blank line) in
lexicographic order (except to prioritize `sys/types.h` first).  First
run `clang-format` with the config file:

    ---
    SortIncludes: false
    ...

Commit the result temporarily.  Then run `clang-format` again with:

    ---
    SortIncludes: true
    IncludeCategories:
      - Regex:    'sys/types.h'
        Priority: -1
    ...

Commit the result temporarily.  Start a new branch and cherry-pick the
second commit.  Manually resolve conflicts to preserve indentation of
re-ordered includes.  This cleans up the include ordering without
changing any other style.

Use the following command to run `clang-format`:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '(Lexer|Parser|ParserHelper)\.' |
      egrep -z -v '^Source/cm_sha2' |
      egrep -z -v '^Source/(kwsys|CursesDialog/form)/' |
      egrep -z -v '^Utilities/(KW|cm).*/' |
      egrep -z -v '^Tests/Module/GenerateExportHeader' |
      egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' |
      xargs -0 clang-format -i

This selects source files that do not come from a third-party.

Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00
Kitware Robot 9db3116226 Remove CMake-language block-end command arguments
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block.  This is no longer the preferred style.

Run the following shell code:

for c in else endif endforeach endfunction endmacro endwhile; do
    echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot 77543bde41 Convert CMake-language commands to lower case
Ancient CMake versions required upper-case commands.  Later command
names became case-insensitive.  Now the preferred style is lower-case.

Run the following shell code:

cmake --help-command-list |
grep -v "cmake version" |
while read c; do
    echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
2012-08-13 14:19:16 -04:00
Kitware Robot 7bbaa4283d Remove trailing whitespace from most CMake and C/C++ code
Our Git commit hooks disallow modification or addition of lines with
trailing whitespace.  Wipe out all remnants of trailing whitespace
everywhere except third-party code.

Run the following shell code:

git ls-files -z -- \
 bootstrap doxygen.config '*.readme' \
 '*.c' '*.cmake' '*.cpp' '*.cxx' \
 '*.el' '*.f' '*.f90' '*.h' '*.in' '*.in.l' '*.java' \
 '*.mm' '*.pike' '*.py' '*.txt' '*.vim' |
egrep -z -v '^(Utilities/cm|Source/(kwsys|CursesDialog/form)/)' |
egrep -z -v '^(Modules/CPack\..*\.in)' |
xargs -0 sed -i 's/ \+$//'
2012-08-13 14:18:39 -04:00
Brad King d1aa17a7b0 ENH: Remove CMAKE_ANSI_CFLAGS from tests
As of CMake 2.6 this variable is not defined, and the ANSI flags for the
HP compiler are simply hard-coded in the default C flags.
2009-07-08 11:41:48 -04:00
Ken Martin ce8810c4e7 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Ken Martin 27379d7b08 ENH: make properties a bit more formal with documentation and chaining 2006-12-07 09:45:32 -05:00
Bill Hoffman 60e4fef0c6 ENH: do not use c++ comments in c code 2006-07-26 09:11:04 -04:00
Ken Martin 16a15f3e5e BUG: remove command causing issues with mid build reruns of cmake on vs70 2006-07-25 14:32:55 -04:00
Ken Martin 2433bf4517 ENH: trying a slight change 2006-07-25 12:38:17 -04:00
Ken Martin 814c7e12ab BUG: remove c++comments 2006-07-25 10:46:24 -04:00
Ken Martin 284f6c6835 BUG: temp fix 2006-07-24 16:35:32 -04:00
Ken Martin 42819b7a5d ENH: add more coverage 2006-07-24 15:40:52 -04:00
Ken Martin ad748ce26e BUG: work around XCode issue 2006-07-21 14:05:32 -04:00
Ken Martin 0189ce3424 ENH: increase coverage in a couple places 2006-07-21 10:26:05 -04:00
Bill Hoffman 9891260a6d ENH: add support for watcom wmake and wcl386 2006-01-17 10:21:45 -05:00
Ken Martin 8607e8008b ENH: increase coverage in loaded commands 2005-09-20 12:50:27 -04:00
Andy Cedilnik 50a0936ffc ENH: Remove warning 2004-05-03 12:02:00 -04:00
Bill Hoffman 781a1eaaf9 ENH: fix warnings in test 2004-05-03 08:52:03 -04:00
Bill Hoffman ee9f925509 ENH: remove warnings in tests 2004-05-02 11:50:14 -04:00
Andy Cedilnik 92ac3689c9 ENH: More coverage 2003-07-22 12:21:15 -04:00
Bill Hoffman 17d8775e82 use module on all platforms 2003-01-15 17:02:35 -05:00
Ken Martin fd3323177d new plugin API 2002-10-08 15:55:24 -04:00
Andy Cedilnik ba10f96223 Fix problem 2002-09-23 17:24:47 -04:00
Andy Cedilnik 4ca00b8d3e Some minor fixes for mac 2002-09-23 15:56:28 -04:00
Ken Martin 903796a76a cleanup 2002-09-23 14:57:41 -04:00
Andy Cedilnik d59d94ff6a Fix test so that it will work on HP 2002-09-23 14:11:57 -04:00
Ken Martin e5a8887426 removed c++ style comments 2002-09-20 10:06:00 -04:00
Ken Martin eab24670e3 test passing CMAKE_FLAGS 2002-09-18 11:38:15 -04:00
Ken Martin 222b04f6d9 added Destructor 2002-09-17 10:38:34 -04:00
Ken Martin 885f55b3d0 load command test 2002-09-16 16:27:00 -04:00