Merge topic 'sun-better-stdlib'

3660d063 cmTarget: Use insert instead of std::copy.
5c28495f Help: Remove documented restriction on template use.
ac3d3829 Help: Remove documented restriction on find in conditions.
36b8de56 Help: Remove documented restriction on insert APIs.
6162c919 Use two-iterator std::set::insert where appropriate.
238dd2fb Use insert instead of a loop in some cases.
2f7ef7e3 Revert "Misc. fixes for the Oracle / Sun compiler."
4c69ec6f SolarisStudio: Use alternative standard library to build CMake.
This commit is contained in:
Brad King 2015-01-12 08:57:37 -05:00 committed by CMake Topic Stage
commit 6c61ffaf9b
40 changed files with 137 additions and 433 deletions

View File

@ -75,6 +75,14 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
endif() endif()
endif() endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro)
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
endif()
endif()
# use the ansi CXX compile flag for building cmake # use the ansi CXX compile flag for building cmake
if (CMAKE_ANSI_CXXFLAGS) if (CMAKE_ANSI_CXXFLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")

View File

@ -21,32 +21,6 @@ CMake is required to build with ancient C++ compilers and standard library
implementations. Some common C++ constructs may not be used in CMake in order implementations. Some common C++ constructs may not be used in CMake in order
to build with such toolchains. to build with such toolchains.
std::set const iterators
------------------------
The ``find()`` member function of a ``const`` ``std::set`` instance may not be
used in a comparison with the iterator returned by ``end()``:
.. code-block:: c++
const std::set<std::string>& someSet = getSet();
if (someSet.find("needle") == someSet.end()) // Wrong
{
// ...
}
The return value of ``find()`` must be assigned to an intermediate
``const_iterator`` for comparison:
.. code-block:: c++
const std::set<std::string>& someSet;
const std::set<std::string>::const_iterator i = someSet.find("needle");
if (i != propSet.end()) // Ok
{
// ...
}
std::auto_ptr std::auto_ptr
------------- -------------
@ -54,53 +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 return value from a function. ``std::auto_ptr`` may not be used. Use
``cmsys::auto_ptr`` instead. ``cmsys::auto_ptr`` instead.
std::vector::insert and std::set
--------------------------------
Use of ``std::vector::insert`` with an iterator whose ``element_type`` requires
conversion is not allowed:
.. code-block:: c++
std::set<const char*> theSet;
std::vector<std::string> theVector;
theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong
A loop must be used instead:
.. code-block:: c++
std::set<const char*> theSet;
std::vector<std::string> theVector;
for(std::set<const char*>::iterator li = theSet.begin();
li != theSet.end(); ++li)
{
theVector.push_back(*li);
}
std::set::insert
----------------
Use of ``std::set::insert`` is not allowed with any source container:
.. code-block:: c++
std::set<cmTarget*> theSet;
theSet.insert(targets.begin(), targets.end()); // Wrong
A loop must be used instead:
.. code-block:: c++
ConstIterator it = targets.begin();
const ConstIterator end = targets.end();
for ( ; it != end; ++it)
{
theSet.insert(*it);
}
.. SunCC 5.9
Template Parameter Defaults Template Parameter Defaults
--------------------------- ---------------------------
@ -137,12 +64,6 @@ assigning the result of ``.size()`` on a container for example, the result
should be assigned to ``size_t`` not to ``std::size_t``, ``unsigned int`` or should be assigned to ``size_t`` not to ``std::size_t``, ``unsigned int`` or
similar types. similar types.
Templates
---------
Some template code is permitted, but with some limitations. Member templates
may not be used, and template friends may not be used.
Adding Compile Features Adding Compile Features
======================= =======================

View File

@ -1150,12 +1150,7 @@ void cmCPackWIXGenerator::CollectExtensions(
std::vector<std::string> list; std::vector<std::string> list;
cmSystemTools::ExpandListArgument(variableContent, list); cmSystemTools::ExpandListArgument(variableContent, list);
extensions.insert(list.begin(), list.end());
for(std::vector<std::string>::const_iterator i = list.begin();
i != list.end(); ++i)
{
extensions.insert(*i);
}
} }
void cmCPackWIXGenerator::AddCustomFlags( void cmCPackWIXGenerator::AddCustomFlags(

View File

@ -1094,11 +1094,8 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
{ {
// Create a contiguous array for the line // Create a contiguous array for the line
this->CurrentProcessingLine.clear(); this->CurrentProcessingLine.clear();
t_BuildProcessingQueueType::iterator cit; this->CurrentProcessingLine.insert(this->CurrentProcessingLine.end(),
for ( cit = queue->begin(); cit != it; ++cit ) queue->begin(), queue->end());
{
this->CurrentProcessingLine.push_back(*cit);
}
this->CurrentProcessingLine.push_back(0); this->CurrentProcessingLine.push_back(0);
const char* line = &*this->CurrentProcessingLine.begin(); const char* line = &*this->CurrentProcessingLine.begin();

View File

@ -2498,11 +2498,7 @@ void cmCTestCoverageHandler::LoadLabels(const char* dir)
// Label the source with the target labels. // Label the source with the target labels.
LabelSet& labelSet = this->SourceLabels[source]; LabelSet& labelSet = this->SourceLabels[source];
for(std::vector<int>::const_iterator li = targetLabels.begin(); labelSet.insert(targetLabels.begin(), targetLabels.end());
li != targetLabels.end(); ++li)
{
labelSet.insert(*li);
}
} }
} }
} }

View File

@ -162,12 +162,9 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
//--------------------------------------------------------- //---------------------------------------------------------
void cmCTestMultiProcessHandler::LockResources(int index) void cmCTestMultiProcessHandler::LockResources(int index)
{ {
for(std::set<std::string>::iterator i = this->LockedResources.insert(
this->Properties[index]->LockedResources.begin(); this->Properties[index]->LockedResources.begin(),
i != this->Properties[index]->LockedResources.end(); ++i) this->Properties[index]->LockedResources.end());
{
this->LockedResources.insert(*i);
}
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -499,11 +496,7 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
i != previousSet.end(); ++i) i != previousSet.end(); ++i)
{ {
TestSet const& dependencies = this->Tests[*i]; TestSet const& dependencies = this->Tests[*i];
for(TestSet::const_iterator j = dependencies.begin(); currentSet.insert(dependencies.begin(), dependencies.end());
j != dependencies.end(); ++j)
{
currentSet.insert(*j);
}
} }
for(TestSet::const_iterator i = currentSet.begin(); for(TestSet::const_iterator i = currentSet.begin();
@ -526,11 +519,8 @@ void cmCTestMultiProcessHandler::CreateParallelTestCostList()
TestList sortedCopy; TestList sortedCopy;
for(TestSet::const_iterator j = currentSet.begin(); sortedCopy.insert(sortedCopy.end(),
j != currentSet.end(); ++j) currentSet.begin(), currentSet.end());
{
sortedCopy.push_back(*j);
}
std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp); std::stable_sort(sortedCopy.begin(), sortedCopy.end(), comp);

View File

@ -349,11 +349,7 @@ void cmCTestP4::SetP4Options(std::vector<char const*> &CommandOptions)
std::vector<std::string> args = std::vector<std::string> args =
cmSystemTools::ParseArguments(opts.c_str()); cmSystemTools::ParseArguments(opts.c_str());
for(std::vector<std::string>::const_iterator ai = args.begin(); P4Options.insert(P4Options.end(), args.begin(), args.end());
ai != args.end(); ++ai)
{
P4Options.push_back(*ai);
}
} }
CommandOptions.clear(); CommandOptions.clear();

View File

@ -74,13 +74,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> notesFiles; std::vector<std::string> notesFiles;
cmCTest::VectorOfStrings newNotesFiles; cmCTest::VectorOfStrings newNotesFiles;
cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles); cmSystemTools::ExpandListArgument(notesFilesVariable,notesFiles);
std::vector<std::string>::iterator it; newNotesFiles.insert(newNotesFiles.end(),
for ( it = notesFiles.begin(); notesFiles.begin(), notesFiles.end());
it != notesFiles.end();
++ it )
{
newNotesFiles.push_back(*it);
}
this->CTest->GenerateNotesFile(newNotesFiles); this->CTest->GenerateNotesFile(newNotesFiles);
} }
@ -91,13 +86,8 @@ cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
std::vector<std::string> extraFiles; std::vector<std::string> extraFiles;
cmCTest::VectorOfStrings newExtraFiles; cmCTest::VectorOfStrings newExtraFiles;
cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles); cmSystemTools::ExpandListArgument(extraFilesVariable,extraFiles);
std::vector<std::string>::iterator it; newExtraFiles.insert(newExtraFiles.end(),
for ( it = extraFiles.begin(); extraFiles.begin(), extraFiles.end());
it != extraFiles.end();
++ it )
{
newExtraFiles.push_back(*it);
}
if ( !this->CTest->SubmitExtraFiles(newExtraFiles)) if ( !this->CTest->SubmitExtraFiles(newExtraFiles))
{ {
this->SetError("problem submitting extra files."); this->SetError("problem submitting extra files.");

View File

@ -1160,11 +1160,7 @@ int cmCTestSubmitHandler::ProcessHandler()
{ {
// Submit the explicitly selected files: // Submit the explicitly selected files:
// //
cmCTest::SetOfStrings::const_iterator it; files.insert(this->Files.begin(), this->Files.end());
for (it = this->Files.begin(); it != this->Files.end(); ++it)
{
files.insert(*it);
}
} }
// Add to the list of files to submit from any selected, existing parts: // Add to the list of files to submit from any selected, existing parts:
@ -1219,11 +1215,7 @@ int cmCTestSubmitHandler::ProcessHandler()
// Submit files from this part. // Submit files from this part.
std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p); std::vector<std::string> const& pfiles = this->CTest->GetSubmitFiles(p);
for(std::vector<std::string>::const_iterator pi = pfiles.begin(); files.insert(pfiles.begin(), pfiles.end());
pi != pfiles.end(); ++pi)
{
files.insert(*pi);
}
} }
if ( ofs ) if ( ofs )
@ -1503,9 +1495,5 @@ void cmCTestSubmitHandler::SelectParts(std::set<cmCTest::Part> const& parts)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files) void cmCTestSubmitHandler::SelectFiles(cmCTest::SetOfStrings const& files)
{ {
cmCTest::SetOfStrings::const_iterator it; this->Files.insert(files.begin(), files.end());
for (it = files.begin(); it != files.end(); ++it)
{
this->Files.insert(*it);
}
} }

View File

@ -2163,11 +2163,7 @@ bool cmCTestTestHandler::SetTestsProperties(
std::vector<std::string> lval; std::vector<std::string> lval;
cmSystemTools::ExpandListArgument(val, lval); cmSystemTools::ExpandListArgument(val, lval);
for(std::vector<std::string>::iterator f = lval.begin(); rtit->LockedResources.insert(lval.begin(), lval.end());
f != lval.end(); ++f)
{
rtit->LockedResources.insert(*f);
}
} }
if ( key == "TIMEOUT" ) if ( key == "TIMEOUT" )
{ {

View File

@ -36,11 +36,7 @@ bool cmAddTestCommand
// Collect the command with arguments. // Collect the command with arguments.
std::vector<std::string> command; std::vector<std::string> command;
for(std::vector<std::string>::const_iterator it = args.begin() + 1; command.insert(command.end(), args.begin() + 1, args.end());
it != args.end(); ++it)
{
command.push_back(*it);
}
// Create the test but add a generator only the first time it is // Create the test but add a generator only the first time it is
// seen. This preserves behavior from before test generators. // seen. This preserves behavior from before test generators.

View File

@ -50,13 +50,8 @@ void cmCommandArgument::FollowsGroup(const cmCommandArgumentGroup* group)
if (group!=0) if (group!=0)
{ {
this->ArgumentsBeforeEmpty = false; this->ArgumentsBeforeEmpty = false;
for(std::vector<cmCommandArgument*>::const_iterator this->ArgumentsBefore.insert(group->ContainedArguments.begin(),
argIt= group->ContainedArguments.begin(); group->ContainedArguments.end());
argIt != group->ContainedArguments.end();
++argIt)
{
this->ArgumentsBefore.insert(*argIt);
}
} }
} }

View File

@ -266,10 +266,9 @@ cmComputeLinkDepends::Compute()
// Iterate in reverse order so we can keep only the last occurrence // Iterate in reverse order so we can keep only the last occurrence
// of a shared library. // of a shared library.
std::set<int> emmitted; std::set<int> emmitted;
const std::vector<int>& cFLO = this->FinalLinkOrder;
for(std::vector<int>::const_reverse_iterator for(std::vector<int>::const_reverse_iterator
li = cFLO.rbegin(), li = this->FinalLinkOrder.rbegin(),
le = cFLO.rend(); le = this->FinalLinkOrder.rend();
li != le; ++li) li != le; ++li)
{ {
int i = *li; int i = *li;

View File

@ -408,11 +408,7 @@ cmComputeLinkInformation
// Construct a mask to not bother with this behavior for link // Construct a mask to not bother with this behavior for link
// directories already specified by the user. // directories already specified by the user.
std::vector<std::string> const& dirs = this->Target->GetLinkDirectories(); std::vector<std::string> const& dirs = this->Target->GetLinkDirectories();
for(std::vector<std::string>::const_iterator di = dirs.begin(); this->OldLinkDirMask.insert(dirs.begin(), dirs.end());
di != dirs.end(); ++di)
{
this->OldLinkDirMask.insert(*di);
}
} }
} }
@ -1420,11 +1416,8 @@ void cmComputeLinkInformation::ComputeFrameworkInfo()
cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec); cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
} }
for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); this->FrameworkPathsEmmitted.insert(implicitDirVec.begin(),
i != implicitDirVec.end(); ++i) implicitDirVec.end());
{
this->FrameworkPathsEmmitted.insert(*i);
}
// Regular expression to extract a framework path and name. // Regular expression to extract a framework path and name.
this->SplitFramework.compile("(.*)/(.*)\\.framework$"); this->SplitFramework.compile("(.*)/(.*)\\.framework$");
@ -1694,11 +1687,7 @@ void cmComputeLinkInformation::LoadImplicitLinkInfo()
} }
// Store implicit link directories. // Store implicit link directories.
for(std::vector<std::string>::const_iterator i = implicitDirVec.begin(); this->ImplicitLinkDirs.insert(implicitDirVec.begin(), implicitDirVec.end());
i != implicitDirVec.end(); ++i)
{
this->ImplicitLinkDirs.insert(*i);
}
// Get language-specific implicit libraries. // Get language-specific implicit libraries.
std::vector<std::string> implicitLibVec; std::vector<std::string> implicitLibVec;

View File

@ -53,10 +53,7 @@ bool cmConditionEvaluator::IsTrue(
cmArgumentList newArgs; cmArgumentList newArgs;
// copy to the list structure // copy to the list structure
for(unsigned int i = 0; i < args.size(); ++i) newArgs.insert(newArgs.end(), args.begin(), args.end());
{
newArgs.push_back(args[i]);
}
// now loop through the arguments and see if we can reduce any of them // now loop through the arguments and see if we can reduce any of them
// we do this multiple times. Once for each level of precedence // we do this multiple times. Once for each level of precedence
@ -411,10 +408,7 @@ bool cmConditionEvaluator::HandleLevel0(cmArgumentList &newArgs,
// copy to the list structure // copy to the list structure
cmArgumentList::iterator argP1 = arg; cmArgumentList::iterator argP1 = arg;
argP1++; argP1++;
for(; argP1 != argClose; argP1++) newArgs2.insert(newArgs2.end(), argP1, argClose);
{
newArgs2.push_back(*argP1);
}
newArgs2.pop_back(); newArgs2.pop_back();
// now recursively invoke IsTrue to handle the values inside the // now recursively invoke IsTrue to handle the values inside the
// parenthetical expression // parenthetical expression

View File

@ -131,21 +131,14 @@ const char* cmCustomCommand::GetComment() const
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines) void cmCustomCommand::AppendCommands(const cmCustomCommandLines& commandLines)
{ {
for(cmCustomCommandLines::const_iterator i=commandLines.begin(); this->CommandLines.insert(this->CommandLines.end(),
i != commandLines.end(); ++i) commandLines.begin(), commandLines.end());
{
this->CommandLines.push_back(*i);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends) void cmCustomCommand::AppendDepends(const std::vector<std::string>& depends)
{ {
for(std::vector<std::string>::const_iterator i=depends.begin(); this->Depends.insert(this->Depends.end(), depends.begin(), depends.end());
i != depends.end(); ++i)
{
this->Depends.push_back(*i);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -125,11 +125,7 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources,
this->ValidDeps->find(obj); this->ValidDeps->find(obj);
if (tmpIt!= this->ValidDeps->end()) if (tmpIt!= this->ValidDeps->end())
{ {
for(DependencyVector::const_iterator i=tmpIt->second.begin(); dependencies.insert(tmpIt->second.begin(), tmpIt->second.end());
i != tmpIt->second.end(); ++i)
{
dependencies.insert(*i);
}
haveDeps = true; haveDeps = true;
} }
} }

View File

@ -319,17 +319,13 @@ void cmDependsFortran::LocateModules()
infoI != objInfo.end(); ++infoI) infoI != objInfo.end(); ++infoI)
{ {
cmDependsFortranSourceInfo const& info = infoI->second; cmDependsFortranSourceInfo const& info = infoI->second;
for(std::set<std::string>::const_iterator i = info.Provides.begin(); // Include this module in the set provided by this target.
i != info.Provides.end(); ++i) this->Internal->TargetProvides.insert(info.Provides.begin(),
{ info.Provides.end());
// Include this module in the set provided by this target.
this->Internal->TargetProvides.insert(*i);
}
for(std::set<std::string>::const_iterator i = info.Requires.begin(); for(std::set<std::string>::const_iterator i = info.Requires.begin();
i != info.Requires.end(); ++i) i != info.Requires.end(); ++i)
{ {
// Include this module in the set required by this target.
this->Internal->TargetRequires[*i] = ""; this->Internal->TargetRequires[*i] = "";
} }
} }

View File

@ -456,11 +456,7 @@ void getPropertyContents(cmTarget const* tgt, const std::string& prop,
} }
std::vector<std::string> content; std::vector<std::string> content;
cmSystemTools::ExpandListArgument(p, content); cmSystemTools::ExpandListArgument(p, content);
for (std::vector<std::string>::const_iterator ci = content.begin(); ifaceProperties.insert(content.begin(), content.end());
ci != content.end(); ++ci)
{
ifaceProperties.insert(*ci);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -615,12 +615,8 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
std::vector<std::string> includes; std::vector<std::string> includes;
target->GetMakefile()->GetLocalGenerator()-> target->GetMakefile()->GetLocalGenerator()->
GetIncludeDirectories(includes, gtgt, "C", buildType); GetIncludeDirectories(includes, gtgt, "C", buildType);
for(std::vector<std::string>::const_iterator dirIt=includes.begin();
dirIt != includes.end(); uniqIncludeDirs.insert(includes.begin(), includes.end());
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
std::string systemIncludeDirs = makefile->GetSafeDefinition( std::string systemIncludeDirs = makefile->GetSafeDefinition(
"CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS"); "CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS");
@ -628,12 +624,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); uniqIncludeDirs.insert(dirs.begin(), dirs.end());
dirIt != dirs.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
} }
systemIncludeDirs = makefile->GetSafeDefinition( systemIncludeDirs = makefile->GetSafeDefinition(
@ -642,12 +633,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
{ {
std::vector<std::string> dirs; std::vector<std::string> dirs;
cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs); cmSystemTools::ExpandListArgument(systemIncludeDirs, dirs);
for(std::vector<std::string>::const_iterator dirIt=dirs.begin(); uniqIncludeDirs.insert(dirs.begin(), dirs.end());
dirIt != dirs.end();
++dirIt)
{
uniqIncludeDirs.insert(*dirIt);
}
} }
for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin(); for(std::set<std::string>::const_iterator dirIt=uniqIncludeDirs.begin();

View File

@ -184,10 +184,8 @@ bool cmFindBase::ParseArguments(std::vector<std::string> const& argsIn)
std::vector<std::string> shortArgs = this->Names; std::vector<std::string> shortArgs = this->Names;
this->Names.clear(); // clear out any values in Names this->Names.clear(); // clear out any values in Names
this->Names.push_back(shortArgs[0]); this->Names.push_back(shortArgs[0]);
for(unsigned int j = 1; j < shortArgs.size(); ++j) this->UserGuessArgs.insert(this->UserGuessArgs.end(),
{ shortArgs.begin() + 1, shortArgs.end());
this->UserGuessArgs.push_back(shortArgs[j]);
}
} }
this->ExpandPaths(); this->ExpandPaths();

View File

@ -80,15 +80,12 @@ void cmFindPackageCommand::AppendSearchPathGroups()
PathLabel::SystemRegistry); PathLabel::SystemRegistry);
// Create the new path objects // Create the new path objects
this->LabeledPaths.insert( this->LabeledPaths.insert(std::make_pair(PathLabel::UserRegistry,
std::pair<cmFindCommon::PathLabel, cmSearchPath>( cmSearchPath(this)));
PathLabel::UserRegistry, cmSearchPath(this))); this->LabeledPaths.insert(std::make_pair(PathLabel::Builds,
this->LabeledPaths.insert( cmSearchPath(this)));
std::pair<cmFindCommon::PathLabel, cmSearchPath>( this->LabeledPaths.insert(std::make_pair(PathLabel::SystemRegistry,
PathLabel::Builds, cmSearchPath(this))); cmSearchPath(this)));
this->LabeledPaths.insert(
std::pair<cmFindCommon::PathLabel, cmSearchPath>(
PathLabel::SystemRegistry, cmSearchPath(this)));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -271,11 +271,7 @@ bool cmFunctionCommand
// create a function blocker // create a function blocker
cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker(); cmFunctionFunctionBlocker *f = new cmFunctionFunctionBlocker();
for(std::vector<std::string>::const_iterator j = args.begin(); f->Args.insert(f->Args.end(), args.begin(), args.end());
j != args.end(); ++j)
{
f->Args.push_back(*j);
}
this->Makefile->AddFunctionBlocker(f); this->Makefile->AddFunctionBlocker(f);
return true; return true;
} }

View File

@ -66,9 +66,7 @@ cmGeneratorExpressionDAGChecker::Initialize()
if (it != top->Seen.end()) if (it != top->Seen.end())
{ {
const std::set<std::string> &propSet = it->second; const std::set<std::string> &propSet = it->second;
const std::set<std::string>::const_iterator i if (propSet.find(this->Property) != propSet.end())
= propSet.find(this->Property);
if (i != propSet.end())
{ {
this->CheckResult = ALREADY_SEEN; this->CheckResult = ALREADY_SEEN;
return; return;

View File

@ -489,11 +489,7 @@ bool cmGeneratorTarget::IsSystemIncludeDirectory(const std::string& dir,
unique.insert(*li); unique.insert(*li);
} }
result.clear(); result.clear();
for(std::set<std::string>::iterator li = unique.begin(); result.insert(result.end(), unique.begin(), unique.end());
li != unique.end(); ++li)
{
result.push_back(*li);
}
IncludeCacheType::value_type entry(config_upper, result); IncludeCacheType::value_type entry(config_upper, result);
iter = this->SystemIncludesCache.insert(entry).first; iter = this->SystemIncludesCache.insert(entry).first;
@ -822,11 +818,7 @@ cmTargetTraceDependencies
= ge.Parse(*cli); = ge.Parse(*cli);
cge->Evaluate(this->Makefile, "", true); cge->Evaluate(this->Makefile, "", true);
std::set<cmTarget*> geTargets = cge->GetTargets(); std::set<cmTarget*> geTargets = cge->GetTargets();
for(std::set<cmTarget*>::const_iterator it = geTargets.begin(); targets.insert(geTargets.begin(), geTargets.end());
it != geTargets.end(); ++it)
{
targets.insert(*it);
}
} }
} }

View File

@ -1021,12 +1021,9 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
} }
//insert outputs from all WirteBuild commands //insert outputs from all WirteBuild commands
for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin(); //these paths have already be encoded when added to CombinedBuildOutputs
i != this->CombinedBuildOutputs.end(); ++i) knownDependencies.insert(this->CombinedBuildOutputs.begin(),
{ this->CombinedBuildOutputs.end());
//these paths have already be encoded when added to CombinedBuildOutputs
knownDependencies.insert(*i);
}
//after we have combined the data into knownDependencies we have no need //after we have combined the data into knownDependencies we have no need
//to keep this data around //to keep this data around

View File

@ -845,22 +845,14 @@ cmGlobalVisualStudioGenerator::TargetCompare
cmGlobalVisualStudioGenerator::OrderedTargetDependSet cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetDependSet const& targets) ::OrderedTargetDependSet(TargetDependSet const& targets)
{ {
for(TargetDependSet::const_iterator ti = this->insert(targets.begin(), targets.end());
targets.begin(); ti != targets.end(); ++ti)
{
this->insert(*ti);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
cmGlobalVisualStudioGenerator::OrderedTargetDependSet cmGlobalVisualStudioGenerator::OrderedTargetDependSet
::OrderedTargetDependSet(TargetSet const& targets) ::OrderedTargetDependSet(TargetSet const& targets)
{ {
for(TargetSet::const_iterator ti = targets.begin(); this->insert(targets.begin(), targets.end());
ti != targets.end(); ++ti)
{
this->insert(*ti);
}
} }
std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir( std::string cmGlobalVisualStudioGenerator::ExpandCFGIntDir(

View File

@ -71,11 +71,7 @@ bool cmIncludeDirectoryCommand
} }
if (system) if (system)
{ {
for (std::vector<std::string>::const_iterator li = includes.begin(); systemIncludes.insert(includes.begin(), includes.end());
li != includes.end(); ++li)
{
systemIncludes.insert(*li);
}
} }
} }
std::reverse(beforeIncludes.begin(), beforeIncludes.end()); std::reverse(beforeIncludes.begin(), beforeIncludes.end());

View File

@ -47,11 +47,8 @@ bool cmInstallFilesCommand
else else
{ {
this->IsFilesForm = false; this->IsFilesForm = false;
std::vector<std::string>::const_iterator s = args.begin(); this->FinalArgs.insert(this->FinalArgs.end(),
for (++s;s != args.end(); ++s) args.begin() + 1, args.end());
{
this->FinalArgs.push_back(*s);
}
} }
this->Makefile->GetLocalGenerator()->GetGlobalGenerator() this->Makefile->GetLocalGenerator()->GetGlobalGenerator()

View File

@ -27,11 +27,7 @@ bool cmInstallProgramsCommand
this->Destination = args[0]; this->Destination = args[0];
std::vector<std::string>::const_iterator s = args.begin(); this->FinalArgs.insert(this->FinalArgs.end(), args.begin() + 1, args.end());
for (++s;s != args.end(); ++s)
{
this->FinalArgs.push_back(*s);
}
this->Makefile->GetLocalGenerator()->GetGlobalGenerator() this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->AddInstallComponent(this->Makefile->GetSafeDefinition( ->AddInstallComponent(this->Makefile->GetSafeDefinition(

View File

@ -634,11 +634,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
// Parse the string to get the custom command line. // Parse the string to get the custom command line.
cmCustomCommandLine commandLine; cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
for(std::vector<std::string>::iterator a = cmd.begin(); commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
a != cmd.end(); ++a)
{
commandLine.push_back(*a);
}
// Store this command line. // Store this command line.
commandLines.push_back(commandLine); commandLines.push_back(commandLine);
@ -745,11 +741,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang,
// Parse the string to get the custom command line. // Parse the string to get the custom command line.
cmCustomCommandLine commandLine; cmCustomCommandLine commandLine;
std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str()); std::vector<std::string> cmd = cmSystemTools::ParseArguments(i->c_str());
for(std::vector<std::string>::iterator a = cmd.begin(); commandLine.insert(commandLine.end(), cmd.begin(), cmd.end());
a != cmd.end(); ++a)
{
commandLine.push_back(*a);
}
// Store this command line. // Store this command line.
commandLines.push_back(commandLine); commandLines.push_back(commandLine);

View File

@ -1856,13 +1856,8 @@ void cmLocalUnixMakefileGenerator3
{ {
text = "Running external command ..."; text = "Running external command ...";
} }
std::set<std::string>::const_iterator dit; depends.insert(depends.end(), glIt->second.GetUtilities().begin(),
for ( dit = glIt->second.GetUtilities().begin(); glIt->second.GetUtilities().end());
dit != glIt->second.GetUtilities().end();
++ dit )
{
depends.push_back(*dit);
}
this->AppendEcho(commands, text, this->AppendEcho(commands, text,
cmLocalUnixMakefileGenerator3::EchoGlobal); cmLocalUnixMakefileGenerator3::EchoGlobal);

View File

@ -328,11 +328,7 @@ bool cmMacroCommand::InitialPass(std::vector<std::string> const& args,
// create a function blocker // create a function blocker
cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker(); cmMacroFunctionBlocker *f = new cmMacroFunctionBlocker();
for(std::vector<std::string>::const_iterator j = args.begin(); f->Args.insert(f->Args.end(), args.begin(), args.end());
j != args.end(); ++j)
{
f->Args.push_back(*j);
}
this->Makefile->AddFunctionBlocker(f); this->Makefile->AddFunctionBlocker(f);
return true; return true;
} }

View File

@ -1822,11 +1822,7 @@ void cmMakefile::AddIncludeDirectories(const std::vector<std::string> &incs,
void void
cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs) cmMakefile::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{ {
for(std::set<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
for (cmTargets::iterator l = this->Targets.begin(); for (cmTargets::iterator l = this->Targets.begin();
l != this->Targets.end(); ++l) l != this->Targets.end(); ++l)
@ -2567,12 +2563,7 @@ std::vector<std::string> cmMakefile
} }
std::vector<std::string> res; std::vector<std::string> res;
res.insert(res.end(), definitions.begin(), definitions.end());
std::set<std::string>::iterator fit;
for ( fit = definitions.begin(); fit != definitions.end(); fit ++ )
{
res.push_back(*fit);
}
return res; return res;
} }
@ -4561,16 +4552,8 @@ void cmMakefile::PopScope()
this->Internal->VarInitStack.pop(); this->Internal->VarInitStack.pop();
this->Internal->VarUsageStack.pop(); this->Internal->VarUsageStack.pop();
// Push initialization and usage up to the parent scope. // Push initialization and usage up to the parent scope.
it = init.begin(); this->Internal->VarInitStack.top().insert(init.begin(), init.end());
for (; it != init.end(); ++it) this->Internal->VarUsageStack.top().insert(usage.begin(), usage.end());
{
this->Internal->VarInitStack.top().insert(*it);
}
it = usage.begin();
for (; it != usage.end(); ++it)
{
this->Internal->VarUsageStack.top().insert(*it);
}
} }
void cmMakefile::RaiseScope(const std::string& var, const char *varDef) void cmMakefile::RaiseScope(const std::string& var, const char *varDef)

View File

@ -759,13 +759,10 @@ cmMakefileTargetGenerator
if(const char* extra_outputs_str = if(const char* extra_outputs_str =
source.GetProperty("OBJECT_OUTPUTS")) source.GetProperty("OBJECT_OUTPUTS"))
{ {
// Register these as extra files to clean.
cmSystemTools::ExpandListArgument(extra_outputs_str, outputs); cmSystemTools::ExpandListArgument(extra_outputs_str, outputs);
for(std::vector<std::string>::const_iterator eoi = outputs.begin()+1; this->CleanFiles.insert(this->CleanFiles.end(),
eoi != outputs.end(); ++eoi) outputs.begin() + 1, outputs.end());
{
// Register this as an extra file to clean.
this->CleanFiles.push_back(*eoi);
}
} }
// Write the rule. // Write the rule.
@ -1174,11 +1171,7 @@ cmMakefileTargetGenerator
{ {
cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile); cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
const std::vector<std::string>& outputs = ccg.GetOutputs(); const std::vector<std::string>& outputs = ccg.GetOutputs();
for(std::vector<std::string>::const_iterator o = outputs.begin(); depends.insert(depends.end(), outputs.begin(), outputs.end());
o != outputs.end(); ++o)
{
depends.push_back(*o);
}
} }
} }
} }
@ -1462,11 +1455,8 @@ void cmMakefileTargetGenerator::WriteTargetDriverRule(
} }
// Make sure the extra files are built. // Make sure the extra files are built.
for(std::set<std::string>::const_iterator i = this->ExtraFiles.begin(); depends.insert(depends.end(),
i != this->ExtraFiles.end(); ++i) this->ExtraFiles.begin(), this->ExtraFiles.end());
{
depends.push_back(*i);
}
} }
// Write the driver rule. // Write the driver rule.
@ -1553,11 +1543,7 @@ void cmMakefileTargetGenerator
if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg))
{ {
std::vector<std::string> const& libDeps = cli->GetDepends(); std::vector<std::string> const& libDeps = cli->GetDepends();
for(std::vector<std::string>::const_iterator j = libDeps.begin(); depends.insert(depends.end(), libDeps.begin(), libDeps.end());
j != libDeps.end(); ++j)
{
depends.push_back(*j);
}
} }
} }
@ -1577,12 +1563,8 @@ void cmMakefileTargetGenerator
} }
// Add dependencies on the external object files. // Add dependencies on the external object files.
for(std::vector<std::string>::const_iterator obj depends.insert(depends.end(),
= this->ExternalObjects.begin(); this->ExternalObjects.begin(), this->ExternalObjects.end());
obj != this->ExternalObjects.end(); ++obj)
{
depends.push_back(*obj);
}
// Add a dependency on the rule file itself. // Add a dependency on the rule file itself.
this->LocalGenerator->AppendRuleDepend(depends, this->LocalGenerator->AppendRuleDepend(depends,

View File

@ -899,12 +899,7 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
std::set<std::string> skipped; std::set<std::string> skipped;
std::vector<std::string> skipVec; std::vector<std::string> skipVec;
cmSystemTools::ExpandListArgument(this->SkipUic, skipVec); cmSystemTools::ExpandListArgument(this->SkipUic, skipVec);
skipped.insert(skipVec.begin(), skipVec.end());
for (std::vector<std::string>::const_iterator li = skipVec.begin();
li != skipVec.end(); ++li)
{
skipped.insert(*li);
}
makefile->AddDefinition("_skip_uic", makefile->AddDefinition("_skip_uic",
cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str()); cmLocalGenerator::EscapeForCMake(this->SkipUic).c_str());
@ -1622,12 +1617,7 @@ bool cmQtAutoGenerators::RunAutogen(cmMakefile* makefile)
std::vector<std::string> headerFilesVec; std::vector<std::string> headerFilesVec;
cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec); cmSystemTools::ExpandListArgument(this->Headers, headerFilesVec);
for (std::vector<std::string>::const_iterator it = headerFilesVec.begin(); headerFiles.insert(headerFilesVec.begin(), headerFilesVec.end());
it != headerFilesVec.end();
++it)
{
headerFiles.insert(*it);
}
// key = moc source filepath, value = moc output filename // key = moc source filepath, value = moc output filename
std::map<std::string, std::string> notIncludedMocs; std::map<std::string, std::string> notIncludedMocs;
@ -2188,24 +2178,12 @@ bool cmQtAutoGenerators::GenerateMoc(const std::string& sourceFile,
std::vector<std::string> command; std::vector<std::string> command;
command.push_back(this->MocExecutable); command.push_back(this->MocExecutable);
for (std::list<std::string>::const_iterator it = this->MocIncludes.begin(); command.insert(command.end(),
it != this->MocIncludes.end(); this->MocIncludes.begin(), this->MocIncludes.end());
++it) command.insert(command.end(),
{ this->MocDefinitions.begin(), this->MocDefinitions.end());
command.push_back(*it); command.insert(command.end(),
} this->MocOptions.begin(), this->MocOptions.end());
for(std::list<std::string>::const_iterator it=this->MocDefinitions.begin();
it != this->MocDefinitions.end();
++it)
{
command.push_back(*it);
}
for(std::vector<std::string>::const_iterator it=this->MocOptions.begin();
it != this->MocOptions.end();
++it)
{
command.push_back(*it);
}
#ifdef _WIN32 #ifdef _WIN32
command.push_back("-DWIN32"); command.push_back("-DWIN32");
#endif #endif
@ -2277,12 +2255,7 @@ bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
cmSystemTools::ExpandListArgument(optionIt->second, fileOpts); cmSystemTools::ExpandListArgument(optionIt->second, fileOpts);
this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5"); this->MergeUicOptions(opts, fileOpts, this->QtMajorVersion == "5");
} }
for(std::vector<std::string>::const_iterator optIt = opts.begin(); command.insert(command.end(), opts.begin(), opts.end());
optIt != opts.end();
++optIt)
{
command.push_back(*optIt);
}
command.push_back("-o"); command.push_back("-o");
command.push_back(this->Builddir + ui_output_file); command.push_back(this->Builddir + ui_output_file);

View File

@ -39,10 +39,7 @@ bool cmRemoveCommand
// check for REMOVE(VAR v1 v2 ... vn) // check for REMOVE(VAR v1 v2 ... vn)
std::vector<std::string> argsExpanded; std::vector<std::string> argsExpanded;
std::vector<std::string> temp; std::vector<std::string> temp;
for(unsigned int j = 1; j < args.size(); ++j) temp.insert(temp.end(), args.begin() + 1, args.end());
{
temp.push_back(args[j]);
}
cmSystemTools::ExpandList(temp, argsExpanded); cmSystemTools::ExpandList(temp, argsExpanded);
// now create the new value // now create the new value

View File

@ -1273,11 +1273,7 @@ bool cmSystemTools::Split(const char* s, std::vector<std::string>& l)
{ {
std::vector<std::string> temp; std::vector<std::string> temp;
bool res = Superclass::Split(s, temp); bool res = Superclass::Split(s, temp);
for(std::vector<std::string>::const_iterator i = temp.begin(); l.insert(l.end(), temp.begin(), temp.end());
i != temp.end(); ++i)
{
l.push_back(*i);
}
return res; return res;
} }

View File

@ -424,12 +424,8 @@ void cmTarget::SetMakefile(cmMakefile* mf)
const std::set<std::string> parentSystemIncludes = const std::set<std::string> parentSystemIncludes =
this->Makefile->GetSystemIncludeDirectories(); this->Makefile->GetSystemIncludeDirectories();
for (std::set<std::string>::const_iterator it this->SystemIncludeDirectories.insert(parentSystemIncludes.begin(),
= parentSystemIncludes.begin(); parentSystemIncludes.end());
it != parentSystemIncludes.end(); ++it)
{
this->SystemIncludeDirectories.insert(*it);
}
const std::vector<cmValueWithOrigin> parentOptions = const std::vector<cmValueWithOrigin> parentOptions =
this->Makefile->GetCompileOptionsEntries(); this->Makefile->GetCompileOptionsEntries();
@ -1397,22 +1393,14 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf,
void void
cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs) cmTarget::AddSystemIncludeDirectories(const std::set<std::string> &incs)
{ {
for(std::set<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void void
cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs) cmTarget::AddSystemIncludeDirectories(const std::vector<std::string> &incs)
{ {
for(std::vector<std::string>::const_iterator li = incs.begin(); this->SystemIncludeDirectories.insert(incs.begin(), incs.end());
li != incs.end(); ++li)
{
this->SystemIncludeDirectories.insert(*li);
}
} }
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
@ -6070,8 +6058,8 @@ cmTargetInternals::ComputeLinkInterfaceLibraries(
// The link implementation is the default link interface. // The link implementation is the default link interface.
cmTarget::LinkImplementationLibraries const* impl = cmTarget::LinkImplementationLibraries const* impl =
thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget); thisTarget->GetLinkImplementationLibrariesInternal(config, headTarget);
std::copy(impl->Libraries.begin(), impl->Libraries.end(), iface.Libraries.insert(iface.Libraries.end(),
std::back_inserter(iface.Libraries)); impl->Libraries.begin(), impl->Libraries.end());
if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN && if(thisTarget->PolicyStatusCMP0022 == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && !usage_requirements_only) !this->PolicyWarnedCMP0022 && !usage_requirements_only)
{ {
@ -6449,11 +6437,8 @@ cmTargetInternals::ComputeLinkImplementationLanguages(
// Get languages used in our source files. // Get languages used in our source files.
thisTarget->GetLanguages(languages, config); thisTarget->GetLanguages(languages, config);
// Copy the set of langauges to the link implementation. // Copy the set of langauges to the link implementation.
for(std::set<std::string>::iterator li = languages.begin(); impl.Languages.insert(impl.Languages.begin(),
li != languages.end(); ++li) languages.begin(), languages.end());
{
impl.Languages.push_back(*li);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -1154,6 +1154,35 @@ if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
cmake_test_flags= cmake_test_flags=
fi fi
if [ "x${cmake_cxx_compiler_is_gnu}" != "x1" ]; then
# Are we SolarisStudio?
TMPFILE=`cmake_tmp_file`
echo '
#if defined(__SUNPRO_CC)
#include <iostream>
int main() { std::cout << "This is SolarisStudio" << std::endl; return 0;}
#endif
' > ${TMPFILE}.cxx
cmake_cxx_compiler_is_solarisstudio=0
if cmake_try_run "${cmake_cxx_compiler}" \
"${cmake_cxx_flags} " "${TMPFILE}.cxx" >> cmake_bootstrap.log 2>&1; then
cmake_cxx_compiler_is_solarisstudio=1
fi
if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
echo "${cmake_cxx_compiler} is SolarisStudio compiler"
else
echo "${cmake_cxx_compiler} is not SolarisStudio compiler"
fi
rm -f "${TMPFILE}.cxx"
if [ "x${cmake_cxx_compiler_is_solarisstudio}" = "x1" ]; then
cmake_cxx_flags="${cmake_cxx_flags} -library=stlport4"
fi
fi
# Test for kwsys features # Test for kwsys features
KWSYS_NAME_IS_KWSYS=0 KWSYS_NAME_IS_KWSYS=0
KWSYS_BUILD_SHARED=0 KWSYS_BUILD_SHARED=0