1. 25 Aug, 2016 1 commit
  2. 23 Aug, 2016 1 commit
  3. 18 Aug, 2016 1 commit
  4. 18 Jul, 2016 1 commit
  5. 29 Jun, 2016 1 commit
    • Brad King's avatar
      Avoid using KWSys auto_ptr by adopting it ourselves · b5ec5b09
      Brad King authored
      Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to
      our own implementation adopted from the KWSys auto_ptr implementation.
      Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers
      that do not warn about it.
      
      Automate the client site conversions:
      
          git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \
            's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
      b5ec5b09
  6. 28 Jun, 2016 1 commit
  7. 17 Jun, 2016 1 commit
    • Alex Turbov's avatar
      cmake: Add an option to control what files needs to be traced · e63151ff
      Alex Turbov authored
      Even in relatively small projects using `--trace` (and `--trace-expand`)
      may produce a lot of output.  When developing a custom module usually
      one is interested in output of only a few particular modules.
      
      Add a `--trace-source=<file>` option to enable tracing only a subset of
      source files.  The final output would be only from requested modules,
      ignoring anything else not matched to given filename(s).
      e63151ff
  8. 14 Jun, 2016 1 commit
  9. 13 Jun, 2016 2 commits
  10. 12 Jun, 2016 3 commits
  11. 10 Jun, 2016 2 commits
  12. 06 Jun, 2016 1 commit
  13. 02 Jun, 2016 1 commit
    • Daniel Pfeifer's avatar
      Simplify boolean expressions · 7f6b8d33
      Daniel Pfeifer authored
      Use clang-tidy's readability-simplify-boolean-expr checker.
      After applying the fix-its, revise all changes *very* carefully.
      Be aware of false positives and invalid changes.
      7f6b8d33
  14. 24 May, 2016 1 commit
  15. 16 May, 2016 1 commit
    • Kitware Robot's avatar
      Revise C++ coding style using clang-format · d9fd2f54
      Kitware Robot authored
      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.
      d9fd2f54
  16. 09 May, 2016 1 commit
    • Brad King's avatar
      Remove `//------...` horizontal separator comments · 0ac18d40
      Brad King authored
      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.
      0ac18d40
  17. 06 May, 2016 1 commit
    • Brad King's avatar
      Isolate formatted streaming blocks with clang-format off/on · 64b55203
      Brad King authored
      The clang-format tool can do a good job formatting most code, but
      well-organized streaming blocks are best left manually formatted.
      
      Find blocks of the form
      
          os <<
            "...\n"
            "...\n"
            ;
      
      using the command
      
          $ git ls-files -z -- Source |
            egrep -v -z '^Source/kwsys/' |
            xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
              '<<[^\n]*\n(^ *("[^\n]*("|<<|;)$|;)\n){2,}'
      
      Find blocks of the form
      
          os << "...\n"
             << "...\n"
             << "...\n";
      
      using the command
      
          $ git ls-files -z -- Source |
            egrep -v -z '^Source/kwsys/' |
            xargs -0 pcregrep -M --color=always -B 1 -A 1 -n \
              '<<[^\n]*\n(^ *<<[^\n]*(\\n"|<<|;)$\n){2,}'
      
      Surround such blocks with the pair
      
          /* clang-format off */
          ...
          /* clang-format on */
      
      in order to protect them from update by clang-format.  Use the C-style
      `/*...*/` comments instead of C++-style `//...` comments in order to
      prevent them from ever being swallowed by re-formatting of surrounding
      comments.
      64b55203
  18. 29 Apr, 2016 2 commits
    • Brad King's avatar
      Format include directive blocks and ordering with clang-format · e1c77472
      Brad King authored
      
      
      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's avatarDaniel Pfeifer <daniel@pfeifer-mail.de>
      e1c77472
    • Brad King's avatar
      Source: Stabilize include order · 180538c7
      Brad King authored
      Each source file has a logical first include file.  Include it in an
      isolated block so that tools that sort includes do not move them.
      180538c7
  19. 20 Apr, 2016 1 commit
  20. 18 Apr, 2016 1 commit
    • Brad King's avatar
      cmListFileBacktrace: Refactor storage to provide efficient value semantics · 7c36d206
      Brad King authored
      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.
      7c36d206
  21. 15 Apr, 2016 2 commits
  22. 12 Apr, 2016 1 commit
  23. 01 Apr, 2016 2 commits
    • Brad King's avatar
      Rename local target lookup methods to clarify purpose · 0e44f489
      Brad King authored
      Rename methods:
      
      * `cmMakefile::Find{ => LocalNonAlias}Target`
      * `cmLocalGenerator::Find{ => LocalNonAlias}GeneratorTarget`
      
      These names clarify that they are for directory-local target names
      and do not consider alias targets.
      0e44f489
    • Brad King's avatar
      Fix lookup of an ALIAS target outside aliased target's directory (#16044) · bc30f8b5
      Brad King authored
      
      
      Refactoring in commit v3.5.0-rc1~272^2~11 (cmTarget: Implement ALIAS in
      terms of name mapping, 2015-10-25) accidentally introduced logic that
      assumes ALIAS targets always reference targets in their own directory.
      Fix this and add a test case.
      
      The configure-step fix is that `cmMakefile::FindTarget` should not consider
      aliases.  The purpose of this method is just to look up targets local to
      a directory.  Since ALIAS and normal targets share a namespace we know a
      locally defined target will never collide with an ALIAS target anyway.
      The method has 3 call sites, and this change is safe for all of them:
      
      * `cmInstallCommand::HandleTargetsMode`: Rejects aliases before the call.
      * `cmFLTKWrapUICommand::FinalPass`: Should never have considered aliases.
      * `cmMakefile::FindTargetToUse`: Falls back to a global lookup anyway.
      
      The generate-step fix is that `cmLocalGenerator::FindGeneratorTarget`
      should not consider aliases.  This method is the generate-step
      equivalent to the above.  The method has 2 call sites, and this change
      is safe for both of them:
      
      * `cmInstallTargetGenerator::Compute`: Never uses an alias target name.
      * `cmLocalGenerator::FindGeneratorTargetToUse`: Falls back to global lookup.
      Reported-by: Matteo Settenvini's avatarMatteo Settenvini <matteo@member.fsf.org>
      bc30f8b5
  24. 23 Mar, 2016 1 commit
    • Yves Frederix's avatar
      Avoid occasional use-after-free when a variable watch is executed · c6104028
      Yves Frederix authored
      Re-lookup a variable value when an associated VariableWatch is executed
      in cmMakefile::GetDefinition.
      
      This fixes a problem with 'def' sometimes becoming invalid due to memory
      reallocation inside an std::vector. In this case, the problem was that
      if the call to VariableAccessed actually executed a callback function,
      the internal state of the makefile has changed due to the associated
      function scope being pushed. This in turn implies that a new
      cmDefinitions instance was pushed in cmMakefile::VarTree. As
      cmLinkedTree is based on an std::vector, this push can have triggered
      reallocation of its internal memory buffer. However, as the value of
      'def', which was computed on method entry, actually points to a property
      of one of the cmDefinitions instances in cmMakefile::VarTree,
      reallocation can invalidate the value of 'def' so that it cannot simply
      be returned at the end of the function. The solution implemented here is
      to simply lookup the value of 'def' again.
      c6104028
  25. 16 Mar, 2016 1 commit
  26. 09 Mar, 2016 1 commit
    • Brad King's avatar
      Drop Visual Studio 6 generator · b42866a3
      Brad King authored
      This generator has been deprecated since CMake 3.3.  Remove it.
      Update documentation, modules, and tests to drop content specific
      to this generator.
      b42866a3
  27. 08 Feb, 2016 1 commit
    • Brad King's avatar
      Fix internal target lookup performance regression · 6cbf6a51
      Brad King authored
      
      
      Refactoring in commit v3.5.0-rc1~272^2~13 (cmGlobalGenerator: Remove
      direct storage of targets, 2015-10-25) replaced an efficient data
      structure mapping from target name to cmTarget instance with a linear
      search.  Lookups through cmGlobalGenerator::FindTarget are done a lot.
      Restore the efficient mapping structure with a name indicating its
      purpose.
      Reported-by: Bartosz's avatarBartosz Kosiorek <gang65@poczta.onet.pl>
      6cbf6a51
  28. 28 Jan, 2016 1 commit
  29. 20 Jan, 2016 1 commit
    • Milian Wolff's avatar
      Optimize cmMakefile::ExpandVariablesInStringNew. · bd2384f5
      Milian Wolff authored
      We can remove the temporary allocations required for the
      default-constructed t_lookup passed into the openstack by refactoring
      the code slightly. Furthermore, we use a vector instead of a stack,
      since the latter is based on a deque which is not required for a
      heap / lifo structure.
      
      This patch removes ~215k allocations.
      
      This hotspot was found with heaptrack.
      bd2384f5
  30. 30 Nov, 2015 1 commit
    • Michael Scott's avatar
      Make message suppression more consistent. · deec3a3f
      Michael Scott authored
      Make the message suppression more consistent, by adding a check
      for the message related CMake variables in cmake::IssueMessage,
      which allows callers of IssueMessage other than the message
      command to behave as expected. Also added a check for
      CMAKE_SUPPRESS_DEVELOPER_WARNINGS in the message command to
      mirror the deprecated message type behaviour.
      
      Added a 'force' flag to the cmake::IssueMessage method, to
      make the message suppression consistent, when setting the
      message related CMake variables directly in a CMake file.
      
      Expand message command tests to cover the AUTHOR_WARNING message
      type as well.
      deec3a3f
  31. 24 Nov, 2015 3 commits
    • Brad King's avatar
      cmState: Enforce policy scope balancing around variable scopes · 32edac6f
      Brad King authored
      Everywhere we use cmMakefile::ScopePushPop to manage variable scopes
      also expects policy scopes to be balanced.  There is no place that we
      use cmMakefile::PolicyPushPop without also using ScopePushPop.  Relieve
      PolicyPushPop of responsibility for policy scope balance checks by
      moving it to ScopePushPop.
      32edac6f
    • Brad King's avatar
      cmMakefile: Remove unused PolicyPushPop interfaces · d85c9176
      Brad King authored
      The PolicyPushPop constructor arguments and Quiet method were used to
      pass non-default arguments to PushPolicy and PopSnapshot, but no clients
      use them anymore.
      d85c9176
    • Brad King's avatar
      cmMakefile: Clarify purpose of method that pops a scope snapshot · 8e1be7bf
      Brad King authored
      The `PopPolicyBarrier` method is actually responsible for closing any
      scope opened by creating a snapshot.  Rename it to `PopSnapshot` and add
      a comment explaining the purpose of the poilcy-scope-specific part of
      the method.
      8e1be7bf