Commit Graph

47 Commits

Author SHA1 Message Date
Daniel Pfeifer
2e620f0b38 Fix several include-what-you-use findings 2016-11-08 09:42:04 -05:00
Stephen Kelly
e0a84904eb cmState: Split auxiliary classes into separate files
Port dependents to the new locations as needed.

Leave behind a cmState.h include in cmListFileCache to reduce noise. It
is removed in a following commit.
2016-10-19 15:40:59 +02:00
Stephen Kelly
cde6eb6249 cmState: Port dependent code to new cmStateSnapshot name 2016-10-19 15:40:59 +02:00
Stephen Kelly
17d27893e6 cmState: Port dependent code to new cmStateDirectory name 2016-10-19 15:40:58 +02:00
Stephen Kelly
fd93b3605b cmOutputConverter: Add a flag for IsUnix
Remove the need for method parameters to represent the distinction.
2016-10-06 20:02:10 +02:00
Stephen Kelly
1365e18b9b Convert: Inline platform-specific methods
They don't provide real value.
2016-10-06 20:02:09 +02:00
Stephen Kelly
c3264f48c2 Convert: Extract method to determine if paths are in directory
The conditional early return can be moved to clients, which would have
many benefits, notably making cmOutputConverter independent of
directory-specific state.
2016-10-06 20:02:06 +02:00
Stephen Kelly
52168f3210 Convert: Remove asserts which are duplicated in delegate method
This means that we don't encounter the asserts in the case where we
early-return from here.
2016-10-06 20:02:05 +02:00
Stephen Kelly
5213f8936f Convert: Remove early return check
This function delegates to another function which does the same check.
2016-10-06 20:02:05 +02:00
Stephen Kelly
b61c268bd0 Convert: Extract local variables for readability 2016-10-06 20:02:04 +02:00
Stephen Kelly
e278f5a848 Convert: Extract local variables
Remove comment made obsolete by them.
2016-10-06 20:02:03 +02:00
Daniel Pfeifer
51bc6bddb9 cmOutputConverter: remove unused code
Remove old ConvertToRelativePath function now that all clients have
migrated to the new signature.
2016-10-06 18:45:18 +02:00
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
Stephen Kelly
6429d6d9dd cmOutputConverter: Remove now-obsolete Convert method 2016-09-19 21:36:15 +02:00
Stephen Kelly
4cf707b083 Convert: Remove HOME_OUTPUT enum value 2016-09-19 21:36:14 +02:00
Stephen Kelly
76833149ec Convert: Simplify switch
Make it more clear what is happening here.
2016-09-19 21:36:14 +02:00
Stephen Kelly
dc95020efa Convert: Remove obsolete MAKERULE enum value 2016-09-19 21:36:13 +02:00
Stephen Kelly
f1d845ae74 Convert: Remove obsolete HOME and START enum values 2016-09-19 21:36:12 +02:00
Daniel Pfeifer
8d47a20f13 cmOutputConverter: use new ConvertToRelativePath signature internally 2016-09-17 10:29:49 +02:00
Daniel Pfeifer
149af87b86 cmOutputConverter: split ConvertToRelativePath
Split the ConvertToRelativePath funtion into ConvertToRelativePath and
ForceToRelativePath.  Both functions take the local path as a string
rather than a vector of path segments.  Reimplement the old interface on
top of the two new functions for interface compatibility.
2016-09-17 10:29:48 +02:00
Daniel Pfeifer
efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Stephen Kelly
4332131dcc Convert: Make variables a bit more clear 2016-08-27 15:41:18 +02:00
Stephen Kelly
146bf9267c Convert: Remove 'FULL' conversion
It is no longer used.
2016-08-27 15:41:17 +02:00
Stephen Kelly
564d3a1dc8 Convert: Extract ConvertToRelativePath from Convert()
Convert() does some kind of relative conversion, followed by a
conversion to 'output format'.

Make it possible to do the former without the latter.
2016-08-27 15:26:37 +02:00
Stephen Kelly
5ad25ef4b6 Convert: Remove NONE conversion
It is no longer used.
2016-08-27 15:26:37 +02:00
Stephen Kelly
fbd8394867 Convert: Remove obsolete GetRelativeRootPath 2016-08-27 13:44:53 +02:00
Stephen Kelly
ad70a236f4 Convert: Remove ConvertToOutputForExisting overload
It is no longer used.
2016-08-27 13:44:52 +02:00
Stephen Kelly
9440d5776b Convert: Remove unused overload 2016-08-27 13:44:51 +02:00
Daniel Pfeifer
1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04:00
Daniel Pfeifer
8ddbd4c280 cmOutputConverter: remove unnecessary conversion 2016-06-20 23:18:59 +02:00
Daniel Pfeifer
bdaadbdc2b cmOutputConverter: collapse ConvertToOutputForExisting functions 2016-06-20 23:11:05 +02:00
Daniel Pfeifer
191fc3a0f3 cmOutputConverter: remove unused 'local' argument 2016-06-20 23:03:28 +02:00
Daniel Pfeifer
b86007e385 cmOutputConverter: remove 'optional' argument
Remove the 'optional' paramenter from the second overload of the Convert
function.  This parameter is used from one single location.  Inline the
codepath for which the argument is true to the callsite.
2016-06-20 22:32:02 +02:00
Daniel Pfeifer
cde127b084 cmOutputConverter::Convert: invert condition
Make the control flow of the 'optional' argument more explicit.
2016-06-20 22:12:36 +02:00
Daniel Pfeifer
c23f89bc76 cmOutputConverter::Convert: make precondition explicit 2016-06-20 22:11:20 +02:00
Daniel Pfeifer
d645b03e9c cmOutputConverter: implement Shell__GetArgument using ostringstream
This removes the need to calculate the resulting string length
beforehand.
2016-06-15 23:44:37 +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
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
c50285dee6 cmOutputConverter: Assert construction with a valid snapshot
We unconditionally use information from the snapshot so it must be
valid.
2016-04-15 08:34:05 -04:00
Stefan Kislinskiy
ca6ba3fee5 Genex: Add a SHELL_PATH expression
Some commands on Windows do not understand forward slash paths and
require backslashes.  In order to help projects generate shell
invocations of such commands, provide a generator expression to convert
paths to the shell-preferred path format for the current generator.
This will allow custom commands to generate paths the same way CMake
does for compiler command invocations.
2015-09-28 10:37:33 -04:00
Stephen Kelly
8ea0b81d20 cmAlgorithms: Rename cmRange to cmMakeRange. 2015-07-22 10:58:19 -04:00
Stephen Kelly
9ebc7502b2 cmState: Extract a Directory class.
Move Directory-scoped state accessors to it.  This will be expanded
with directory property state soon.
2015-07-18 19:37:58 +02:00
Brad King
df97bea242 cmOutputConverter: Adopt command line escaping code
Port code from the KWSys System_Shell APIs into cmOutputConverter.
Drop it from our copy of KWSys because upstream will drop it too,
and by doing it in this commit 'git blame' may have an easier time
connecting the history of the content.
2015-07-08 09:09:49 -04:00
Brad King
bb7eefe4dd cmOutputConverter: Adopt EscapeWindowsShellArgument method
Move it out of cmSystemTools and into cmOutputConverter.
2015-07-08 09:00:00 -04:00
Stephen Kelly
ccf7760f00 cmOutputConverter: Constify API. 2015-06-21 20:13:28 +02:00
Stephen Kelly
6d7abb6326 cmOutputConverter: Extract from cmLocalGenerator.
The Convert methods never belonged to the local generator concept, so
split them out now.  The cmOutputConverter is cheap to construct and
destroy, so it can be instantiated where needed to perform
conversions.  This will allow further decoupling of cmLocalGenerator
from the configure step.

Inherit cmLocalGenerator from cmOutputConverter for the purpose of
source compatibility.
2015-06-06 09:15:55 +02:00