Commit Graph

122 Commits

Author SHA1 Message Date
Brad King 86578eccf2 Simplify CMake per-source license notices
Per-source copyright/license notice headers that spell out copyright holder
names and years are hard to maintain and often out-of-date or plain wrong.
Precise contributor information is already maintained automatically by the
version control tool.  Ultimately it is the receiver of a file who is
responsible for determining its licensing status, and per-source notices are
merely a convenience.  Therefore it is simpler and more accurate for
each source to have a generic notice of the license name and references to
more detailed information on copyright holders and full license terms.

Our `Copyright.txt` file now contains a list of Contributors whose names
appeared source-level copyright notices.  It also references version control
history for more precise information.  Therefore we no longer need to spell
out the list of Contributors in each source file notice.

Replace CMake per-source copyright/license notice headers with a short
description of the license and links to `Copyright.txt` and online information
available from "https://cmake.org/licensing".  The online URL also handles
cases of modules being copied out of our source into other projects, so we
can drop our notices about replacing links with full license text.

Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority
of the replacements mechanically.  Manually fix up shebang lines and trailing
newlines in a few files.  Manually update the notices in a few files that the
script does not handle.
2016-09-27 15:14:44 -04:00
Daniel Pfeifer 1a9de8035c surround macro arguments with parentheses 2016-09-05 22:09:49 +02:00
Daniel Pfeifer 3849164454 CTest: fix include-what-you-use violations 2016-08-25 09:34:37 -04:00
Daniel Pfeifer 50ad1e0a14 CTest: don't use else after return 2016-08-18 20:04:21 +02:00
Daniel Pfeifer 1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Daniel Pfeifer c6220de276 Use the empty() method to check for emptyness.
Apply fix-its from clang-tidy's readability-container-size-empty
checker.
2016-06-02 21:35:50 +02:00
Daniel Pfeifer 5784747d1b Improve string find: prefer character overloads.
Apply fix-its from clang-tidy's performance-faster-string-find checker.
Ignore findings in kwsys.
2016-05-24 23:22:24 +02:00
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 eafe541ff6 CTest: Do not treat "Note: ..." lines as errors (#14394)
Otherwise CTest interprets the Qt5 moc tool output

    Note: No relevant classes found. No output generated.

as a compiler error.
2016-05-11 09:56:51 -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
Stephen Kelly 74d565e0e9 Remove unused cmLocalGenerator include. 2015-10-05 20:59:56 +02:00
Daniel Pfeifer 140b186480 CTest: hide progress ticks in verbose output
The progress ticks and information about the length of the output are
useful when the actual output is not visible.  When the output is
printed, the progress ticks

* add no useful information,
* do not look pretty, and
* make the output hard to parse for tools.
2015-07-06 14:04:35 -04:00
Brad King 0c24c2311b Merge topic 'ctest-xml-refactor'
de2ef305 cmCTest: Drop unused method overloads
b04500a7 cmCTest{Test,MemCheck}Handler: Port to cmXMLWriter
8fbc509a cmCTestCoverageHandler: Port to cmXMLWriter
82455a9d cmCTestBuildHandler: Port to cmXMLWriter
1dbd86fd cmCTestLaunch: Port to cmXMLWriter
a53bd63e cmCTest: Port GenerateNotesFile to cmXMLWriter
9c0bb7d8 cmCTestConfigureHandler: Port to cmXMLWriter
6cf5cc71 cmCTestUploadHandler: Port to cmXMLWriter
ed42c203 cmCTestUpdateHandler: Port to cmXMLWriter
18825baf cmCTest: Port to cmXMLWriter
f6413400 Add cmXMLWriter class to consolidate XML generation
2015-05-28 09:56:53 -04:00
Brad King cc55c33ed5 Merge topic 'ctest-update-gmake-error-match'
44a4e545 ctest_build: Fix regression in GNU make error message matching
2015-05-28 09:56:49 -04:00
Zack Galbreath 44a4e54547 ctest_build: Fix regression in GNU make error message matching
The regex update in commit v3.1.2~4^2 (ctest_build: Update GNU make
error message matching, 2015-01-28) broke matching of the messages it
updated.  Remove the escape character before the square brackets added
by that commit.
2015-05-27 11:48:38 -04:00
Daniel Pfeifer 82455a9d3a cmCTestBuildHandler: Port to cmXMLWriter 2015-05-26 11:09:22 -04:00
Stephen Kelly 7916d7bac6 Include cmAlgorithms where it is used. 2015-03-11 00:17:29 +01:00
Zack Galbreath 49ba4545c2 ctest_build: Add QUIET option 2015-02-23 10:01:59 -05:00
Brad King 983a98e5b8 Merge topic 'ctest-update-gmake-error-match'
d52b5f88 ctest_build: Update GNU make error message matching (#15379)
2015-01-29 09:13:56 -05:00
Marco Nolden d52b5f8835 ctest_build: Update GNU make error message matching (#15379)
The "No rule to make target" error message of gmake is not correctly
recognized since GNU make changed the quoting style in commit 23c2b99e9d
(Convert all "`'" quotes to "''" per new GNU Coding Standard guidelines,
2012-03-04).  Fix our regex to match both old and new quoting styles.
2015-01-28 10:32:06 -05:00
Stephen Kelly fd7b371293 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 509f2713bf ctest_build: Fix logic regression in parent that clips build output
The sweeping pattern change in commit 238dd2fb (Use insert instead of a
loop in some cases, 2014-11-22) accidentally changed the iterator range
used on the queue in cmCTestBuildHandler::ProcessBuffer.  Instead of
ending at the iterator positioned at the next newline to populate
CurrentProcessingLine, it was changed to go to the end of the queue.
This causes the line to contain newlines and possibly be cut off in the
middle of a line.  Fix this regression by restoring use of the proper
end-of-line position.
2015-01-15 09:32:58 -05:00
Stephen Kelly 238dd2fbab Use insert instead of a loop in some cases.
Limit this change to inserting into a vector from a vector.

A follow up change can use insert for inserting into a set.
2015-01-11 17:00:55 +01:00
Stephen Kelly 5eb4d7590e Remove some unneeded c_str calls. 2014-11-23 11:09:54 +01:00
Brad King 210230e216 Merge topic 'remove-borland-build'
2db55ffa Remove borland workarounds.
2014-10-21 15:08:03 -04:00
Stephen Kelly 2db55ffa56 Remove borland workarounds.
CMake 3.0 is the last release to require to be able to build with
Borland.
2014-10-15 23:16:44 +02: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
Bill Hoffman f730313143 CTest: Teach the launchers to honer the max warnings and errors
The ctest launcher code did not respect the number of errors and
warnings limits.  Limit the number of launcher report fragments that we
report in the final submission.
2014-06-25 10:53:34 -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
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
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
Stephen Kelly 4fe963f656 Use new cmHasLiteralPrefix function 2013-11-21 20:53:15 +01: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
Alexandru Ciobanu c7da50da52 CTest: Detect Xcode error "Command ... failed with exit code" 2012-03-09 07:59:56 -05:00
Brad King 56f29f48c2 CTest: Recognize Intel errors without space before colon (#12627)
Fix the regex meant to match errors of the form:

 C:\some\dir\source.cpp(17): catastrophic error: could not open source file "some_header.h"

to make the space between ')' and ':' optional.
2011-12-15 09:31:12 -05:00
Rolf Eike Beer fcf3208ac1 CTest: catch warning output of Apache Maven
Some samples of things that got unnoticed by our nightly builds:

$ JAVA_HOME= mvn
Warning: JAVA_HOME environment variable is not set.
...

$ mvn
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
...
2011-03-18 09:08:33 -04:00
David Cole 89eb4bf356 Improve build error detection.
Some were missed recently on a failed dashboard build
of ccmake on an HP-UX machine.
2011-01-05 16:13:55 -05:00
Brad King a570ba6df7 Merge topic 'external-project-launcher'
b2634b6 Detect CMake warnings and errors in build output.
012c986 ExternalProject: Add LOG_* options to hide step output
2010-07-13 14:58:11 -04:00
David Cole b2634b6aa3 Detect CMake warnings and errors in build output.
Fix niggly in ExternalProject that would inadvertently
create a log file of output when a command was explicitly
set to the empty string.

Also, increase the default value for showing context
around build errors to 10 lines, up from 6. Also add
the ability to customize this setting so that users
can put it back to 6 or even lower if they want, or
show more if they want.
2010-07-10 15:04:31 -04:00
David Cole 415900ba77 Eliminate -Wconversion warnings.
Change types of local variables, or casting, or re-arrange
expressions to get rid of "conversion may alter value" warnings
as seen on recent dashboard submissions from londinium.kitware.
2010-06-27 11:22:05 -04:00
Bill Hoffman fd5b75e3f4 Fix for for bug #10550, fix some errors for an old Sun compiler. 2010-04-28 17:52:46 -04:00
David Cole 0b38bb4c53 Fix issue #2336 - honor the -C arg to ctest. Honor it for all stages of running -D dashboards from the command line and running ctest_configure, ctest_build and ctest_test commands in -S scripts. Also, allow a script to change it by setting the CTEST_CONFIGURATION_TYPE variable: allows for multiple configuration build/test cycles within one script. Add a new signature for the cmake command build_command that accepts CONFIGURATION as one argument. The original build_command signature is still there, but now marked as deprecated in the documentation. Of course... also add CTestConfig tests to verify that -C is honored for -D dashboards and -S scripts. 2009-12-04 12:09:01 -05:00
David Cole 44bcba7461 Fix warnings in CMake source code. Suppress rampant warnings emanating from Qt files. 2009-10-01 16:47:08 -04:00
Brad King 96afb12087 Convert CMake to OSI-approved BSD License
This converts the CMake license to a pure 3-clause OSI-approved BSD
License.  We drop the previous license clause requiring modified
versions to be plainly marked.  We also update the CMake copyright to
cover the full development time range.
2009-09-28 11:43:28 -04:00
Zach Mullen e4293b4b38 Re-enabled failing tests; fixed ctest_build output to be consistent in the error condition across different make programs so that these tests would pass. 2009-09-21 13:40:40 -04:00
Brad King b41a548d86 Add parentheses around '&&' between '||' for gcc
The GNU compiler warns about possible operator precedence mistakes and
asks for explicit parentheses (-Wparentheses).  We add the parentheses
to silence the warning.  This also fixes one real logic error in the
find_package() implementation by correcting expression evaluation order.
2009-09-11 08:18:15 -04:00
Brad King 7435355ec8 ENH: Report file names relative to source dir
This teaches cmCTestLaunch to report source files that lie under the top
source directory relative to the top.
2009-02-12 13:00:22 -05:00