Commit Graph

51 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 efed6468ed fix a load of include-what-you-use violations 2016-09-03 08:04:56 -04:00
Daniel Pfeifer 3838a0d5fb make sure to include cmConfigure.h before cmStandardIncludes.h 2016-09-03 08:04:22 -04:00
Stephen Kelly 1462576bcb Parser: Port away from cmMakefile
It is an unneeded dependency.
2016-08-25 09:47:27 -04:00
Stephen Kelly 905e738ffe Parser: Out-of-line conditional code to cmMakefile
Simplify parser API.
2016-06-13 20:19:16 +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 7c36d2067b cmListFileBacktrace: Refactor storage to provide efficient value semantics
Since commit v3.4.0-rc1~321^2~2 (Genex: Store a backtrace, not a pointer
to one, 2015-07-08) we treat cmListFileBacktrace instances as
lightweight values.  This was true at the time only because the
backtrace information was kept in the cmState snapshot hierarchy.
However, that forced us to accumulate a lot of otherwise short-lived
snapshots just to have the backtrace fields available for reference by
cmListFileBacktrace instances.  Recent refactoring made backtrace
instances independent of the snapshot hierarchy to avoid accumulating
short-lived snapshots.  This came at the cost of making backtrace values
heavy again, leading to lots of string coying and slower execution.

Fix this by refactoring cmListFileBacktrace to provide value semantics
with efficient shared storage underneath.  Teach cmMakefile to maintain
its call stack using an instance of cmListFileBacktrace.  This approach
allows the current backtrace to be efficiently saved whenever it is
needed.

Also teach cmListFileBacktrace the notion of a file-level scope.  This
is useful for messages about the whole file (e.g. during parsing) that
are not specific to any line within it.  Push the CMakeLists.txt scope
for each directory and never pop it.  This ensures that we always have
some context information and simplifies cmMakefile::IssueMessage.
Push/pop a file-level scope as each included file is processed.  This
supersedes cmParseFileScope and improves diagnostic message context
information in a few places.  Fix the corresponding test cases to expect
the improved output.
2016-04-18 09:21:19 -04:00
Brad King 1f6bd8a93f cmState: Avoid accumulating snapshot storage for backtraces
Changes during post-3.3/pre-3.4 development refactored storage of most
configure-time information, including variable bindings and function
scopes.  All scopes (even short-lived) were kept persistently for
possible future debugging features, causing huge accumulated memory
usage.  This was mostly addressed by commit v3.4.1~4^2 (cmState: Avoid
accumulating snapshot storage for short-lived scopes, 2015-11-24).

Since then we still keep short-lived scopes when they are needed for a
backtrace.  This is because since commit v3.4.0-rc1~378^2
(cmListFileBacktrace: Implement in terms of cmState::Snapshot,
2015-05-29) backtraces have been lightweight objects that simply point
into the snapshot tree.  While the intention of this approach was to
avoid duplicating the call stack file path strings, the cost turned out
to be holding on to the entire call stack worth of scope snapshots,
which is much worse.

Furthermore, since commit v3.4.0-rc2~1^2 (cmIfCommand: Issue CMP0054
warning with appropriate context, 2015-10-20) all conditions used in
`if()` commands hold a backtrace for use in diagnostic messages.  Even
though the backtrace is short-lived it still causes the scope snapshot
to be kept.  This means that code like

    function(foo)
      if(0)
      endif()
    endfunction()

    foreach(i RANGE 1000000)
      foo()
    endforeach()

accumulates storage for the function call scope snapshots.

Fix this by partially reverting commit v3.4.0-rc1~378^2 and saving the
entire call stack during cmListFileBacktrace construction.  This way
we can avoid keeping short-lived scope snapshot storage in all cases.
2016-04-15 10:31:39 -04:00
Tobias Hunger e1ea1df07e cmListFileCache: Fix warning about inconsistent use of class/struct
Exposed by Clang trunk.
2016-02-11 13:38:02 -05:00
Brad King 9342a4c203 Merge branch 'reduce-cmState-accumulation' into reduce-cmState-accumulation-for-master 2015-11-25 12:33:06 -05:00
Brad King bc1d3a8a87 cmListFileCache: Implement cmListFileBacktrace ctor/dtor out-of-line 2015-11-25 10:36:52 -05:00
Stephen Kelly a8429a402d cmTarget: Split storage of link implementation from backtraces. 2015-10-08 23:41:29 +02:00
Stephen Kelly 52f2261685 cmListFileBacktrace: Constify API. 2015-07-18 11:10:15 +02:00
Stephen Kelly d2475bb5c4 cmListFileBacktrace: Implement in terms of cmState::Snapshot.
Avoid copying many strings into each backtrace object.
2015-07-06 11:22:42 -04:00
Stephen Kelly 238aac2351 cmListFile: Remove FilePath member from cmListFileContext.
There is no need to store the FilePath for every function, as it is
known by other means.
2015-07-06 11:22:41 -04:00
Stephen Kelly 782657db48 cmListFileArgument: Remove FilePath member.
It is now unused.
2015-06-21 20:57:26 +02:00
Stephen Kelly 242dcc2c22 cmListFileBacktrace: Replace local generator with cmState::Snapshot.
Construct cmOutputConverter only when needed.
2015-06-06 09:15:57 +02:00
Stephen Kelly 499ebb6564 cmListFileBacktrace: Internalize the step of making paths relative.
Currently cmMakefile calls MakeRelative on a copy of the backtrace,
emits the copy to the stream once, then discards the copy.  There
is no need to have API for the path conversion.
2015-06-03 01:04:00 +02:00
Stephen Kelly 52919ac8ac cmMakefile: Make cmListFileBacktrace default constructible. 2015-06-03 01:03:59 +02:00
Stephen Kelly 61d52e6e77 cmListFileBacktrace: Hide the context-stack implementation detail.
The backtrace will soon not be implemented in terms of a stack of
cmListFileContext objects.  Keep the cmListFileContext in the API
for convenience for now.
2015-05-18 23:56:00 +02:00
Stephen Kelly 9645cba3bf cmListFileContext: Implement EqualityComparable. 2015-05-18 23:55:44 +02:00
Stephen Kelly e96b5d14f9 cmListFileContext: Implement LessThanComparable.
Move wrapping existing code from cmMakefile, and simplify the
implementation there.
2015-05-18 23:55:43 +02:00
Stephen Kelly 257c16495a cmListFile: Remove unused member.
It is written, but not read since commit v2.4.0~575 (ENH: Since list file
cache does not make much sense any more ..., 2006-02-07).
2015-04-04 18:31:03 +02:00
Ben Boeckel 2a1b2d8486 backtrace: Convert to local paths in IssueMessage
This is the only place we care show the FilePath to the user, so defer
the expensive relative path calculation until here.
2014-06-05 12:44:19 -04:00
Brad King daa0f6f98d Add Lua-style long brackets and long comments to CMake language
Teach the CMake language parser to recognize Lua-style "long bracket"
arguments.  These start with two '[' separated by zero or more '='
characters e.g. "[[" or "[=[" or "[==[".  They end with two ']'
separated by the same number of '=' as the opening bracket.  There is no
nesting of brackets of the same level (number of '=').  No escapes,
variable expansion, or other processing is performed on the content
between such brackets so they always represent exactly one argument.

Also teach CMake to parse and ignore "long comment" syntax.  A long
comment starts with "#" immediately followed by an opening long bracket.
It ends at the matching close long bracket.

Teach the RunCMake.Syntax test to cover long bracket and long comment
cases.
2013-10-17 09:07:00 -04:00
Brad King 0546484e4b cmListFileArgument: Generalize 'Quoted' bool to 'Delimeter' enum
Replace the boolean value that indicates whether an argument is unquoted
or quoted with a generalized enumeration of possible argument types.
For now "Quoted" and "Unquoted" remain the only types.
2013-08-08 13:26:27 -04:00
Stephen Kelly 5b88504f65 Rename the IncludeDirectoriesEntry to be more generic. 2013-02-12 10:39:35 +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
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
Brad King 4db6658d8f BUG: Make sure context info is always initialized
This adds a missing default constructor to cmListFileContext that makes
sure the line number is initialized to zero.  A zero line number will
indicate a generated context.
2008-10-11 12:02:50 -04:00
Brad King f7f03347a6 ENH: Improve new error/warning message generation
- Add cmListFileBacktrace to record stack traces
  - Move main IssueMessage method to the cmake class instance
    (make the backtrace an explicit argument)
  - Change cmMakefile::IssueMessage to construct a backtrace
    and call the cmake instance version
  - Record a backtrace at the point a target is created
    (useful later for messages issued by generators)
2008-03-13 13:48:57 -04:00
Brad King 680104a490 ENH: New format for warning and error messages
- Add cmMakefile methods IssueError and IssueWarning
  - Maintain an explicit call stack in cmMakefile
  - Include context/call-stack info in messages
  - Nested errors now unwind the call stack
  - Use new mechanism for policy warnings and errors
  - Improve policy error message
  - Include cmExecutionStatus pointer in call stack
    so that errors deeper in the C++ stack under
    a command invocation will become errors for the
    command
2008-03-07 08:40:36 -05:00
Ken Martin adddcea5d7 BUG: change the handling of CMAKE_MINIMUM_REQUIRED and BACKWARDS_COMPATIBILITY and extend the documentaiton quite a bit 2008-03-06 10:57:59 -05:00
Alexander Neundorf cd0cd47416 BUG: const char* FilePath could point to a non-existent std::string for
commands used in a macro, using a std::string instead copies the contents so
this works (correct error message)

Alex
2007-05-11 08:36:05 -04:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Andy Cedilnik 892a439fad BUG: Remove some old legacy code and remove memory leak 2006-03-08 10:52:29 -05:00
Andy Cedilnik 4259971961 ENH: Since list file cache does not make much sense any more (because of proper list file parsing), and it actually adds unnecessary complications and make ctest scripting not work, take it out 2006-02-07 08:49:42 -05:00
Brad King b6da1d1271 ENH: Added support for special variables CMAKE_CURRENT_LIST_FILE and CMAKE_CURRENT_LIST_LINE that evaluate to the file name and line number in which they appear. This implements the feature request from bug 1012. 2004-08-04 10:45:11 -04:00
Brad King 00ae7ea261 ENH: Using lex-based tokenizer and a simple recursive-descent parser in place of the old hand-coded parser for CMake listfiles. 2003-12-08 13:36:59 -05:00
Brad King ad5d35c6cf ERR: Added operator != for SGI. 2002-12-17 14:55:31 -05:00
Brad King 54541bd40a ENH: Improved filename/line number reporting in error message. Macro invocations now chain up the error message. 2002-12-12 11:36:28 -05:00
Brad King 4888c088ae ENH: Moved ExpandListVariables out of individual commands. Argument evaluation rules are now very consistent. Double quotes can always be used to create exactly one argument, regardless of contents inside. 2002-12-11 18:13:33 -05:00
Bill Hoffman 27110975c2 ENH: add PROJECT command if there is not one 2002-12-02 15:30:59 -05:00
Brad King 1f6a3c67b1 ENH: Added reference to Copyright.txt. Removed old reference to ITK copyright. Changed program name to CMake instead of Insight in source file header. Also removed tabs. 2002-10-23 18:03:27 -04:00
Andy Cedilnik 0301b8366b Add a way to remove files from cache 2002-09-19 14:34:15 -04:00
Ken Martin 499bd45d4d removed shared lib support 2002-08-23 16:13:34 -04:00
Ken Martin 34c7c1b78d made CMakeLib shared on windows 2002-08-21 11:57:12 -04:00
Will Schroeder a6a43d5320 ENH:Updated copyright 2002-01-21 15:30:43 -05:00
Bill Hoffman 9438a5965a initialize class 2001-09-14 15:18:19 -04:00
Bill Hoffman 85d241faa0 remove warning 2001-08-28 18:35:22 -04:00