Commit Graph

27 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 7fa8e532b6 Tests/X11: Add missing include <stdlib.h> for 'rand' 2012-07-18 09:59:15 -04:00
Bill Hoffman 3ca9bf797c ENH: make sure tests for cpack are run correctly 2009-04-21 17:15:42 -04:00
Bill Hoffman c8513fe14b ENH: make sure tests for cpack are run correctly 2009-04-21 17:15:04 -04:00
Bill Hoffman 0bbed87a5b ENH: make sure tests for cpack are run correctly 2009-04-21 17:13:46 -04:00
Bill Hoffman 572cf0212f ENH: make sure tests for cpack are run correctly 2009-04-21 17:12:37 -04:00
David Cole c647ed54d9 BUG: Fix issue #7833: Add file extension handling to CPack generated installers for OSXX11 applications. Also modify the X11 test to build such an installer on Mac builds that test CPack and have X11 available. Thanks to Wes Turner for the patch. 2009-01-21 11:54:30 -05:00
Bill Hoffman 94f40300e8 ENH: add a simple x11 test for packaging 2008-04-11 10:23:27 -04:00
Bill Hoffman ee867fb1b2 ENH: add a simple x11 program 2008-04-11 09:52:08 -04:00
Ken Martin ce8810c4e7 ENH: preclean some warnings 2008-03-25 11:27:18 -04:00
Bill Hoffman f7c1723135 ENH: add support for universal binaries 2006-03-24 09:15:05 -05:00
Andy Cedilnik 8e13e2de90 ERR: Fix test to use post CMAKE_X_LIBS variables 2004-07-29 11:11:05 -04:00
Andy Cedilnik 8b1d032b7b Change name of variable 2003-01-08 11:53:55 -05:00
Brad King ccb93dc2f4 ERR: Project name and executable name should match for consistency in the X11 test. 2002-12-18 09:38:34 -05:00
Brad King 5abc8c18c0 BUG: Renamed X11 test executable to useX11 to avoid conflict with name of library. 2002-12-17 13:28:49 -05:00
Andy Cedilnik bde5ee3f44 Try to fix test 2002-11-06 08:52:25 -05:00
Andy Cedilnik 8ac50c4aad Try to fix FindX11 2002-11-05 07:15:42 -05:00
Andy Cedilnik 14ab03ff69 Simplify 2002-11-05 07:06:00 -05:00
Andy Cedilnik 23dde130c7 Fix test 2002-11-04 11:54:30 -05:00
Andy Cedilnik 7f0cbaa5ee Try to make test to run 2002-11-03 18:18:04 -05:00
Andy Cedilnik ea2001e6e5 Print message on system without X11 2002-10-29 15:58:35 -05:00
Andy Cedilnik a43958f4f0 Add Windows code 2002-10-29 15:54:40 -05:00
Andy Cedilnik 2d970c26f0 Add test for X11 2002-10-29 15:46:38 -05:00