Commit Graph

125 Commits

Author SHA1 Message Date
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
Brad King 180538c706 Source: Stabilize include order
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.
2016-04-29 13:58:31 -04:00
Brad King 036b6ef7c4 Port CMake from cmIML to KWIML
KWIML no longer uses a configured prefix.
2015-12-18 10:02:07 -05:00
Brad King d956816d70 Merge topic 'include-for-mode_t'
001043ac Include `sys/types.h` header to get `mode_t`
2015-12-02 08:35:47 -05:00
Kylie McClain 001043ac30 Include `sys/types.h` header to get `mode_t`
Do not depend on it being included by other system headers.
It is not included by others on musl-libc, for example.
2015-12-02 08:31:08 -05:00
Stephen Kelly 482b3811e4 cmTarget: Move link type enum out.
Remove a reason for generate time code to depend on the cmTarget header/type.
2015-10-15 00:41:22 +02:00
Brad King 04e708d8df Remove use of include <cmsys/IOStream.hxx> from KWSys
We no longer need this compatibility layer for the compilers we support.
2015-08-21 10:54:57 -04:00
Stephen Kelly ac26d4b343 Split cmAlgorithms into a separate header file. 2015-02-10 22:14:18 +01:00
Stephen Kelly af65da0aa9 cmStandardIncludes: Remove list include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Stephen Kelly e848cc5074 cmStandardIncludes: Remove deque include.
Include it only where used.
2015-02-06 19:04:53 +01:00
Stephen Kelly 5fea689834 cmStandardIncludes: Remove some VS6 workarounds.
Added in commit v2.6.0~2824 (COMP: Fix warnings in system headers
on VS6., 2006-08-29), but no longer needed.
2015-02-06 19:04:53 +01:00
Stephen Kelly 4dc0c488f9 cmDeleteAll: Generalize deletion specialization for map types.
Assume that a container whose value_type is a std::pair should have
its second member deleted.
2015-01-17 16:22:58 +01:00
Stephen Kelly abb4a6781f Add a generic algorithm for deleting items in a container.
Specialize for std::map types to delete the second element from
the iterator.  This is not quite general enough that it can
be used everywhere, because CMake inherits from std::map and
creates typedefs with custom comparison functors etc, which
can not use this algorithm.
2015-01-13 23:00:16 +01:00
Brad King dd6c596c12 Merge topic 'join-algorithm'
55a73e6b Use the cmJoin algorithm where possible.
8dc8d756 cmStandardIncludes: Add a join algorithm for string containers.
b5813cee cmInstallCommand: Remove unused variable.
2015-01-12 09:41:02 -05:00
Stephen Kelly 15e42bb27c cmStandardIncludes: Remove obsolete cmOStringStream. 2015-01-11 17:06:04 +01: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 8dc8d756bc cmStandardIncludes: Add a join algorithm for string containers.
This requires the input range to supply BidirectionalIterators, which
is not a problem for where it is currently useful to us.  The alternative
would be to not invoke --last;, and instead create an output iterator
similar to std::ostream_iterator, but which puts the delimiter before
the item to output.
2015-01-08 22:28:18 +01:00
Stephen Kelly f194a009c8 Remove unused cmIStringStream class. 2015-01-08 22:10:15 +01:00
Stephen Kelly 3ec1bb1537 cmStandardIncludes: Remove std namespace hack. 2015-01-08 22:10:15 +01:00
Stephen Kelly bb3bce706a cmStandardIncludes: Remove ANSI_FOR_SCOPE hack.
All compilers hosting CMake support proper for scoping.
2015-01-08 22:10:15 +01:00
Stephen Kelly 28fa4923c3 cmStandardIncludes: Remove iostreams workaround for obsolete Compaq compiler.
It is no longer tested on the dashboard.
2015-01-08 22:10:15 +01:00
Stephen Kelly 837a8a6312 cmStandardIncludes: Drop Comeau-related workaround.
The compiler is not tested on the dashboard, and on Windows there
are more-natural compilers to use to build CMake.
2015-01-08 22:10:15 +01:00
Stephen Kelly 4030ddfda8 Remove Borland-related undef. 2015-01-08 22:10:14 +01:00
Stephen Kelly 17d6a6fd59 cmStandardIncludes: Remove comment about Borland.
The code the comment refers to was removed in commit 2db55ffa (Remove
borland workarounds., 2014-08-06)
2015-01-08 22:10:14 +01:00
Stephen Kelly 26fb50114f Drop SGI as a CMake host compiler.
It has not been tested since commit v3.1.0-rc1~584^2 (Utilities/Release: Drop
IRIX binary generation on ferrari, 2014-04-30).
2015-01-08 22:10:14 +01:00
Stephen Kelly f07d96ccf4 Remove workaround for GCC < 3 ios_base absence. 2015-01-01 12:45:54 +01:00
Stephen Kelly 5a8b9437c2 Remove GCC 2.95 support macros in favor of template versions.
GCC < 3 is no longer supported as a host compiler.
2015-01-01 12:44:11 +01:00
Stephen Kelly 5f4695cd06 cmStandardIncludes: Remove MSVC6 condition for cmArrayBegin macro. 2014-11-20 22:22:45 +01:00
Stephen Kelly 2db55ffa56 Remove borland workarounds.
CMake 3.0 is the last release to require to be able to build with
Borland.
2014-10-15 23:16:44 +02:00
Stephen Kelly 1927e4bacb Remove const char string comparison helper.
It is now unused.
2014-09-17 15:10:25 +02: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 4bef02e7aa cmTypeMacro: Add a class to eat the semicolon following the macro use.
Apply the same workaround to the cmCPackTypeMacro. Additionally
change that macro to not use 'class' as a macro parameter.
2014-04-03 21:53:13 +02: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
Ben Boeckel 381d50c149 stringapi: Accept strings in cmStrCmp 2014-03-08 13:05:28 -05:00
Brad King 28805109bc cmStandardIncludes: Include cmIML/INT.h for portable integer types
Also teach the bootstrap script to configure the needed headers.
2014-02-10 15:31:40 -05:00
Stephen Kelly 802a28fc5e Add cmHasLiteralSuffix API. 2014-01-06 18:46:44 +01:00
Stephen Kelly 218ad35f96 Constify cmStrCmp. 2013-12-19 16:17:58 +01:00
Stephen Kelly 5ee9e6bc11 cmTarget: Add whitelist of properties on INTERFACE_LIBRARY. 2013-11-25 16:23:11 +01:00
Stephen Kelly 7d4b2b2ef3 cmStandardIncludes: Add new cmHasLiteralPrefix function.
This allows avoiding error-prone hard-coding of literal
string lengths.

Borland is not able to process the template version of this
method. Make it use the macro version instead. This means
that Borland will also use the macro versions of cmArray*.
2013-11-21 20:53:15 +01:00
Stephen Kelly dfe0c2168b cmArray: Use macro variant of cmArray{Begin,Size,End} for old GCC.
It is not capable of using the template versions.
2013-10-24 16:07:52 +02:00
Stephen Kelly 73d7705416 Add some templates for cleaner array iteration. 2013-10-22 10:45:23 +02:00
Brad King 0c39a757da Drop the 'Full' field from cmDocumentationEntry
We need only 'Brief' for usage documentation.  We no longer have builtin
'Full' documentation, which is now in Help/*/*.rst files.
2013-10-16 09:22:37 -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
Brad King ac2e45d089 Provide std::ios_base typedef on GCC < 3
The ancient GNU standard library provided std::ios but not
std::ios_base.  Define the latter in terms of the former.
2011-11-30 09:27:18 -05:00
Brad King f20d091a2c Tru64: Place cmOStringStream vtable uniquely (#10541)
GCC places the vtable in the object implementing the first non-pure,
non-inline virtual method.  Since the symbol is not weak on Tru64, make
the location unique by putting the destructor in a single object file.
2010-06-10 15:22:40 -04:00
Bill Hoffman 521e26752b Ignore some more sgi warnings. 2010-05-12 10:40:12 -04:00
Brad King a03f801f7f Suppress Intel float-equality test warnings
We suppress Intel warning 1572 because the cases where we do equality
tests are valid.  Since this project does not do numerical computations
we need not worry about real instances against which this warning
protects.
2009-11-24 08:57:06 -05:00
Bill Hoffman 21a59bdc4d Fix double bootstrap build for in source builds 2009-11-10 08:09:54 -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 e02d66e89e COMP: Block warnings in Borland system headers
In Release builds the Borland compiler warns about code in its own
system headers.  This blocks the warnings by disabling them where the
headers are included.
2009-06-12 11:05:02 -04:00