summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-26 20:52:22 (GMT)
committerDaniel Pfeifer <daniel@pfeifer-mail.de>2016-05-26 20:52:22 (GMT)
commit1b2bb93302116a4791cf82e9cce028dfe87ef55d (patch)
treeb20aead9b34d9bdba3243439dd8f0aed032727e2 /Source
parentacd8a73044e879286f0cfa24b54497a8307f204b (diff)
downloadCMake-1b2bb93302116a4791cf82e9cce028dfe87ef55d.zip
CMake-1b2bb93302116a4791cf82e9cce028dfe87ef55d.tar.gz
CMake-1b2bb93302116a4791cf82e9cce028dfe87ef55d.tar.bz2
Remove redundant c_str() calls.
Run clang-tidy's readability-redundant-string-cstr checker. Ignore findings in kwsys.
Diffstat (limited to 'Source')
-rw-r--r--Source/CPack/cpack.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx2
-rw-r--r--Source/CTest/cmCTestGenericHandler.cxx2
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx22
-rw-r--r--Source/CTest/cmCTestRunTest.cxx4
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx2
-rw-r--r--Source/CTest/cmParseBlanketJSCoverage.cxx2
-rw-r--r--Source/CTest/cmParseGTMCoverage.cxx2
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx4
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx4
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx5
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx7
-rw-r--r--Source/cmMakefileTargetGenerator.cxx12
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx6
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx2
-rw-r--r--Source/cmState.cxx8
-rw-r--r--Source/cmcmd.cxx3
17 files changed, 40 insertions, 51 deletions
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 10f60b2..94e1615 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -414,8 +414,8 @@ int main(int argc, char const* const* argv)
for (generatorIt = generators.GetGeneratorsList().begin();
generatorIt != generators.GetGeneratorsList().end(); ++generatorIt) {
cmDocumentationEntry e;
- e.Name = generatorIt->first.c_str();
- e.Brief = generatorIt->second.c_str();
+ e.Name = generatorIt->first;
+ e.Brief = generatorIt->second;
v.push_back(e);
}
doc.SetSection("Generators", v);
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index 51456ed..7f0bf2c 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -1622,7 +1622,7 @@ bool cmCTestCoverageHandler::FindLCovFiles(std::vector<std::string>& files)
return false;
}
- prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory().c_str();
+ prevBinaryDir = cmSystemTools::GetCurrentWorkingDirectory();
// DPI file should appear in build directory
std::string daGlob;
diff --git a/Source/CTest/cmCTestGenericHandler.cxx b/Source/CTest/cmCTestGenericHandler.cxx
index 1c80acd..18caabe 100644
--- a/Source/CTest/cmCTestGenericHandler.cxx
+++ b/Source/CTest/cmCTestGenericHandler.cxx
@@ -68,7 +68,7 @@ void cmCTestGenericHandler::Initialize()
t_StringToString::iterator it;
for (it = this->PersistentOptions.begin();
it != this->PersistentOptions.end(); ++it) {
- this->Options[it->first] = it->second.c_str();
+ this->Options[it->first] = it->second;
}
}
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 2cbd64d..5ae98af 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -422,7 +422,7 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str())) {
this->MemoryTester =
- this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
+ this->CTest->GetCTestConfiguration("MemoryCheckCommand");
std::string testerName =
cmSystemTools::GetFilenameName(this->MemoryTester);
// determine the checker type
@@ -438,47 +438,41 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
}
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("PurifyCommand").c_str())) {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("PurifyCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("ValgrindCommand")
.c_str())) {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("ValgrindCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
} else if (cmSystemTools::FileExists(
this->CTest->GetCTestConfiguration("BoundsCheckerCommand")
.c_str())) {
this->MemoryTester =
- this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
+ this->CTest->GetCTestConfiguration("BoundsCheckerCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"AddressSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"ThreadSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"MemorySanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::MEMORY_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
if (this->CTest->GetCTestConfiguration("MemoryCheckType") ==
"UndefinedBehaviorSanitizer") {
- this->MemoryTester =
- this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+ this->MemoryTester = this->CTest->GetCTestConfiguration("CMakeCommand");
this->MemoryTesterStyle = cmCTestMemCheckHandler::UB_SANITIZER;
this->LogWithPID = true; // even if we give the log file the pid is added
}
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 59383af..9dda865 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -424,7 +424,7 @@ bool cmCTestRunTest::StartTest(size_t total)
this->TestResult.Status = cmCTestTestHandler::BAD_COMMAND;
this->TestResult.TestCount = this->TestProperties->Index;
this->TestResult.Name = this->TestProperties->Name;
- this->TestResult.Path = this->TestProperties->Directory.c_str();
+ this->TestResult.Path = this->TestProperties->Directory;
if (args.size() >= 2 && args[1] == "NOT_AVAILABLE") {
this->TestProcess = new cmProcess;
@@ -502,7 +502,7 @@ void cmCTestRunTest::ComputeArguments()
if (this->TestHandler->MemCheck) {
cmCTestMemCheckHandler* handler =
static_cast<cmCTestMemCheckHandler*>(this->TestHandler);
- this->ActualCommand = handler->MemoryTester.c_str();
+ this->ActualCommand = handler->MemoryTester;
this->TestProperties->Args[1] = this->TestHandler->FindTheExecutable(
this->TestProperties->Args[1].c_str());
} else {
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index ba0e816..6389a9d 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -485,7 +485,7 @@ int cmCTestScriptHandler::ExtractVariables()
// if the dashboard root isn't specified then we can compute it from the
// this->SourceDir
if (this->CTestRoot.empty()) {
- this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir).c_str();
+ this->CTestRoot = cmSystemTools::GetFilenamePath(this->SourceDir);
}
// the script may override the minimum continuous interval
diff --git a/Source/CTest/cmParseBlanketJSCoverage.cxx b/Source/CTest/cmParseBlanketJSCoverage.cxx
index 1e42847..152c354 100644
--- a/Source/CTest/cmParseBlanketJSCoverage.cxx
+++ b/Source/CTest/cmParseBlanketJSCoverage.cxx
@@ -74,7 +74,7 @@ public:
}
foundFile = true;
inSource = false;
- filename = getValue(line, 0).c_str();
+ filename = getValue(line, 0);
} else if ((line.find("coverage") != line.npos) && foundFile &&
inSource) {
/*
diff --git a/Source/CTest/cmParseGTMCoverage.cxx b/Source/CTest/cmParseGTMCoverage.cxx
index a065903..33ad839 100644
--- a/Source/CTest/cmParseGTMCoverage.cxx
+++ b/Source/CTest/cmParseGTMCoverage.cxx
@@ -121,7 +121,7 @@ bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
std::string line;
int linenum = 0;
while (cmSystemTools::GetLineFromStream(in, line)) {
- std::string::size_type pos = line.find(function.c_str());
+ std::string::size_type pos = line.find(function);
if (pos == 0) {
char nextchar = line[function.size()];
if (nextchar == ' ' || nextchar == '(' || nextchar == '\t') {
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index c69e362..5b48eea 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -76,7 +76,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(
return;
}
- lg->GetMakefile()->AddCMakeOutputFile(outputFileName.c_str());
+ lg->GetMakefile()->AddCMakeOutputFile(outputFileName);
this->Files.push_back(outputFileName);
outputFiles[outputFileName] = outputContent;
@@ -114,7 +114,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
if (this->InputIsContent) {
inputContent = this->Input;
} else {
- lg->GetMakefile()->AddCMakeDependFile(this->Input.c_str());
+ lg->GetMakefile()->AddCMakeDependFile(this->Input);
cmSystemTools::GetPermissions(this->Input.c_str(), perm);
cmsys::ifstream fin(this->Input.c_str());
if (!fin) {
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 1985461..cc5d1ba 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -958,7 +958,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
if (emittedTargets.insert(name).second) {
path = "... ";
path += name;
- lg->AppendEcho(commands, path.c_str());
+ lg->AppendEcho(commands, path);
}
}
}
@@ -969,7 +969,7 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
o != localHelp.end(); ++o) {
path = "... ";
path += *o;
- lg->AppendEcho(commands, path.c_str());
+ lg->AppendEcho(commands, path);
}
lg->WriteMakeRule(ruleFileStream, "Help Target", "help", no_depends,
commands, true);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 51231fc..9d42257 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -159,9 +159,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
buildEcho += linkLanguage;
buildEcho += " executable ";
buildEcho += targetOutPath;
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink,
- &progress);
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
// Build a list of compiler flags and linker flags.
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 7f5bc11..8f7dd7e 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -337,10 +337,9 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
buildEcho += " library ";
break;
}
- buildEcho += targetOutPath.c_str();
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoLink,
- &progress);
+ buildEcho += targetOutPath;
+ this->LocalGenerator->AppendEcho(
+ commands, buildEcho, cmLocalUnixMakefileGenerator3::EchoLink, &progress);
}
const char* forbiddenFlagVar = 0;
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 6db0553..0939698 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -311,7 +311,7 @@ void cmMakefileTargetGenerator::MacOSXContentGeneratorType::operator()(
std::string copyEcho = "Copying OS X content ";
copyEcho += output;
this->Generator->LocalGenerator->AppendEcho(
- commands, copyEcho.c_str(), cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, copyEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string copyCommand = "$(CMAKE_COMMAND) -E copy ";
copyCommand += this->Generator->Convert(input, cmOutputConverter::NONE,
cmOutputConverter::SHELL);
@@ -469,7 +469,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
buildEcho += lang;
buildEcho += " object ";
buildEcho += relativeObj;
- this->LocalGenerator->AppendEcho(commands, buildEcho.c_str(),
+ this->LocalGenerator->AppendEcho(commands, buildEcho,
cmLocalUnixMakefileGenerator3::EchoBuild,
&progress);
}
@@ -676,8 +676,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
preprocessEcho += " source to ";
preprocessEcho += objI;
this->LocalGenerator->AppendEcho(
- commands, preprocessEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, preprocessEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string preprocessRuleVar = "CMAKE_";
preprocessRuleVar += lang;
@@ -724,8 +723,7 @@ void cmMakefileTargetGenerator::WriteObjectBuildFile(
assemblyEcho += " source to assembly ";
assemblyEcho += objS;
this->LocalGenerator->AppendEcho(
- commands, assemblyEcho.c_str(),
- cmLocalUnixMakefileGenerator3::EchoBuild);
+ commands, assemblyEcho, cmLocalUnixMakefileGenerator3::EchoBuild);
std::string assemblyRuleVar = "CMAKE_";
assemblyRuleVar += lang;
@@ -1073,7 +1071,7 @@ void cmMakefileTargetGenerator::GenerateCustomRuleFile(
cmLocalUnixMakefileGenerator3::EchoProgress progress;
this->MakeEchoProgress(progress);
this->LocalGenerator->AppendEcho(
- commands, comment.c_str(), cmLocalUnixMakefileGenerator3::EchoGenerate,
+ commands, comment, cmLocalUnixMakefileGenerator3::EchoGenerate,
&progress);
}
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 90022c0..3e91545 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -445,7 +445,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
name_of_def_file += ".def ";
vars["LINK_FLAGS"] += " /DEF:";
vars["LINK_FLAGS"] += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file.c_str(), cmOutputConverter::SHELL);
+ name_of_def_file, cmOutputConverter::SHELL);
}
}
@@ -572,13 +572,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string cmd = cmakeCommand;
cmd += " -E __create_def ";
cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- name_of_def_file.c_str(), cmOutputConverter::SHELL);
+ name_of_def_file, cmOutputConverter::SHELL);
cmd += " ";
cmNinjaDeps objs = this->GetObjects();
std::string obj_list_file = name_of_def_file;
obj_list_file += ".objs";
cmd += this->GetLocalGenerator()->ConvertToOutputFormat(
- obj_list_file.c_str(), cmOutputConverter::SHELL);
+ obj_list_file, cmOutputConverter::SHELL);
preLinkCmdLines.push_back(cmd);
// create a list of obj files for the -E __create_def to read
cmGeneratedFileStream fout(obj_list_file.c_str());
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 0388a95..dd19760 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -963,7 +963,7 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app);
if (!infoFile) {
std::string error = "Internal CMake error when trying to open file: ";
- error += outputFile.c_str();
+ error += outputFile;
error += " for writing.";
cmSystemTools::Error(error.c_str());
return;
diff --git a/Source/cmState.cxx b/Source/cmState.cxx
index b674b4e..09b11b2 100644
--- a/Source/cmState.cxx
+++ b/Source/cmState.cxx
@@ -965,7 +965,7 @@ void cmState::Directory::SetCurrentSource(std::string const& dir)
loc, this->DirectoryState->CurrentSourceDirectoryComponents);
this->ComputeRelativePathTopSource();
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc.c_str());
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_SOURCE_DIR", loc);
}
const char* cmState::Directory::GetCurrentBinary() const
@@ -984,7 +984,7 @@ void cmState::Directory::SetCurrentBinary(std::string const& dir)
loc, this->DirectoryState->CurrentBinaryDirectoryComponents);
this->ComputeRelativePathTopBinary();
- this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc.c_str());
+ this->Snapshot_.SetDefinition("CMAKE_CURRENT_BINARY_DIR", loc);
}
void cmState::Snapshot::SetListFile(const std::string& listfile)
@@ -1380,8 +1380,8 @@ void cmState::Snapshot::InitializeFromParent_ForSubdirsCommand()
this->SetDefinition("CMAKE_SOURCE_DIR", this->State->GetSourceDirectory());
this->SetDefinition("CMAKE_BINARY_DIR", this->State->GetBinaryDirectory());
- this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir.c_str());
- this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir.c_str());
+ this->SetDefinition("CMAKE_CURRENT_SOURCE_DIR", currentSrcDir);
+ this->SetDefinition("CMAKE_CURRENT_BINARY_DIR", currentBinDir);
}
cmState::Directory::Directory(
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index a7718d2..471028a 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -196,8 +196,7 @@ int cmcmd::ExecuteCMakeCommand(std::vector<std::string>& args)
// If error occurs we want to continue copying next files.
bool return_value = 0;
for (std::string::size_type cc = 2; cc < args.size() - 1; cc++) {
- if (!cmSystemTools::CopyADirectory(args[cc].c_str(),
- args[args.size() - 1].c_str())) {
+ if (!cmSystemTools::CopyADirectory(args[cc], args[args.size() - 1])) {
std::cerr << "Error copying directory from \"" << args[cc]
<< "\" to \"" << args[args.size() - 1] << "\".\n";
return_value = 1;