Commit Graph

49 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
Brad King 5c10514059 Tests: Simplify LoadCommand tests
Drop out-of-place coverage of CheckFunctionExists module.  The "printf"
symbol is not available on VS 14 without including the <stdio.h> header
to get a definition.
2014-06-25 15:27:01 -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
Brad King 5e45ca6fbf BUG: Finish fixing test for new name. 2007-05-19 10:15:24 -04:00
Bill Hoffman e2ea9391e6 BUG: fix project name for test 2007-05-19 10:10:29 -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
Bill Hoffman 62ae06081e ENH: use native Deployment and Development directories 2005-08-30 13:58:46 -04:00
Bill Hoffman 5eda379907 ENH: clean up loaded command test so you can tell what really failed 2004-10-25 15:08:05 -04:00
Bill Hoffman 7ed631311c FIX: fix RunSingleCommand to work with spaces in the path, and with an already quoted command 2004-10-25 11:59:50 -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 451522381d ENH: Add support for importing modules without specifying path 2004-03-27 19:52:34 -05:00
Andy Cedilnik 92ac3689c9 ENH: More coverage 2003-07-22 12:21:15 -04:00
Bill Hoffman a41e31b536 ENH: add a double try compile to fix crazy make on hp 2003-04-16 13:33:33 -04:00
Bill Hoffman 0f19623edd BUG: fixes for hp 2003-03-11 15:25:50 -05:00
Bill Hoffman 17d8775e82 use module on all platforms 2003-01-15 17:02:35 -05:00
Brad King ea1467d056 ENH: Renamed Modules/CheckSizeOf to Modules/CheckTypeSize for consistency with the macro name that is defined by the module. 2002-12-30 11:02:31 -05:00
Andy Cedilnik 8d20322160 Speedup the test 2002-12-05 11:55:53 -05:00
Ken Martin fd3323177d new plugin API 2002-10-08 15:55:24 -04:00
Andy Cedilnik 332c653586 Check for library 2002-09-25 10:08:46 -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
Andy Cedilnik 571c483ad8 Include more testing 2002-09-20 14:17:32 -04:00
Andy Cedilnik 50423a779e Fix test so that it does some modules testing by checking for some functions and some size of types 2002-09-20 13:17:59 -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 40a99bcd1a removed target 2002-09-18 08:07:53 -04:00
Ken Martin 222b04f6d9 added Destructor 2002-09-17 10:38:34 -04:00
Ken Martin 40fd3b83dc some cleanup 2002-09-17 09:16:04 -04:00
Ken Martin e4690b6df2 minor fix in error message 2002-09-17 08:29:42 -04:00
Ken Martin 885f55b3d0 load command test 2002-09-16 16:27:00 -04:00