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.
This commit is contained in:
Brad King 2015-02-18 12:49:29 -05:00 committed by CMake Topic Stage
commit 93a38a2abc
12 changed files with 24 additions and 71 deletions

View File

@ -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>`.

View File

@ -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
------

View File

@ -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()

View File

@ -32,8 +32,7 @@ cmCTestBuildAndTestHandler::cmCTestBuildAndTestHandler()
//----------------------------------------------------------------------
void cmCTestBuildAndTestHandler::Initialize()
{
this->BuildTargets.erase(
this->BuildTargets.begin(), this->BuildTargets.end());
this->BuildTargets.clear();
this->Superclass::Initialize();
}

View File

@ -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);
}

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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));
}
}
}

View File

@ -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;
}

View File

@ -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)

View File

@ -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)

View File

@ -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;