Commit Graph

50 Commits

Author SHA1 Message Date
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 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 afca373510 Help clang-format wrap after braces on long initializer lists
Add a long comment inside a few braced initializer lists in order to
convince clang-format to break after the opening brace and format the
list without indenting every value past the opening brace.
2016-05-06 15:54:32 -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
Robert Goulet b860a92582 Xcode: Refactor block writes to allow any level of nesting
Reviewed-by: Gregor Jasny <gjasny@googlemail.com>
2016-02-24 09:36:54 -05:00
Gregor Jasny ba39d7e9d0 Xcode: Escape all backslashes in strings (#15328)
Before this change backslashes in strings were escaped during compile
flags adds via AppendFlag(). But global flags like OTHER_CPLUSPLUSFLAGS
are not added as flags but as plain strings so they were not escaped
properly.

Now the escaping is performed within cmXCodeObject::PrintString() which
ensures that strings are always encoded.
2016-01-07 13:23:24 -05:00
Gregor Jasny 2eee2943cc Xcode: Invert quoting logic to whitelist of characters
Our explicit list of characters that require quoting does not account
for non-ascii characters (e.g. UTF-8) that also need quoting.  Invert
the logic to quote a string unless it contains exclusively a set of
characters we whitelist.
2015-08-05 13:51:31 -04:00
Gregor Jasny f7a9ed7e90 Xcode: Quote strings containing a tilde (#15672)
Since commit v3.3.0-rc1~183^2 (Xcode: Refine quoting rules for Strings,
2015-04-09) we no longer quote strings containing a period ('.').
However, file names like "icon29x29~ipad.png" still need quoting because
they contain a tilde ('~').  Add tilde to our explicit list of
characters that need quoting because such file names will no longer
happen to be quoted because they contain a period.
2015-07-31 08:44:27 -04:00
Gregor Jasny 6693590f81 Xcode: Refine quoting rules for Strings
$ and . do not need to be quoted, but brackets and * must be to
not confuse the Xcode parser.
2015-04-17 21:50:05 +02:00
Gregor Jasny a6331eb851 Xcode: Let PrintComment decide if the comment is non-empty 2015-04-17 21:50:05 +02:00
Gregor Jasny 6e8952c193 Xcode: PrintComment will prepend a whitespace itself before the comment 2015-04-17 21:50:05 +02:00
Gregor Jasny 4bd2544b25 Xcode: Do not add whitespace after attribute group opening brace
This suppresses the extra space that would be generated if the
separator is a space. The conditional block is also used in this
form elsewhere.
2015-04-17 21:50:04 +02:00
Gregor Jasny 5cb4c8380d Xcode: Properly indent PBXFileReference and PBXBuildFile
Move indent factor change behind indention of start-of-line.
2015-04-17 21:50:04 +02:00
Gregor Jasny 2e0e205e28 Xcode: Indent using tabs 2015-04-17 21:50:04 +02:00
Gregor Jasny dfd6f1f290 Xcode: Also quote strings containing // (#15487)
Otherwise those will be interpreted as start of a comment

Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
2015-04-04 22:13:45 +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 b26c70cc9a stringapi: Use strings for AddString methods
It gets turned into a string anyways, so pass them in.
2014-03-08 13:05:30 -05:00
Brad King b005140451 Xcode: Each target dependency edge needs a unique object (#13935)
Generate a unique PBXTargetDependency and PBXContainerItemProxy for
every edge in the dependency graph as required by the Xcode format.
Xcode only accidentally loads project files that re-use the same
PBXTargetDependency for every edge leading to a single target.  If one
is removed by hand in the IDE then Xcode may crash due to dangling
references from the others.

Since cmGlobalXCodeGenerator::AddDependTarget is called exactly once for
every edge in the target dependency graph we do not need to keep track
of which edges have been visited to avoid generating duplicates.
2013-02-19 16:45:58 -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
David Cole 1834f232a7 Xcode: Save object id values in CMakeCache.txt (#11690)
For project and target objects, save their ids in CMakeCache.txt.

Hopefully, that will be enough to allow user settings to be saved
across multiple CMake generate operations. Other object types may
also need their ids saved: if so, more code than this commit
will be necessary...
2011-08-24 18:11:32 -04:00
Johan Björk d87eb350f6 Xcode: Quote ',' in Xcode string values (#12259) 2011-08-04 13:03:44 -04:00
Johan Björk c519bb2bb6 XCode: Also qoute [] as needed to set build-configurations. 2011-04-07 13:17:03 -04:00
Mikkel Krautz a8ded5338b Xcode: Quote string values containing '$' (#11244)
Allow use of $(STANDARD_32BIT_ARCHS) as CMAKE_OSX_ARCHITECTURES.
The expanded value must remain a single string.
2010-09-20 10:08:40 -04: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 698b8044a6 ENH: Simplify string attributes in Xcode generator
This change cleans up the implementation of cmXCodeObject to avoid
un-escaping and re-escaping string values.  There is no need to store
the string in escaped form.  It can be escaped once when it is printed
out to the generated project file.
2008-09-02 10:27:15 -04:00
Bill Hoffman 8f4fb4ba2a ENH: fix for 64 bit cmake on mac 2008-05-08 21:14:16 -04:00
David Cole fa61182de8 ENH: Improvements to the Xcode generator. Build frameworks using native Copy Headers and Copy Bundle Resources phases. Fix bugs: eliminate folders with no names, ensure source files show up in multiple targets, remove empty utility targets from Sources subtrees, ensure that fileRefs only show up once in each grouping folder. 2007-08-14 11:45:15 -04:00
Bill Hoffman 2745742e09 STYLE: fix some kwstyle errors 2007-07-27 10:55:24 -04:00
Bill Hoffman a3d4d549ba ENH: @ must be escaped in xcode projects 2007-05-27 10:32:22 -04:00
Bill Hoffman 7a13c7affe BUG: fix for quotes in strings for flags #4022 2007-02-21 14:01:19 -05:00
Ken Martin bf5ed9b27b STYLE: fix line length 2006-05-12 14:36:39 -04:00
Andy Cedilnik 32ec28ad00 ENH: Add copy stages for bundle files 2006-03-29 15:02:35 -05:00
Ken Martin da279f0041 BUG: some UNIX fixes for my m_ commit 2006-03-15 11:38:47 -05:00
Ken Martin 3d96e52261 STYLE: some m_ to this-> cleanup 2006-03-15 11:02:08 -05:00
Bill Hoffman 89e5fc63fe STYLE: fix line lengths 2006-03-10 13:54:57 -05:00
Bill Hoffman 1c01c12af3 ENH: more chars need quotes 2005-11-18 16:59:53 -05:00
Bill Hoffman 8b7091a0a6 ENH: fixes for xcode21 and build styles and comments in the generated project 2005-11-16 13:13:39 -05:00
Bill Hoffman 6b4c142c7d ENH: add real support for Xcode21 2005-09-02 16:29:32 -04:00
Bill Hoffman 0bc51d181d ENH: fix bug in target linking 2005-02-07 17:36:34 -05:00
Bill Hoffman 8659d1206b ENH: this version can build cmake 2005-02-04 17:58:58 -05:00
Bill Hoffman fd0f29e6f4 ENH: depends work between targets 2005-02-03 17:42:55 -05:00
Bill Hoffman 68c419c780 ENH: getting closer 2005-02-02 17:16:07 -05:00
Bill Hoffman 7baa78034e ENH: getting closer 2005-02-01 15:48:33 -05:00
Bill Hoffman b9982e4b60 ENH: xcode almost working for simple exe, but not yet 2005-01-27 17:09:09 -05:00
Bill Hoffman e2ff9a73fa ENH: fix a few more xcode things 2005-01-27 16:43:18 -05:00
Bill Hoffman df730d29de ENH: add missing ; 2005-01-27 16:25:15 -05:00
Bill Hoffman 97a51d2172 ENH: add more xcode stuff 2005-01-27 16:11:44 -05:00
Bill Hoffman 96daa417cb ENH: add initial non-working XCode stuff 2005-01-25 15:26:57 -05:00
Bill Hoffman e57b17df7e ENH: initial xcode stuff 2005-01-24 17:35:54 -05:00
Bill Hoffman 2f631642ca ENH: start xcode stuff 2005-01-21 16:25:36 -05:00