Commit Graph

55 Commits

Author SHA1 Message Date
Daniel Pfeifer 1d6909a287 use CM_NULLPTR 2016-06-28 09:02:26 -04: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 54f71cd72c Source: Sort includes the way clang-format would
Re-apply the approach from commit e1c77472 (Format include directive
blocks and ordering with clang-format, 2016-04-29) but this time be
more careful about exclusion of parser generator sources:

    $ git ls-files -z -- \
        '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' |
      egrep -z -v '^Source/cmCommandArgumentLexer\.' |
      egrep -z -v '^Source/cmCommandArgumentParser\.' |
      egrep -z -v '^Source/cmDependsJavaLexer\.' |
      egrep -z -v '^Source/cmDependsJavaParser\.' |
      egrep -z -v '^Source/cmExprLexer\.' |
      egrep -z -v '^Source/cmExprParser\.' |
      egrep -z -v '^Source/cmFortranLexer\.' |
      egrep -z -v '^Source/cmFortranParser\.' |
      egrep -z -v '^Source/cmListFileLexer\.' |
      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

Also drop use of custom sorting for `sys/types.h`.
2016-05-03 10:08:41 -04:00
Brad King 2faa8b3620 Add call stack to unused/uninitialized variable warnings
In commit v2.8.4~32^2~14 (Use cmake::IssueMessage for warnings,
2010-12-07) these warnings became formatted.  It is more informative to
give the full call stack with such warnings.  Also it is easier to
implement warnings with a full call stack because we do not have to
construct a custom backtrace with only the top.
2016-04-15 10:13:12 -04:00
Stephen Kelly 0f2a132437 cmCommandArgumentParserHelper: Port to cmOutputConverter. 2015-06-06 09:15:56 +02:00
Stephen Kelly 8b4b9631f5 cmake: Add IssueMessage overload taking a single cmListFileContext.
Port appropriate clients to use it.
2015-05-22 01:21:35 +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 ff7169a03c Port to cmState. 2015-04-13 11:44:15 -04:00
Stephen Kelly 77f2807ce5 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-07 23:25:44 +02:00
Brad King 3347c5e4f9 Revert topic 'refactor-cache-api'
This topic was never tested without some follow-up commits.  The
GetCacheEntryValue API returns a pointer to memory freed on return.
It will have to be revised along with the rest of the original topic.
2015-04-07 17:15:04 -04:00
Stephen Kelly 9ada4c0433 cmCacheManager: Rename GetCacheValue to GetInitializedCacheValue.
Being initialized is a requirement for this method to return something,
and is what differentiates it from using GetIterator with it.GetValue.
2015-04-06 17:58:55 +02: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
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
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 b26c70cc9a stringapi: Use strings for AddString methods
It gets turned into a string anyways, so pass them in.
2014-03-08 13:05:30 -05:00
Brad King ae6a5ea5a2 Include cmMakefile.h before cm*Lexer.h to get stdint.h first
Some generated cm*Lexer.h headers define preprocessor macros normally
provided by <stdint.h>.  The latter is included indrectly by cmMakefile.h
since commit 2268c41a (Optimize custom command full-path dependency
lookup, 2013-08-06).  Adjust the order to avoid redefinition warnings.
2013-08-07 10:19:40 -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
Ben Boeckel 668e005db5 Use cmake::IssueMessage for warnings 2010-12-07 16:38:25 -05:00
Ben Boeckel 88cd4c1e92 Use 'CMake Warning' versus 'warning' for CDash 2010-12-07 14:40:21 -05:00
Ben Boeckel fe56002a16 Fix long lines for KWStyle 2010-09-23 10:14:37 -04:00
Ben Boeckel f117423336 Fix line lengths to be no more than 78 2010-09-16 11:49:58 -04:00
Ben Boeckel 83acb0a4b2 Remove now unused variables 2010-09-08 13:29:57 -04:00
Ben Boeckel 3801463c9f Use built-ins for readability and maintainability 2010-09-08 12:03:42 -04:00
Ben Boeckel 300fc15779 Fix detection of system files
Instead of looking to see if the file is under CMAKE_ROOT, check to see
if it is instead under the source or binary directories in use.
2010-09-02 11:33:34 -04:00
Ben Boeckel 74997000c8 Add a flag to warn about system files 2010-09-01 13:09:08 -04:00
Ben Boeckel d7999e9b29 Rename strict-mode to warn-uninitialized 2010-09-01 13:08:14 -04:00
Ben Boeckel f332e14ff2 Complete strict-mode checks for uninitialized vars 2010-09-01 13:08:14 -04:00
Bill Hoffman f794d589a4 Make --strict-mode option, and integrate with cmake-gui 2010-09-01 13:08:14 -04:00
Bill Hoffman 48b5b85593 Add a warning when variables are used uninitialized. 2010-09-01 13:08:13 -04:00
Bill Hoffman 2f94a2c919 Fix seg fault for empty ENV{} call bug #9747 2009-10-21 09:04:50 -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 5f4686920d BUG: Fix CMAKE_CURRENT_LIST_FILE in macros
The value of CMAKE_CURRENT_LIST_FILE is supposed to be the list file
currently being executed.  Before macros were introduced this was always
the context of the argument referencing the variable.

Our original implementation of macros replaced the context of command
arguments inside the macro with that of the arguments of the calling
context.  This worked recursively, but only worked when macros had at
least one argument.  Furthermore, it caused parsing errors of the
arguments to report the wrong location (calling context instead of line
with error).

The commit "Improve context for errors in macros" fixed the latter bug
by keeping the lexical context of command arguments in macros.  It broke
evaluation of CMAKE_CURRENT_LIST_FILE because the calling context was no
longer preserved in the argument referencing the variable.  However,
since our list file processing now maintains the proper value of
CMAKE_CURRENT_LIST_FILE with dynamic scope we no longer need the context
of the argument and can just evaluate the variable normally.
2009-03-25 10:37:04 -04:00
Brad King f8bc0492e1 ENH: Create $CACHE{VAR} syntax
This syntax allows reading of cache entries even when variables of the
same name have been defined in the local scope.  See issue #7715.
2008-09-25 10:21:15 -04:00
Brad King d524f3675e ENH: Improve argument parsing error messages
Previously error messages produced by parsing of command argument
variable references, such as bad $KEY{VAR} syntax or a bad escape
sequence, did not provide good context information.  Errors parsing
arguments inside macro invocations gave no context at all.  Furthermore,
some errors such as a missing close curly "${VAR" would be reported but
build files would still be generated.

These changes teach CMake to report errors with good context information
for all command argument parsing problems.  Policy CMP0010 is introduced
so that existing projects that built despite such errors will continue
to work.
2008-09-24 08:51:19 -04:00
Brad King db0f26e852 BUG: Fixed @ONLY configuration to not try to parse ${} syntax at all. This fixes the original fix to bug#4393 and adds a test. 2007-06-06 16:20:02 -04:00
Brad King e40c51dddf BUG: Fixed cmCommandArgumentLexer no-escape mode to not match backslash-escape sequences as lexical tokens at all. Needed to configure files with backslashes preceding an @VAR@ replacement. This fixes bug#5130. 2007-06-04 15:57:33 -04:00
Bill Hoffman 0e95a190bc ENH: add atonly support to cmCommandArgumentParserHelper.cxx and remove old non-yacc parser code from cmMakefile.cxx 2007-02-09 13:44:37 -05:00
Brad King 523075ded5 BUG: Do not replace @VAR@ syntax in list files. This addresses bug #2722. 2006-10-04 14:37:42 -04:00
Brad King e5549cff25 BUG: One should be able to escape the @ symbol. 2006-09-27 16:14:16 -04:00
Andy Cedilnik a9c0929d39 COMP: Handle both ansi and non-ansi C 2006-07-26 11:46:22 -04:00
Ken Martin d77fbb9640 STYLE: fix line length 2006-05-10 14:15:15 -04:00
Bill Hoffman 51a84aaa57 ENH: handle empty variables 2006-05-05 21:45:26 -04:00
Bill Hoffman 5a2668b326 ENH: add support for win64 for visual studio 2005 ide and nmake, also fix warnings produced by building for win64 2006-03-30 13:49:56 -05:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Bill Hoffman 29a40d3869 ENH: remove UMR 2005-09-08 15:26:36 -04:00
Andy Cedilnik 01a78e617a ENH: Remove stray abort 2005-06-21 16:44:46 -04:00
Andy Cedilnik 9e9b6a8354 BUG: Fix escaping to make OSX work again 2005-06-21 11:01:24 -04:00
Andy Cedilnik 1bbccc5bef ENH: Improve handling of escaped characters 2005-06-17 15:50:08 -04:00
Andy Cedilnik d797ba2c7e ENH: More cleanups 2005-06-14 15:49:30 -04:00