Commit Graph

85 Commits

Author SHA1 Message Date
Stephen Kelly 782657db48 cmListFileArgument: Remove FilePath member.
It is now unused.
2015-06-21 20:57:26 +02:00
Stephen Kelly 076760a63c cmMakefile: Add filename context to ExpandArguments.
The cmListFileArgument currently stores a FilePath for use in this
method.  The filename is the same as the CMAKE_CURRENT_LIST_FILE,
except if executing a macro or function defined in another file.

Set the context filename when expanding the arguments of macros and
functions using the filename recorded when defining the prototype.
2015-06-21 20:57:25 +02:00
Stephen Kelly f971ab04cf cmMacroCommand: Store the FilePath when creating the prototype.
Instead of setting it each time the macro is invoked.
2015-06-21 20:31:27 +02:00
Stephen Kelly ca140c2e89 cmMakefile: Create a unified raii for macro scopes. 2015-06-04 22:08:23 +02:00
Stephen Kelly 0aec491328 Port cmCommand consumers to cmState. 2015-04-15 11:43:49 -04:00
Stephen Kelly 7916d7bac6 Include cmAlgorithms where it is used. 2015-03-11 00:17:29 +01:00
Stephen Kelly c021f59c1f cmMakefile: Store macro list in a vector not in a map.
The signature was computed (incorrectly) and stored as the map
value, but never used.  Remove it now.
2015-02-21 11:25:47 +01:00
Stephen Kelly b5f98e5012 cmMacroCommand: Manipulate target string directly.
Avoid copying a string from the source, manipulating it, and then
copying it back.  Manipulate it in place instead.
2015-02-11 22:58:34 +01:00
Stephen Kelly 83414d5a07 cmMacroCommand: Move computation of ARGV%n names out of double loop. 2015-02-11 22:58:34 +01:00
Stephen Kelly 9a1f8f35f4 cmMacroCommand: Move ARGV replacement out of condition. 2015-02-11 22:58:34 +01:00
Stephen Kelly 4aa7bd2ac1 cmMacroCommand: Remove condition around ARGN replacement.
There is none for ARGC replacement, so no reason to conditionalize the
replacement.  The computation is already done.
2015-02-11 22:58:34 +01:00
Stephen Kelly 6774c92b58 cmMacroCommand: Declare tmps in the scope that it's used.
We don't particularly need to reuse the string memory here, and this
pattern is not common in CMake.
2015-02-11 22:58:34 +01:00
Stephen Kelly 2c4a7298fc cmMacroCommand: Declare arg in the scope that it is used.
It can make sense to declare objects outside of loops if
the size required by the object can grow (eg std::string when
using getline), but that is not the case here.
2015-02-11 22:58:34 +01:00
Stephen Kelly a551851ab3 cmMacroCommand: Inline variable computation. 2015-02-11 22:58:33 +01:00
Stephen Kelly f79c0f7697 cmMacroCommand: Compute variables outside of two loops.
Avoid computing them from scratch for each argument of each
function.
2015-02-11 22:58:33 +01:00
Stephen Kelly 8e0827b646 cmMacroCommand: Remove intermediate arg variables. 2015-02-11 22:58:33 +01:00
Stephen Kelly f2c49f59d8 cmMacroCommand: Remove condition around ARGN computation.
An empty string is appended if the condition is false, which is
ok for this commit.
2015-02-11 22:58:33 +01:00
Stephen Kelly 3250a7e535 cmMacroCommand: Remove conditional append of semicolon.
The conditions are never true.
2015-02-11 22:58:33 +01:00
Stephen Kelly 081a13f7c0 cmMacroCommand: Declare arg variables where used and initialized.
Make the initialization by population with the expanded* content
unconditional.
2015-02-11 22:58:33 +01:00
Stephen Kelly 17b5ebd383 cmMacroCommand: Join the args strings outside of the loops.
This means that we compute the strings even if not used in the macro
but this shouldn't be expensive and it simplifies the code.
2015-02-11 22:58:31 +01:00
Stephen Kelly 9380e85f86 Convert loops to cmJoin algorithm with cmRange. 2015-02-11 22:58:04 +01:00
Stephen Kelly 8910224950 Replace common loop pattern with cmJoin 2015-02-11 22:57:55 +01:00
Stephen Kelly 7b8725bf84 Convert loops populating maybe-empty content into the common pattern. 2015-02-11 22:57:53 +01:00
Stephen Kelly 0a4e5674ec cmMacroCommand: Remove counting variable.
Start iteration at correct starting point directly.
2015-02-11 22:57:38 +01:00
Stephen Kelly 11ecc31d0a cmMacroCommand: Execute loop only if it has an effect. 2015-02-11 20:51:06 +01:00
Stephen Kelly f95543f8a6 cmMacroCommand: Extract iteration starting point. 2015-02-11 20:51:06 +01:00
Stephen Kelly 9fe8f49353 cmMacroCommand: Replace a loop with cmJoin. 2015-02-11 20:51:06 +01:00
Stephen Kelly fd7b371293 Replace foo.size() 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 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 6c19024570 Remove extra semicolons from C++ code.
Clang based tools running over the code complain about these,
but clang has a fixit for removing them.
2014-04-03 21:53:14 +02: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 85fc9f26a7 stringapi: Command names 2014-03-08 13:05:39 -05:00
Brad King ccdf7e04d4 macro: Do not substitute for placeholders in bracket arguments
Fix the macro command implementation to avoid substituting macro
placeholders in bracket arguments recorded inside the macro block.
2013-10-30 19:13:33 -04:00
Brad King 999abb993e macro: Add extra indentation to placeholder substitution code
The next commit will make this block conditional so pre-indent it
to clarify the simplicity of the change.
2013-10-30 19:10:11 -04:00
Brad King e33d8d2d77 Drop builtin command documentation
Drop all GetTerseDocumentation and GetFullDocumentation methods from
commands.  The command documentation is now in Help/command/*.rst files.
2013-10-16 09:22:36 -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
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
Yury G. Kudryashov 737c49a357 Add 'const' qualifier to some cmCommand members
Use const_cast for the special case in cmFindBase where
GetFullDocumentation calls GenerateDocumentation.
2012-02-29 13:27:04 -05:00
Eric NOULARD 1629615a10 CPack Documentation extraction from CMake script begins to work
- Enhance extract doc parser. Seems robust now. The legacy
   module documentation parser works as before ignoring
   the new markup.

 - Proof of concept for CPack (generic), CPack RPM and CPack Deb
   generator for macro and variables.
   Try cpack --help-command and cpack --help-variables
2012-01-22 13:31:24 +01:00
Bill Hoffman cd626ea66e For macros make sure the FilePath points to a valid pointer in the args. 2010-09-01 13:08:13 -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 3028ca756c ENH: Better policies for functions and macros
This teaches functions and macros to use policies recorded at creation
time when they are invoked.  It restores the policies as a weak policy
stack entry so that any policies set by a function escape to its caller
as before.
2009-01-22 13:16:47 -05:00
Brad King 919fdb7f27 ENH: Enforce logical blocks in functions/macros
This teaches function() and macro() to enforce matching logical blocks
inside the recorded bodies.  This makes the error message more specific.
2009-01-21 09:49:31 -05:00
Brad King 1dcc5b4558 ENH: Better handling of mismatched blocks
If a logical block terminates with mismatching arguments we previously
failed to remove the function blocker but replayed the commands anyway,
which led to cases in which we failed to report the mismatch (return
shortly after the ending command).  The recent refactoring of function
blocker deletion changed this behavior to produce an error on the ending
line by not blocking the command.  Furthermore, the function blocker
would stay in place and complain at the end of every equal-level block
of the same type.

This teaches CMake to treat the begin/end commands (if/endif, etc.) as
correct and just warns when the arguments mismatch.  The change allows
cases in which CMake 2.6.2 silently ignored a mismatch to run as before
but with a warning.
2009-01-21 09:49:00 -05:00
Brad King bca1026250 ENH: Better error message for unclosed blocks
This centralizes construction of the error message for an unclosed
logical block (if, foreach, etc.).  We record the line at which each
block is opened so it can be reported in the error message.
2009-01-21 09:48:20 -05:00
Brad King dbd88e00c7 ENH: Improve context for errors in macros
We now properly report the source location of command arguments inside
macros instead of using the macro invocation site.  No information is
lost because full call-stack information is already reported.
2008-09-24 08:51:26 -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