1. 28 Sep, 2016 1 commit
    • Brad King's avatar
      project: Fix support for explicit RC language · 9c5238df
      Brad King authored
      The check added in commit v3.6.0-rc1~293^2 (Diagnose recursive
      project/enable_language without crashing, 2016-03-07) broke support for
      enabling `RC` explicitly along with other languages like `C`.  The
      reason is that we enable all listed languages at once so the internal
      `enable_language(RC)` that we do while enabling `C` or `CXX` on some
      platforms triggers the recursion check if `RC` is explicitly listed.
      
      Ideally we should refactor things to only enable one language at a time,
      but for now it is simplest to just exclude `RC` from the explicit list
      until other languages are enabled, and then enable it.
      
      Closes: #16330
      9c5238df
  2. 27 Sep, 2016 1 commit
    • Brad King's avatar
      Simplify CMake per-source license notices · 86578ecc
      Brad King authored
      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 lin...
      86578ecc
  3. 19 Sep, 2016 1 commit
  4. 14 Sep, 2016 2 commits
  5. 06 Sep, 2016 1 commit
    • Brad King's avatar
      cmMakefile: Restore nested error logic use of cmExecutionStatus · f1ad71d7
      Brad King authored
      Since commit 14a8d61f (cmMakefile: Port nested error logic away from
      cmExecutionStatus) we fail to continue processing function and macro
      bodies after non-fatal errors.  A non-fatal error should not stop
      foreach loops, macro bodies, nested bodies, or the outer script.
      Add a test covering these cases, and revert the change to fix them.
      
      Also revert commit 2af853de (cmMakefile: Simplify IssueMessage
      implementation) because the assertion it added (which was removed by the
      above commit and is restored by reverting it) is incorrect.  We do have
      code paths that call cmMakefile::IssueMessage with an empty execution
      stack, such as in CheckForUnusedVariables's LogUnused call.
      f1ad71d7
  6. 03 Sep, 2016 1 commit
  7. 30 Aug, 2016 1 commit
  8. 25 Aug, 2016 3 commits
  9. 23 Aug, 2016 1 commit
  10. 18 Aug, 2016 1 commit
  11. 18 Jul, 2016 1 commit
  12. 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
  13. 28 Jun, 2016 1 commit
  14. 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
  15. 14 Jun, 2016 1 commit
  16. 13 Jun, 2016 2 commits
  17. 12 Jun, 2016 3 commits
  18. 10 Jun, 2016 2 commits
  19. 06 Jun, 2016 1 commit
  20. 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
  21. 24 May, 2016 1 commit
  22. 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
  23. 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
  24. 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
  25. 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
  26. 20 Apr, 2016 1 commit
  27. 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 ...
      7c36d206
  28. 15 Apr, 2016 2 commits
  29. 12 Apr, 2016 1 commit
  30. 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