Commit Graph

135 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 0ac18d40c8 Remove `//------...` horizontal separator comments
Modern editors provide plenty of ways to visually separate functions.
Drop the explicit comments that previously served this purpose.
Use the following command to automate the change:

    $ git ls-files -z -- \
        "*.c" "*.cc" "*.cpp" "*.cxx" "*.h" "*.hh" "*.hpp" "*.hxx" |
      egrep -z -v "^Source/cmCommandArgumentLexer\." |
      egrep -z -v "^Source/cmCommandArgumentParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmDependsJavaLexer\." |
      egrep -z -v "^Source/cmDependsJavaParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmExprLexer\." |
      egrep -z -v "^Source/cmExprParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmFortranLexer\." |
      egrep -z -v "^Source/cmFortranParser(\.y|\.cxx|Tokens\.h)" |
      egrep -z -v "^Source/cmListFileLexer\." |
      egrep -z -v "^Source/cm_sha2" |
      egrep -z -v "^Source/(kwsys|CursesDialog/form)/" |
      egrep -z -v "^Utilities/(KW|cm).*/" |
      xargs -0 sed -i '/^\(\/\/---*\|\/\*---*\*\/\)$/ {d;}'

This avoids modifying third-party sources and generated sources.
2016-05-09 09:41:43 -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 180538c706 Source: Stabilize include order
Each source file has a logical first include file.  Include it in an
isolated block so that tools that sort includes do not move them.
2016-04-29 13:58:31 -04:00
Joseph Snyder bc29ed542b CTest: Make coverage file selection more specific.
When performing some other testing, the globs for Blanket.js and Delphi
code coverage are picking up unintended files.  Change the query for the
Delphi coverage to follow the naming convention, and check the second line
of the found JSON files for certain text before parsing them as coverage files.
2016-02-25 13:01:37 -05:00
Joseph Snyder 32268810d9 CTest: Expand directories for Cobertura search
Change the Cobertura handler to look for an environment variable
called "COBERTURADIR" which contains the directory where the
coverage.xml file is found.  If that variable doesn't exist,
continue to use the default of the binary directory.

Update the test to use an appropriate value in the environment
variables.
2015-11-23 12:41:36 -05:00
Brad King 96be53aebd Merge topic 'jacoco_out_of_source'
1db32ffe ctest_coverage: Search for Jacoco files in the binary directory
2015-11-16 09:22:41 -05:00
Zack Galbreath 1db32ffe98 ctest_coverage: Search for Jacoco files in the binary directory
Search for Jacoco coverage files in both the source directory
and the binary directory.
2015-11-16 09:08:42 -05:00
Sean McBride 710d8bab7e Fix trivial clang -Wdouble-promotion warnings 2015-11-11 16:27:24 -05:00
Brad King e8585f45f5 Remove use of include <cmsys/stl/*> and cmsys_stl::*
We no longer need this compatibility layer for the compilers we support.
2015-08-20 16:19:08 -04:00
James Johnston b28b07db47 cmCTestCoverageHandle: Improve error handling. 2015-08-08 00:28:38 -04:00
Zack Galbreath e6cf1c489c ctest_coverage: Always do coverage for CTEST_EXTRA_COVERAGE_GLOB
Do not ignore a coverage request if CTEST_EXTRA_COVERAGE_GLOB was
specified.  Prior to this change, if no lines of code were covered by
any tests then CTest would neglect to generate a Coverage.xml file.
This change allows us to report uncovered files for a project with no
tests.
2015-07-13 14:17:59 -04:00
Daniel Pfeifer 8fbc509a48 cmCTestCoverageHandler: Port to cmXMLWriter 2015-05-26 11:09:22 -04:00
Zack Galbreath fc58bdb9ad ctest_coverage: Add QUIET option 2015-02-23 10:02:00 -05:00
Stephen Kelly 421eadb45b Remove use of cmsys_stl.
It is not needed.
2015-02-05 20:44:25 +01:00
Stephen Kelly fd7b371293 Replace foo.size() pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly aa773035b7 Replace !foo.size() pattern with foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly 930bd47816 Replace 'foo.size() == 0' pattern with foo.empty(). 2015-01-18 14:25:24 +01:00
Stephen Kelly d92887efab Replace 'foo.size() > 0' pattern with !foo.empty(). 2015-01-18 14:25:24 +01:00
Brad King b5a467262b Merge topic 'drop-ancient-workarounds'
0f7bdd61 Remove VS 6 special case.
5e92c826 Remove some obsolete stuff.
15e42bb2 cmStandardIncludes: Remove obsolete cmOStringStream.
931e055d Port all cmOStringStream to std::ostringstream.
f194a009 Remove unused cmIStringStream class.
3ec1bb15 cmStandardIncludes: Remove std namespace hack.
bb3bce70 cmStandardIncludes: Remove ANSI_FOR_SCOPE hack.
28fa4923 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler.
837a8a63 cmStandardIncludes: Drop Comeau-related workaround.
4030ddfd Remove Borland-related undef.
17d6a6fd cmStandardIncludes: Remove comment about Borland.
26fb5011 Drop SGI as a CMake host compiler.
2015-01-12 08:57:39 -05:00
Stephen Kelly 931e055d8c Port all cmOStringStream to std::ostringstream.
All compilers hosting CMake support the std class.
2015-01-11 17:06:03 +01:00
Stephen Kelly 6162c9194b Use two-iterator std::set::insert where appropriate. 2015-01-11 17:00:55 +01:00
Vladislav Vinogradov 9c4984b4e5 ctest_coverage: Fix error message to report the file name
Print file name instead of line content for "Looks like there are more
lines in the file:" error message.
2014-12-22 09:25:24 -05:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Joseph Snyder 220e81345b CTest: Add Javascript coverage parser
Add a coverage parser for the Blanket.js library using the JSON output of
the mocha.js test runner.

Add a test for the new parser.
2014-10-29 11:27:11 -04:00
Brad King ae5686f8d0 Merge topic 'remove-redundant-c_str'
cc1139cc strings: Remove redundant calls to std::string::c_str()
2014-10-21 15:08:01 -04:00
Joseph Snyder 5c31c3e4eb CTest: Add code coverage parser for Pascal/Delphi
Add a class to parse the HTML output of the Delphi-code-coverage tool

 http://code.google.com/p/delphi-code-coverage/

Add a test for the new parser.
2014-10-21 15:02:20 -04:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Joseph Snyder 558c2190e8 CTest: Add Jacoco Coverage functionality
Add the ability to parse the XML output of the Jacoco tool.

Jacoco (www.eclemma.org/jacoco) is a Java coverage tool.
Add and integrate a class for the parser and
include a test which utilizes the new parser.
2014-06-12 10:38:19 -04:00
Joseph Snyder a2822d3089 CTest: Rename coverage implementation for "Python" to "Cobertura"
The coverage.py tool writes out an XML that conforms to the Cobertura
Coverage tool standard.  Rename the cmParsePythonCoverage files to
instead be cmParseCoberturaCoverage.
2014-06-04 14:21:52 +00:00
Volkan Gezer 9840320dff CTest: Add support for Intel coverage files
By default, Intel compiler coverage tools generate HTML files as
reports, but the option -txtlcov can be given to codecov to output a
coverage file with LCov format.

To use Intel coverage:

* build the project with coverage flags
* run the application
* run profmerge
* run codecov

The output file will be "build_dir/CodeCoverage/SRCFILEDIR.LCOV".

Ask users to compile with -prof-dir${BUILD_DIR} instead of searching
the entire build tree recursively to find coverage files.
2014-03-13 16:18:10 -04:00
Stephen Kelly af8a1643c1 Remove c_str calls when using stream APIs.
Use an ad-hoc clang tool for matching the calls which should be
ported.
2014-03-11 15:03:50 +01:00
Stephen Kelly 21c573f682 Remove some c_str() calls.
Use the clang RemoveCStrCalls tool to automatically migrate the
code. This was only run on linux, so does not have any positive or
negative effect on other platforms.
2014-03-11 15:03:50 +01:00
Ben Boeckel 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Zack Galbreath 0a6f028067 CTest: notify user if gcov cannot be found
Emit an error message when we're performing coverage using
gcov and the gcov executable cannot be found.
2014-02-28 09:23:03 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Nils Gladitz eb1d6cef2f CTest: clean TargetDirs between unrelated coverage runs (issue 13143) 2013-10-29 08:13:21 +01:00
Patrick Reynolds d0ec3a01a6 Adding support for the Python coverage.py tool.
This assumes that coverage.py has been run in such a way to produce its
standard XML output. This uses the Cobertura schema and should be somewhat
generalizable.
2013-10-08 09:20:30 -04:00
David Cole 61ace1df26 CTest: Coverage handler: expect certain output lines from gcov 4.7 (#13657)
And do not report them as errors.
2012-12-10 17:03:57 -05: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
David Cole 8e9101a0cb Merge topic 'mumps_coverage'
c806b23 CDash now supports lots of files in coverage. So, show all files.
761d931 Do not try to run bullseye coverage if COVFILE env is empty.
5b69ce4 Update test data to match new coverage format.
1b418f1 Change GT.M Coverage Parser global
b0c07a1 Disable bullseye coverage for mumps coverage test.
0a169e6 Remove uncovered files from cache coverage data.
a7abf5e Add ability to specify more than one package directory or coverage directory.
220afca Use <TARGET_FILE> expression to run ctest so it works with Xcode and VS IDE.
62f6bce Use a script to run the test because WORKING_DIRECTORY is not in 2.8.2.
f5c5db0 Fix some warnings and a bug where it went past the length of a vector.
7955e99 Add support for Cache coverage.
a86cd33 Add virutal destructor to silence warning.
319eeb0 Add test for mumps coverage. Also refactor code to prepare for cache coverage.
72210c2 Fix line length.
dd07161 Fix warning about char* instead of const char*.
e6412e0 Add support to ctest for GTM mumps coverage.
2012-05-17 14:58:54 -04:00
Bill Hoffman c806b23cfe CDash now supports lots of files in coverage. So, show all files.
Prior to this commit the mumps coverage only showed files that
had at least one line of coverage. Now 0% covered files are shown
as well.
2012-05-11 15:22:25 -04:00
Bill Hoffman 761d93129f Do not try to run bullseye coverage if COVFILE env is empty. 2012-05-08 14:47:13 -04:00
David Cole 56f499dcef CTest: Modify reg ex so it also works with gcov 4.7 output (#13121) 2012-05-03 17:08:19 -04:00
Bill Hoffman 7955e995ec Add support for Cache coverage.
This adds support for Cache coverage parsing. A test is added
that does a basic run of the coverage on a small bit of data.
2012-05-01 17:00:43 -04:00
Bill Hoffman 319eeb0247 Add test for mumps coverage. Also refactor code to prepare for cache coverage.
Add a simple test to make sure the GTM mumps coverage is working.
Also refactor the code so that cache coverage can be added.
2012-05-01 13:35:07 -04:00
Bill Hoffman 72210c2662 Fix line length. 2012-04-26 08:33:27 -04:00
Bill Hoffman e6412e084e Add support to ctest for GTM mumps coverage. 2012-04-25 17:04:28 -04:00
Brad King 3247d63abb ctest_coverage: Save/restore LC_ALL around gcov (#13136)
Commit ffbe61bb (make sure english is used for output of gcov, 2008-05-10)
taught ctest_coverage to set LC_ALL=POSIX to get English output from gcov.
Use the more portable value LC_ALL=C and restore the original value when
finished.
2012-04-16 08:48:16 -04:00
Rolf Eike Beer 58d75e22ae CTest: mark all gcov covered files as covered
Even if there are no lines covered in the file the gcov coverage report still
contains valueable information, the amount of uncovered lines and which exactly
they are. Set 'Covered="true"' for files we have a gcov report for even if they
have no lines covered. Otherwise CDash will neither show the uncovered line
count nor the detailed coverage report for this file.

When CTEST_EXTRA_COVERAGE_GLOB was used to collect otherwise uncovered files
'Covered="true"' was unconditionally set, so this can't be worse here.
2012-02-15 21:45:30 +01:00