Commit Graph

74 Commits

Author SHA1 Message Date
Brad King 0ac18d40c8 Remove `//------...` horizontal separator comments
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.
2016-05-09 09:41:43 -04:00
Brad King e1c7747253 Format include directive blocks and ordering with clang-format
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 <daniel@pfeifer-mail.de>
2016-04-29 13:58:54 -04:00
Stephen Kelly bbef3c2da8 cmLocalGenerator: Add current binary directory accessor. 2015-10-10 11:04:39 +02:00
Brad King 613bc08ac1 cmDependsFortran: Use string to store module directory 2015-07-29 11:48:58 -04:00
Brad King eebe732bb6 cmFortranParser: Factor out of cmDependsFortran
Move the main parser class and method implementations out of
cmDependsFortran.cxx and into separate source files.
2015-07-27 09:45:36 -04:00
Brad King fd19445802 cmDependsFortran: Simplify storage of preprocessor definitions
Collect the original preprocessor definitions in a std::set<> so that
it can be copied directly by cmFortranParser's constructor instead of
making a copy on the stack.
2015-07-27 09:45:35 -04:00
Brad King 295480b923 cmDependsFortran: Move FindIncludeFile method into parser class
This drops the only awareness of cmDependsFortran that cmFortranParser
needed.
2015-07-27 09:45:35 -04:00
Kitware Robot 98b9645bce Rename Fortran parser infrastructure to drop "Depends" prefix
The parser can be re-used outside cmDependsFortran or the cmDepends
class hierarchy so drop the "Depends" from its name:

 rename 's/DependsFortran([A-Za-z0-9_])/Fortran$1/' Source/*.*
 sed -i 's/DependsFortran\([A-Za-z0-9_]\)/Fortran\1/g' Source/*.*
 sed -i 's/FortranInternals/DependsFortranInternals/g' Source/*.*

Also manually fix Source/CMakeLists.txt source file ordering.
2015-07-27 09:45:35 -04:00
Brad King 0a203db5dc Fortran: Fix passing of preprocessor definitions to dependency scanner
In commit v3.3.0-rc1~352^2~3 (Genex: Allow COMPILE_LANGUAGE when
processing compile definitions, 2015-03-04) the name of the variable
used to pass preprocessor definitions to the Fortran dependency scanner
was changed to be per-language, but the actual dependency scanning code
was not updated accordingly.  Update the code and add a test case.

Reported-by: Radovan Bast <radovan.bast@gmail.com>
2015-07-06 10:35:02 -04:00
Stephen Kelly 54d6a9187f cmMakefile: Rename GetCurrent{Output,Binary}Directory.
Match names used in CMake code.
2015-04-21 00:12:52 +02:00
Stephen Kelly 6162c9194b Use two-iterator std::set::insert where appropriate. 2015-01-11 17:00:55 +01:00
Nils Gladitz cc1139cc30 strings: Remove redundant calls to std::string::c_str()
Replacements were detected and performed by the clang tool
remove-cstr-calls on a linux build.
2014-10-15 14:54:05 +02:00
Brad King 85cea8a7af cmDepends: Refactor object file path conversion
Delay conversion of the path to object files (on the left-hand side
of dependencies) until just before they are written.  Also do not
convert the format of paths written to the 'depend.internal' file.
This is consistent with the way the right-hand side of dependencies
are already handled.
2014-07-22 15:24:57 -04:00
Brad King 9f92a78be2 cmLocalGenerator: Rename 'MAKEFILE' to 'MAKERULE'
Rename the internal enumeration value for converting paths destined
for use in Makefile rule syntax.
2014-07-22 12:27:57 -04:00
Brad King c196b3ca02 Merge topic 'gfortran-compressed-modules'
d90be200 Fortran: Add support for GNU >= 4.9 compressed modules (#14975)
2014-06-24 13:05:10 -04:00
Brad King d90be200ec Fortran: Add support for GNU >= 4.9 compressed modules (#14975)
From the GCC 4.9 release notes for Fortran:

 https://gcc.gnu.org/gcc-4.9/changes.html
 "Module files: The version of the module files (.mod) has been
  incremented; additionally, module files are now compressed."

Teach cmDependsFortran::ModulesDiffer to look for the gzip magic numbers
at the beginning of the module file.  If found, assume the module was
produced by gfortran >= 4.9.  The modules do not appear to contain the
date as earlier versions did so we can compare the content directly
and do not actually need to decompress.
2014-06-23 10:00:27 -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 270eb96df0 strings: Remove cmStdString references
Casts from std::string -> cmStdString were high on the list of things
taking up time. Avoid such implicit casts across function calls by just
using std::string everywhere.

The comment that the symbol name is too long is no longer relevant since
modern debuggers alias the templates anyways and the size is a
non-issue since the underlying methods are generated since it's
inherited.
2014-03-08 13:05:35 -05:00
Clinton Stimpson 5730710c86 Use cmsys::[io]fstream instead of cmsys_ios::[io]fstream.
Also use SystemTools::Fopen() instead of fopen().
This is to eventually support utf-8 filenames.
2014-01-07 09:27:44 -05:00
Alex Neundorf e74ff7c29f cmDepends: allow multiple dependees per depender
This patch is heavily inspired by Michael Wild.

The interfaces cmDepends::Write and cmDepends::WriteDependencies where
extended to allow multiple dependees (sources) per depender (object).
cmDepends::Write first collect all dependencies into a std::set before
passing it to cmDepends::WriteDependencies.

cmDependsC::WriteDependencies also first collects all explicit and
implicit dependencies into a std::set and only then writes
depend.{internal,make}. The implementation of cmDependsFortran simply
loops over all sources and proceeds as before, whereas the cmDependsJava
implementation is as trivial as before.

This is for preventing exponential growth of depend.{internal,make} in
the next commit which fixes dependency-vector erasure in
cmDepends::CheckDependencies.

Inspired-by: Michael Wild <themiwi@users.sourceforge.net>
2012-11-06 11:54:39 -05: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 43d60114a5 Run vim spellcheck on some files 2012-02-29 14:07:50 -05:00
Brad King cbfbb86b58 Fix escapes in Fortran depend.make entries
Makefile dependencies must be escaped using cmLocalGenerator::Convert
with the cmLocalGenerator::MAKEFILE option.  This fixes Fortran module
dependencies with spaces in the path.  We test the fix by adding a space
to one of the module paths in the Fortran test.
2010-01-04 10:18:44 -05: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 66f2edbe63 BUG: Fix Fortran implicit dependency include path
The previous change to Source/cmDependsFortran.cxx while refactoring
implicit dependency scanning configuration rules completely broke
loading of the include file search path while scanning Fortran
dependencies.  This adds the line that should have been added during the
previous change to load the include path correctly.
2009-02-24 14:32:25 -05:00
Brad King 12935b1599 ENH: Light refactoring of implicit dependency scanning configuration implementation.
- Move lookup of config variables from cmLocalUnixMakefileGenerator3 to cmDepends hierarchy.
2008-05-08 10:09:14 -04:00
Brad King 52898fe925 BUG: Fix Fortran dependency parser preprocessor handling crash.
- Do not crash if a #elseif occurs out of order
  - Recognize preprocessor directives only at the beginning of lines.
  - See issue #6855
2008-04-21 11:15:56 -04:00
Brad King aed67d5d93 COMP: Fix build on Borland 5.5. 2008-01-18 18:40:05 -05:00
Brad King 8d1d5500c8 ENH: Enable use of COMPILE_DEFINITIONS property for Fortran sources. 2008-01-17 19:58:01 -05:00
Brad King 564a23c6ba COMP: Fix build on VS6. 2008-01-10 09:46:04 -05:00
Brad King b761da39c1 ENH: Patch from Maik to add preprocessor directive handling to Fortran dependency scanning. Also added -fpp flag to Intel Fortran compiler on Windows by default. 2008-01-09 10:30:11 -05:00
Bill Hoffman 4b166fc319 BUG: make it compile on vs 6 2008-01-08 08:25:07 -05:00
Brad King e73508aa65 ENH: Changes based on patch from Maik for better cmDependsFortran::ModulesDiffer. 2008-01-07 11:36:17 -05:00
Brad King aa399c2350 ENH: Cleanup Fortran build directories by placing module stamp files in the target directory that builds them. This is actually a simpler implementation anyway. 2008-01-02 18:30:48 -05:00
Brad King c7de81f9a6 ENH: Make the Fortran compiler id available to cmDependsFortran at scanning and module timestamp copy time. 2008-01-02 11:04:52 -05:00
Brad King 1f987c06ea ENH: Changes based on patch from Maik Beckmann to copy fortran modules to timestamps only if they have really changed. This optimization should reduce extra rebuilds caused by dependencies on modules whose providers have recompiled but whose interfaces have not changed. 2007-12-31 11:25:17 -05:00
Brad King b2e8c07af8 ENH: Implemented Fortran module output directory and search path flags. 2007-12-30 16:11:38 -05:00
Brad King cd8a2bbab6 ENH: Simplify Fortran module proxy dependency implementation by removing unnecessary target. 2007-12-30 12:23:54 -05:00
Brad King edd5f1f5f1 COMP: Fix uninitialized variable and unused parameter warnings. 2007-12-28 22:29:19 -05:00
Brad King 81f6e86f12 ENH: Add per-language clean rule generation to cmake_clean.cmake files to include cmake_clean_<lang>.cmake files generated by dependency scanning. Add Fortran module file and timestamp cleaning rules. 2007-12-28 11:50:14 -05:00
Brad King 68dad94b00 ENH: Implement Fortran module dependencies across targets and directories.
- See issue #5809
  - Keep information about all sources in the target until deps are written
  - Create a fortran.internal file after scanning that lists modules provided
  - Load fortran.internal files from linked targets to find modules
  - Search the include path for external modules
  - Create file-level deps on in-project module timestamps or external mods
2007-12-28 11:49:59 -05:00
Brad King 4d360f7ac5 ENH: Convert cmDepends object interface to scan an entire target at once. 2007-12-22 22:41:42 -05:00
Brad King c7bf320539 BUG: cmDependsFortran should store the source file as a dependency of the object file when scanning for dependencies. 2007-12-19 16:35:09 -05:00
Brad King 891256546b ENH: Pass target directory to cmDependsFortran scanning instances. 2007-12-19 14:28:46 -05:00
Brad King 4143d8a700 ENH: Make module timestamps work for modules in subdirectories. Make sure timestamps for all modules provided by a target are created when the target is done building. 2007-12-15 15:35:00 -05:00
Bill Hoffman a5e76555bf BUG: fix for bug 6136 make sure includes are not directories 2007-12-14 20:31:27 -05:00
Bill Hoffman 8eea168c23 STYLE: fix line len 2007-12-05 09:17:07 -05:00
Bill Hoffman c34b1b48fc ENH: do not depend on touch being on the system 2007-12-04 16:09:46 -05:00
Brad King 1de1f4bb83 STYLE: Fixed line-too-long. 2007-10-16 10:20:59 -04:00