Commit Graph

132 Commits

Author SHA1 Message Date
Daniel Pfeifer 1c2c629769 cmTargetLinkLibraryType: Extract from cmStandardIncludes.h 2016-06-16 09:26:50 -04:00
Daniel Pfeifer ffdc0a8e28 cmTypeMacro: Extract from cmStandardIncludes.h 2016-06-16 09:26:33 -04:00
Daniel Pfeifer e4eb88e21d cmCustomCommandLines: Extract from cmStandardIncludes.h 2016-06-16 09:25:22 -04:00
Daniel Pfeifer 535ec2bf1a cmDocumentationEntry: Extract from cmStandardIncludes 2016-06-13 22:41:29 +02:00
Daniel Pfeifer c3819acad2 cmConfigure.h: Establish as 'include first' file
At the moment, cmStandardIncludes.h needs to be included before any
standard includes because it disables some warnings that are caused
by the standard library of some compilers.  Move this responsibility
to the cmConfigure.h file.

Also add include guards to cmConfigure.h to make sure the file can be
included multiple times.
2016-06-13 22:37:28 +02:00
Daniel Pfeifer 757b0ff5dd Add missing braces around statements in header files 2016-06-11 09:49:00 +02: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 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