diff options
author | Brad King <brad.king@kitware.com> | 2015-02-18 17:49:29 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-02-18 17:49:29 (GMT) |
commit | 93a38a2abccf9041fa86a7a6cf3439b1b0480ad1 (patch) | |
tree | 36944c0e1123e3a0a70ecfb4a75e1b8a68761e16 | |
parent | 4fb9e847c0c757ff6e1ee430bbb9fc2b6b4e2ae6 (diff) | |
parent | 6652afe66961bcbb5ff17dd7b8a3a91da62f2712 (diff) | |
download | CMake-93a38a2abccf9041fa86a7a6cf3439b1b0480ad1.zip CMake-93a38a2abccf9041fa86a7a6cf3439b1b0480ad1.tar.gz CMake-93a38a2abccf9041fa86a7a6cf3439b1b0480ad1.tar.bz2 |
Merge topic 'minor-cleanups'
6652afe6 CTest: Use clear instead of erase-all.
75661fdf cmListCommand: Move size variable out of loop.
10e53e23 cmAlgorithms: Add missing const to functors.
74906322 cmAlgorithms: Remove sort of already-sorted container.
2acd04c9 cmcmd: Remove some comment copy-pasta.
2d833232 cmCoreTryCompile: Remove variable assignment.
26602cf5 cmLocalGenerator: Move variable population inside of condition.
cfb84834 Update comment to match recent dashboard testing.
6010f936 Revert "cmGlobalGenerator: Fix value type pushed into autogens vector"
0550b9e3 Revert "Attempt to fix the compile of cmake on Sun CC."
1ee4721f Help: Fix formatting of command parameter.
62429a1e cmGlobalGenerator: Remove unneeded pointer check.
c697c1fa cmTarget: Remove template argument workaround.
-rw-r--r-- | Help/command/target_compile_definitions.rst | 2 | ||||
-rw-r--r-- | Help/manual/cmake-developer.7.rst | 28 | ||||
-rw-r--r-- | Source/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildAndTestHandler.cxx | 3 | ||||
-rw-r--r-- | Source/cmAlgorithms.h | 7 | ||||
-rw-r--r-- | Source/cmCoreTryCompile.cxx | 3 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 5 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 8 | ||||
-rw-r--r-- | Source/cmListCommand.cxx | 12 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 14 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 4 |
12 files changed, 24 insertions, 71 deletions
diff --git a/Help/command/target_compile_definitions.rst b/Help/command/target_compile_definitions.rst index 3c9fe87..8bd3233 100644 --- a/Help/command/target_compile_definitions.rst +++ b/Help/command/target_compile_definitions.rst @@ -9,7 +9,7 @@ Add compile definitions to a target. <INTERFACE|PUBLIC|PRIVATE> [items1...] [<INTERFACE|PUBLIC|PRIVATE> [items2...] ...]) -Specify compile definitions to use when compiling a given <target. The +Specify compile definitions to use when compiling a given ``<target>``. The named ``<target>`` must have been created by a command such as :command:`add_executable` or :command:`add_library` and must not be an :ref:`Imported Target <Imported Targets>`. diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index e18250c..7bffa42 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -28,34 +28,6 @@ Some implementations have a ``std::auto_ptr`` which can not be used as a return value from a function. ``std::auto_ptr`` may not be used. Use ``cmsys::auto_ptr`` instead. -Template Parameter Defaults ---------------------------- - -On ancient compilers, C++ template must use template parameters in function -arguments. If no parameter of that type is needed, the common workaround is -to add a defaulted pointer to the type to the templated function. However, -this does not work with other ancient compilers: - -.. code-block:: c++ - - template<typename PropertyType> - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType* = 0) // Wrong - { - - } - -.. code-block:: c++ - - template<typename PropertyType> - PropertyType getTypedProperty(cmTarget* tgt, const char* prop, - PropertyType*) // Ok - { - - } - -and invoke it with the value ``0`` explicitly in all cases. - size_t ------ diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8a83c3e..69bc2a1 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -520,8 +520,8 @@ if(APPLE) target_link_libraries(CMakeLib "-framework CoreFoundation") endif() -# On some platforms we need the rpcrt4 library for the VS 7 generators. if(CMAKE_BUILD_ON_VISUAL_STUDIO OR MINGW) + # We need the rpcrt4 library for at least the VS7-VC10 generators. target_link_libraries(CMakeLib rpcrt4) endif() diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index d90aeb7..4cdce71 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -32,8 +32,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler() //---------------------------------------------------------------------- void cmCTestBuildAndTestHandler::Initialize() { - this->BuildTargets.erase( - this->BuildTargets.begin(), this->BuildTargets.end()); + this->BuildTargets.clear(); this->Superclass::Initialize(); } diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h index a996088..8491838 100644 --- a/Source/cmAlgorithms.h +++ b/Source/cmAlgorithms.h @@ -99,7 +99,7 @@ template<typename Container, bool valueTypeIsPair = cmIsPair<typename Container::value_type>::value> struct DefaultDeleter { - void operator()(typename Container::value_type value) { + void operator()(typename Container::value_type value) const { delete value; } }; @@ -107,7 +107,7 @@ struct DefaultDeleter template<typename Container> struct DefaultDeleter<Container, /* valueTypeIsPair = */ true> { - void operator()(typename Container::value_type value) { + void operator()(typename Container::value_type value) const { delete value.second; } }; @@ -163,7 +163,7 @@ struct BinarySearcher { } - bool operator()(argument_type const& item) + bool operator()(argument_type const& item) const { return std::binary_search(m_range.begin(), m_range.end(), item); } @@ -275,7 +275,6 @@ typename Range::const_iterator cmRemoveDuplicates(Range& r) { return r.end(); } - std::sort(indices.begin(), indices.end()); return cmRemoveIndices(r, indices); } diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index d9369e6..8e20c14 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -685,8 +685,7 @@ void cmCoreTryCompile::FindOutputFile(const std::string& targetName) command += tmpOutputFile; if(cmSystemTools::FileExists(command.c_str())) { - tmpOutputFile = cmSystemTools::CollapseFullPath(command); - this->OutputFile = tmpOutputFile; + this->OutputFile = cmSystemTools::CollapseFullPath(command); return; } } diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index 6692a92..ba18faa 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -24,10 +24,7 @@ #include <errno.h> //---------------------------------------------------------------------------- -#if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510 -static -#endif -void reportError(cmGeneratorExpressionContext *context, +static void reportError(cmGeneratorExpressionContext *context, const std::string &expr, const std::string &result) { context->HadError = true; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 6d0fedc..1de4a59 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -74,11 +74,7 @@ cmGlobalGenerator::cmGlobalGenerator() cmGlobalGenerator::~cmGlobalGenerator() { this->ClearGeneratorMembers(); - - if (this->ExtraGenerator) - { - delete this->ExtraGenerator; - } + delete this->ExtraGenerator; } bool cmGlobalGenerator::SetGeneratorPlatform(std::string const& p, @@ -1391,7 +1387,7 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens) cmQtAutoGenerators autogen; if(autogen.InitializeAutogenTarget(&target)) { - autogens.push_back(AutogensType::value_type(autogen, &target)); + autogens.push_back(std::make_pair(autogen, &target)); } } } diff --git a/Source/cmListCommand.cxx b/Source/cmListCommand.cxx index 98dcef1..0c6adfd 100644 --- a/Source/cmListCommand.cxx +++ b/Source/cmListCommand.cxx @@ -202,12 +202,12 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) std::string value; size_t cc; const char* sep = ""; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size()-1; cc ++ ) { int item = atoi(args[cc].c_str()); value += sep; sep = ";"; - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -216,8 +216,8 @@ bool cmListCommand::HandleGetCommand(std::vector<std::string> const& args) { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } @@ -485,10 +485,10 @@ bool cmListCommand::HandleRemoveAtCommand( size_t cc; std::vector<size_t> removed; + size_t nitem = varArgsExpanded.size(); for ( cc = 2; cc < args.size(); ++ cc ) { int item = atoi(args[cc].c_str()); - size_t nitem = varArgsExpanded.size(); if ( item < 0 ) { item = (int)nitem + item; @@ -497,8 +497,8 @@ bool cmListCommand::HandleRemoveAtCommand( { std::ostringstream str; str << "index: " << item << " out of range (-" - << varArgsExpanded.size() << ", " - << varArgsExpanded.size()-1 << ")"; + << nitem << ", " + << nitem - 1 << ")"; this->SetError(str.str()); return false; } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 35956ad..6a6135b 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1952,14 +1952,13 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, // Write the library flags to the build rule. fout << linkLibs; - // Get the RPATH entries. - std::vector<std::string> runtimeDirs; - cli.GetRPath(runtimeDirs, relink); - // Check what kind of rpath flags to use. if(cli.GetRuntimeSep().empty()) { // Each rpath entry gets its own option ("-R a -R b -R c") + std::vector<std::string> runtimeDirs; + cli.GetRPath(runtimeDirs, relink); + std::string rpath; for(std::vector<std::string>::iterator ri = runtimeDirs.begin(); ri != runtimeDirs.end(); ++ri) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 526a923..1ad0d48 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4711,13 +4711,11 @@ bool cmTarget::IsNullImpliedByLinkLibraries(const std::string &p) const //---------------------------------------------------------------------------- template<typename PropertyType> -PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop, - PropertyType *); +PropertyType getTypedProperty(cmTarget const* tgt, const std::string& prop); //---------------------------------------------------------------------------- template<> -bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop, - bool *) +bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop) { return tgt->GetPropertyAsBool(prop); } @@ -4725,8 +4723,7 @@ bool getTypedProperty<bool>(cmTarget const* tgt, const std::string& prop, //---------------------------------------------------------------------------- template<> const char *getTypedProperty<const char *>(cmTarget const* tgt, - const std::string& prop, - const char **) + const std::string& prop) { return tgt->GetProperty(prop); } @@ -4937,8 +4934,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, CompatibleType t, PropertyType *) { - PropertyType propContent = getTypedProperty<PropertyType>(tgt, p, - 0); + PropertyType propContent = getTypedProperty<PropertyType>(tgt, p); const bool explicitlySet = tgt->GetProperties() .find(p) != tgt->GetProperties().end(); @@ -4991,7 +4987,7 @@ PropertyType checkInterfacePropertyCompatibility(cmTarget const* tgt, != theTarget->GetProperties().end(); PropertyType ifacePropContent = getTypedProperty<PropertyType>(theTarget, - interfaceProperty, 0); + interfaceProperty); std::string reportEntry; if (ifaceIsSet) diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 5c93975..6a7dc6e 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -287,8 +287,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) } #if defined(CMAKE_BUILD_WITH_CMAKE) - // Command to create a symbolic link. Fails on platforms not - // supporting them. else if (args[1] == "environment" ) { std::vector<std::string> env = cmSystemTools::GetEnvironmentVariables(); @@ -352,8 +350,6 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args) { for (std::string::size_type cc = 2; cc < args.size(); cc ++) { - // Complain if the file could not be removed, still exists, - // and the -f option was not given. if(!cmSystemTools::Touch(args[cc], true)) { return 1; |