summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/CPack/IFW/cmCPackIFWRepository.cxx14
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackDebGenerator.cxx6
-rw-r--r--Source/CPack/cmCPackRPMGenerator.cxx6
-rw-r--r--Source/CPack/cpack.cxx6
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx16
-rw-r--r--Source/CTest/cmCTestLaunch.cxx8
-rw-r--r--Source/CTest/cmCTestMemCheckHandler.cxx15
-rw-r--r--Source/CTest/cmCTestSubmitHandler.cxx9
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx2
-rw-r--r--Source/CTest/cmParsePHPCoverage.cxx5
-rw-r--r--Source/CursesDialog/cmCursesBoolWidget.cxx6
-rw-r--r--Source/cmCacheManager.cxx2
-rw-r--r--Source/cmComputeLinkInformation.cxx3
-rw-r--r--Source/cmCustomCommand.cxx2
-rw-r--r--Source/cmDependsC.cxx6
-rw-r--r--Source/cmDependsFortran.cxx5
-rw-r--r--Source/cmELF.cxx6
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx8
-rw-r--r--Source/cmExtraCodeLiteGenerator.cxx2
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx2
-rw-r--r--Source/cmGeneratedFileStream.cxx4
-rw-r--r--Source/cmGeneratorTarget.cxx6
-rw-r--r--Source/cmGlobalGenerator.cxx3
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
-rw-r--r--Source/cmGraphVizWriter.cxx14
-rw-r--r--Source/cmListFileCache.cxx5
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx2
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx3
-rw-r--r--Source/cmNinjaTargetGenerator.cxx3
-rw-r--r--Source/cmPropertyDefinitionMap.cxx7
-rw-r--r--Source/cmQtAutoGenerators.cxx11
-rw-r--r--Source/cmSourceFileLocation.cxx5
-rw-r--r--Source/cmSourceGroup.cxx6
-rw-r--r--Source/cmSystemTools.cxx7
-rw-r--r--Source/cmcmd.cxx8
37 files changed, 73 insertions, 169 deletions
diff --git a/Source/CPack/IFW/cmCPackIFWRepository.cxx b/Source/CPack/IFW/cmCPackIFWRepository.cxx
index b149f81..1838005 100644
--- a/Source/CPack/IFW/cmCPackIFWRepository.cxx
+++ b/Source/CPack/IFW/cmCPackIFWRepository.cxx
@@ -45,16 +45,16 @@ bool cmCPackIFWRepository::IsValid() const
switch (Update) {
case None:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Add:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Remove:
- valid = Url.empty() ? false : true;
+ valid = !Url.empty();
break;
case Replace:
- valid = (OldUrl.empty() || NewUrl.empty()) ? false : true;
+ valid = !OldUrl.empty() && !NewUrl.empty();
break;
}
@@ -244,11 +244,7 @@ bool cmCPackIFWRepository::PatchUpdatesXml()
fout.Close();
- if (!cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data())) {
- return false;
- }
-
- return true;
+ return cmSystemTools::RenameFile(updatesPatchXml.data(), updatesXml.data());
}
void cmCPackIFWRepository::WriteRepositoryConfig(cmXMLWriter& xout)
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 7db20a4..baf6719 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -269,9 +269,5 @@ bool cmCPackArchiveGenerator::SupportsComponentInstallation() const
// The Component installation support should only
// be activated if explicitly requested by the user
// (for backward compatibility reason)
- if (IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_ARCHIVE_COMPONENT_INSTALL");
}
diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx
index 1ad4152..ddaa483 100644
--- a/Source/CPack/cmCPackDebGenerator.cxx
+++ b/Source/CPack/cmCPackDebGenerator.cxx
@@ -675,11 +675,7 @@ int cmCPackDebGenerator::createDeb()
bool cmCPackDebGenerator::SupportsComponentInstallation() const
{
- if (IsOn("CPACK_DEB_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_DEB_COMPONENT_INSTALL");
}
std::string cmCPackDebGenerator::GetComponentInstallDirNameSuffix(
diff --git a/Source/CPack/cmCPackRPMGenerator.cxx b/Source/CPack/cmCPackRPMGenerator.cxx
index 9827b70..bc10111 100644
--- a/Source/CPack/cmCPackRPMGenerator.cxx
+++ b/Source/CPack/cmCPackRPMGenerator.cxx
@@ -228,11 +228,7 @@ int cmCPackRPMGenerator::PackageFiles()
bool cmCPackRPMGenerator::SupportsComponentInstallation() const
{
- if (IsOn("CPACK_RPM_COMPONENT_INSTALL")) {
- return true;
- } else {
- return false;
- }
+ return IsOn("CPACK_RPM_COMPONENT_INSTALL");
}
std::string cmCPackRPMGenerator::GetComponentInstallDirNameSuffix(
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index 94e1615..425afd9 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -209,11 +209,7 @@ int main(int argc, char const* const* argv)
* should launch cpack using "cpackConfigFile" if it exists
* in the current directory.
*/
- if ((doc.CheckOptions(argc, argv, "-G")) && !(argc == 1)) {
- help = true;
- } else {
- help = false;
- }
+ help = doc.CheckOptions(argc, argv, "-G") && argc != 1;
// This part is used for cpack documentation lookup as well.
cminst.AddCMakePaths();
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index daefb59..ba9e546 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -90,11 +90,8 @@ public:
cmsysProcess_Execute(this->Process);
this->PipeState = cmsysProcess_GetState(this->Process);
// if the process is running or exited return true
- if (this->PipeState == cmsysProcess_State_Executing ||
- this->PipeState == cmsysProcess_State_Exited) {
- return true;
- }
- return false;
+ return this->PipeState == cmsysProcess_State_Executing ||
+ this->PipeState == cmsysProcess_State_Exited;
}
void SetStdoutFile(const char* fname)
{
@@ -705,13 +702,8 @@ bool IsFileInDir(const std::string& infile, const std::string& indir)
std::string file = cmSystemTools::CollapseFullPath(infile);
std::string dir = cmSystemTools::CollapseFullPath(indir);
- if (file.size() > dir.size() &&
- (fnc(file.substr(0, dir.size())) == fnc(dir)) &&
- file[dir.size()] == '/') {
- return true;
- }
-
- return false;
+ return file.size() > dir.size() &&
+ fnc(file.substr(0, dir.size())) == fnc(dir) && file[dir.size()] == '/';
}
int cmCTestCoverageHandler::HandlePHPCoverage(
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index 4a408a2..99fa9e7 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -594,12 +594,8 @@ bool cmCTestLaunch::Match(std::string const& line,
bool cmCTestLaunch::MatchesFilterPrefix(std::string const& line) const
{
- if (!this->OptionFilterPrefix.empty() &&
- cmSystemTools::StringStartsWith(line.c_str(),
- this->OptionFilterPrefix.c_str())) {
- return true;
- }
- return false;
+ return !this->OptionFilterPrefix.empty() &&
+ cmSystemTools::StringStartsWith(line, this->OptionFilterPrefix.c_str());
}
int cmCTestLaunch::Main(int argc, const char* const argv[])
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index 5ae98af..f8ffd43 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -722,10 +722,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
ostr << *i << std::endl;
}
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
const std::string& str, std::string& log, std::vector<int>& results)
@@ -766,10 +763,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
}
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
@@ -904,10 +898,7 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
<< (cmSystemTools::GetTime() - sttime) << std::endl,
this->Quiet);
log = ostr.str();
- if (defects) {
- return false;
- }
- return true;
+ return defects == 0;
}
bool cmCTestMemCheckHandler::ProcessMemCheckBoundsCheckerOutput(
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index f373348..32975df 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -845,10 +845,7 @@ bool cmCTestSubmitHandler::SubmitUsingSCP(const std::string& scp_command,
}
}
cmsysProcess_Delete(cp);
- if (problems) {
- return false;
- }
- return true;
+ return problems == 0;
}
bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
@@ -870,7 +867,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
cmCTest::SetOfStrings::const_iterator file;
- bool problems = false;
for (file = files.begin(); file != files.end(); ++file) {
std::string lfname = localprefix;
cmSystemTools::ConvertToUnixSlashes(lfname);
@@ -883,9 +879,6 @@ bool cmCTestSubmitHandler::SubmitUsingCP(const std::string& localprefix,
}
std::string tagDoneFile = destination + "/" + remoteprefix + "DONE";
cmSystemTools::Touch(tagDoneFile, true);
- if (problems) {
- return false;
- }
return true;
}
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index 20ef693..55a6518 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -1406,7 +1406,7 @@ void cmCTestTestHandler::UseIncludeRegExp()
void cmCTestTestHandler::UseExcludeRegExp()
{
this->UseExcludeRegExpFlag = true;
- this->UseExcludeRegExpFirst = this->UseIncludeRegExpFlag ? false : true;
+ this->UseExcludeRegExpFirst = !this->UseIncludeRegExpFlag;
}
const char* cmCTestTestHandler::GetTestStatus(int status)
diff --git a/Source/CTest/cmParsePHPCoverage.cxx b/Source/CTest/cmParsePHPCoverage.cxx
index eb0d962..5ec2718 100644
--- a/Source/CTest/cmParsePHPCoverage.cxx
+++ b/Source/CTest/cmParsePHPCoverage.cxx
@@ -27,10 +27,7 @@ bool cmParsePHPCoverage::ReadUntil(std::istream& in, char until)
char c = 0;
while (in.get(c) && c != until) {
}
- if (c != until) {
- return false;
- }
- return true;
+ return c == until;
}
bool cmParsePHPCoverage::ReadCoverageArray(std::istream& in,
std::string const& fileName)
diff --git a/Source/CursesDialog/cmCursesBoolWidget.cxx b/Source/CursesDialog/cmCursesBoolWidget.cxx
index 0055e88..9bcf050 100644
--- a/Source/CursesDialog/cmCursesBoolWidget.cxx
+++ b/Source/CursesDialog/cmCursesBoolWidget.cxx
@@ -54,9 +54,5 @@ void cmCursesBoolWidget::SetValueAsBool(bool value)
bool cmCursesBoolWidget::GetValueAsBool()
{
- if (this->Value == "ON") {
- return true;
- } else {
- return false;
- }
+ return this->Value == "ON";
}
diff --git a/Source/cmCacheManager.cxx b/Source/cmCacheManager.cxx
index d143193..676e84a 100644
--- a/Source/cmCacheManager.cxx
+++ b/Source/cmCacheManager.cxx
@@ -642,5 +642,5 @@ void cmCacheManager::CacheIterator::SetProperty(const std::string& p, bool v)
bool cmCacheManager::CacheIterator::PropertyExists(
const std::string& prop) const
{
- return this->GetProperty(prop) ? true : false;
+ return this->GetProperty(prop) != NULL;
}
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index e1a7bee..1eefbb1 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -274,8 +274,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Check whether we should use an import library for linking a target.
this->UseImportLibrary =
- this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX") ? true
- : false;
+ this->Makefile->IsDefinitionSet("CMAKE_IMPORT_LIBRARY_SUFFIX");
// Check whether we should skip dependencies on shared library files.
this->LinkDependsNoShared =
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index 7c00c80..4c5bd03 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -38,7 +38,7 @@ cmCustomCommand::cmCustomCommand(cmMakefile const* mf,
, Backtrace()
, Comment(comment ? comment : "")
, WorkingDirectory(workingDirectory ? workingDirectory : "")
- , HaveComment(comment ? true : false)
+ , HaveComment(comment != NULL)
, EscapeAllowMakeVars(false)
, EscapeOldStyle(true)
{
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 78bb1b2..5be527c 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -278,21 +278,21 @@ void cmDependsC::ReadCacheFile()
continue;
}
// the first line after an empty line is the name of the parsed file
- if (haveFileName == false) {
+ if (!haveFileName) {
haveFileName = true;
int newer = 0;
cmFileTimeComparison comp;
bool res = comp.FileTimeCompare(this->CacheFileName.c_str(),
line.c_str(), &newer);
- if ((res == true) && (newer == 1)) // cache is newer than the parsed file
+ if (res && newer == 1) // cache is newer than the parsed file
{
cacheEntry = new cmIncludeLines;
this->FileCache[line] = cacheEntry;
}
// file doesn't exist, check that the regular expressions
// haven't changed
- else if (res == false) {
+ else if (!res) {
if (line.find(INCLUDE_REGEX_LINE_MARKER) == 0) {
if (line != this->IncludeRegexLineString) {
return;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 38e319d..a20fb98 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -654,10 +654,9 @@ bool cmDependsFortran::ModulesDiffer(const char* modFile,
// but also do not include a date so we can fall through to
// compare them without skipping any prefix.
unsigned char hdr[2];
- bool okay =
- finModFile.read(reinterpret_cast<char*>(hdr), 2) ? true : false;
+ bool okay = !finModFile.read(reinterpret_cast<char*>(hdr), 2).fail();
finModFile.seekg(0);
- if (!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b)) {
+ if (!okay || hdr[0] != 0x1f || hdr[1] != 0x8b) {
const char seq[1] = { '\n' };
const int seqlen = 1;
diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx
index 26f1a44..c7f8a2d 100644
--- a/Source/cmELF.cxx
+++ b/Source/cmELF.cxx
@@ -143,7 +143,7 @@ public:
{
this->Stream.seekg(pos);
this->Stream.read(buf, size);
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
// Lookup the SONAME in the DYNAMIC section.
@@ -497,7 +497,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
bool Read(ELF_Dyn& x)
{
@@ -505,7 +505,7 @@ private:
this->NeedSwap) {
ByteSwap(x);
}
- return this->Stream ? true : false;
+ return !this->Stream.fail();
}
bool LoadSectionHeader(ELF_Half i)
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 2070b1f..40cff78 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -655,11 +655,11 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
// projects with C/C++ and Fortran are handled as C/C++ projects
bool pureFortran = false;
std::string compilerIdVar;
- if (this->GlobalGenerator->GetLanguageEnabled("CXX") == true) {
+ if (this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_CXX_COMPILER_ID";
- } else if (this->GlobalGenerator->GetLanguageEnabled("C") == true) {
+ } else if (this->GlobalGenerator->GetLanguageEnabled("C")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
- } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran") == true) {
+ } else if (this->GlobalGenerator->GetLanguageEnabled("Fortran")) {
compilerIdVar = "CMAKE_Fortran_COMPILER_ID";
pureFortran = true;
}
@@ -667,7 +667,7 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(const cmMakefile* mf)
std::string compilerId = mf->GetSafeDefinition(compilerIdVar);
std::string compiler = "gcc"; // default to gcc
if (compilerId == "MSVC") {
- if (mf->IsDefinitionSet("MSVC10") == true) {
+ if (mf->IsDefinitionSet("MSVC10")) {
compiler = "msvc10";
} else {
compiler = "msvc8";
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index ba58767..dd10b65 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -407,7 +407,7 @@ std::string cmExtraCodeLiteGenerator::GetCodeLiteCompilerName(
// figure out which language to use
// for now care only for C and C++
std::string compilerIdVar = "CMAKE_CXX_COMPILER_ID";
- if (this->GlobalGenerator->GetLanguageEnabled("CXX") == false) {
+ if (!this->GlobalGenerator->GetLanguageEnabled("CXX")) {
compilerIdVar = "CMAKE_C_COMPILER_ID";
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index f24e7fb..bc217af 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -129,7 +129,7 @@ void cmExtraEclipseCDT4Generator::Generate()
(this->IsOutOfSourceBuild &&
mf->IsOn("CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT"));
- if ((this->GenerateSourceProject == false) &&
+ if (!this->GenerateSourceProject &&
(mf->IsOn("ECLIPSE_CDT4_GENERATE_SOURCE_PROJECT"))) {
mf->IssueMessage(
cmake::WARNING,
diff --git a/Source/cmGeneratedFileStream.cxx b/Source/cmGeneratedFileStream.cxx
index 2c05913..dee174b 100644
--- a/Source/cmGeneratedFileStream.cxx
+++ b/Source/cmGeneratedFileStream.cxx
@@ -42,7 +42,7 @@ cmGeneratedFileStream::~cmGeneratedFileStream()
// stream will be destroyed which will close the temporary file.
// Finally the base destructor will be called to replace the
// destination file.
- this->Okay = (*this) ? true : false;
+ this->Okay = !this->fail();
}
cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
@@ -71,7 +71,7 @@ cmGeneratedFileStream& cmGeneratedFileStream::Open(const char* name,
bool cmGeneratedFileStream::Close()
{
// Save whether the temporary output file is valid before closing.
- this->Okay = (*this) ? true : false;
+ this->Okay = !this->fail();
// Close the temporary output file.
this->Stream::close();
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3856091..1607dd9 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1306,11 +1306,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
this->GetName());
}
- if (cmp0042 == cmPolicies::NEW) {
- return true;
- }
-
- return false;
+ return cmp0042 == cmPolicies::NEW;
}
std::string cmGeneratorTarget::GetSOName(const std::string& config) const
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a1764a3..fc34b8b 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -180,8 +180,7 @@ void cmGlobalGenerator::ResolveLanguageCompiler(const std::string& lang,
} else {
path = name;
}
- if ((path.empty() || !cmSystemTools::FileExists(path.c_str())) &&
- (optional == false)) {
+ if (!optional && (path.empty() || !cmSystemTools::FileExists(path))) {
return;
}
const char* cname =
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 143ad92..3abcba3 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1227,9 +1227,9 @@ std::string cmGlobalNinjaGenerator::ninjaCmd() const
bool cmGlobalNinjaGenerator::SupportsConsolePool() const
{
- return cmSystemTools::VersionCompare(
- cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
- RequiredNinjaVersionForConsolePool().c_str()) == false;
+ return !cmSystemTools::VersionCompare(
+ cmSystemTools::OP_LESS, this->NinjaVersion.c_str(),
+ RequiredNinjaVersionForConsolePool().c_str());
}
void cmGlobalNinjaGenerator::WriteTargetClean(std::ostream& os)
diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx
index 20cd171..6b3a870 100644
--- a/Source/cmGraphVizWriter.cxx
+++ b/Source/cmGraphVizWriter.cxx
@@ -140,7 +140,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
// which other targets depend on it.
void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
{
- if (this->GenerateDependers == false) {
+ if (!this->GenerateDependers) {
return;
}
@@ -153,7 +153,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -184,7 +184,7 @@ void cmGraphVizWriter::WriteTargetDependersFiles(const char* fileName)
// on which targets it depends.
void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
{
- if (this->GeneratePerTarget == false) {
+ if (!this->GeneratePerTarget) {
return;
}
@@ -197,7 +197,7 @@ void cmGraphVizWriter::WritePerTargetFiles(const char* fileName)
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -243,7 +243,7 @@ void cmGraphVizWriter::WriteGlobalFile(const char* fileName)
continue;
}
- if (this->GenerateForTargetType(ptrIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(ptrIt->second->GetType())) {
continue;
}
@@ -344,7 +344,7 @@ void cmGraphVizWriter::WriteDependerConnections(
continue;
}
- if (this->GenerateForTargetType(dependerIt->second->GetType()) == false) {
+ if (!this->GenerateForTargetType(dependerIt->second->GetType())) {
continue;
}
@@ -403,7 +403,7 @@ void cmGraphVizWriter::WriteNode(const std::string& targetName,
void cmGraphVizWriter::CollectTargetsAndLibs()
{
- if (this->HaveTargetsAndLibs == false) {
+ if (!this->HaveTargetsAndLibs) {
this->HaveTargetsAndLibs = true;
int cnt = this->CollectAllTargets();
if (this->GenerateForExternals) {
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index f47e9b6..33731e0 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -202,10 +202,7 @@ bool cmListFile::ParseFile(const char* filename, bool topLevel, cmMakefile* mf)
this->Functions.insert(this->Functions.begin(), project);
}
}
- if (parseError) {
- return false;
- }
- return true;
+ return !parseError;
}
bool cmListFileParser::ParseFunction(const char* name, long line)
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index f60a595..4b5af8b 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1322,7 +1322,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies(const char* tgtInfo,
// not be considered.
std::map<std::string, cmDepends::DependencyVector> validDependencies;
bool needRescanDependencies = false;
- if (needRescanDirInfo == false) {
+ if (!needRescanDirInfo) {
cmDependsC checker;
checker.SetVerbose(verbose);
checker.SetFileComparison(ftc);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e684689..45fb7cf 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2124,20 +2124,11 @@ bool cmMakefile::CanIWriteThisFile(const char* fileName) const
// If we are doing an in-source build, then the test will always fail
if (cmSystemTools::SameFile(this->GetHomeDirectory(),
this->GetHomeOutputDirectory())) {
- if (this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD")) {
- return false;
- }
- return true;
+ return !this->IsOn("CMAKE_DISABLE_IN_SOURCE_BUILD");
}
- // Check if this is a subdirectory of the source tree but not a
- // subdirectory of the build tree
- if (cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) &&
- !cmSystemTools::IsSubDirectory(fileName,
- this->GetHomeOutputDirectory())) {
- return false;
- }
- return true;
+ return !cmSystemTools::IsSubDirectory(fileName, this->GetHomeDirectory()) ||
+ cmSystemTools::IsSubDirectory(fileName, this->GetHomeOutputDirectory());
}
const char* cmMakefile::GetRequiredDefinition(const std::string& name) const
@@ -2166,7 +2157,7 @@ bool cmMakefile::IsDefinitionSet(const std::string& name) const
}
}
#endif
- return def ? true : false;
+ return def != NULL;
}
const char* cmMakefile::GetDefinition(const std::string& name) const
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 8f7dd7e..128291d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -454,8 +454,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if (this->GeneratorTarget->GetType() == cmState::STATIC_LIBRARY) {
- haveStaticLibraryRule =
- this->Makefile->GetDefinition(linkRuleVar) ? true : false;
+ haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar);
std::string arCreateVar = "CMAKE_";
arCreateVar += linkLanguage;
arCreateVar += "_ARCHIVE_CREATE";
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 1aa2ddb..b0f0d9b 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -130,8 +130,7 @@ void cmNinjaTargetGenerator::AddIncludeFlags(std::string& languageFlags,
// Add include directory flags.
std::string includeFlags = this->LocalGenerator->GetIncludeFlags(
includes, this->GeneratorTarget, language,
- language == "RC" ? true : false, // full include paths for RC
- // needed by cmcldeps
+ language == "RC", // full include paths for RC needed by cmcldeps
false, this->GetConfigName());
if (this->GetGlobalGenerator()->IsGCCOnWindows())
std::replace(includeFlags.begin(), includeFlags.end(), '\\', '/');
diff --git a/Source/cmPropertyDefinitionMap.cxx b/Source/cmPropertyDefinitionMap.cxx
index ebc2caa..0ba35e7 100644
--- a/Source/cmPropertyDefinitionMap.cxx
+++ b/Source/cmPropertyDefinitionMap.cxx
@@ -31,12 +31,7 @@ void cmPropertyDefinitionMap::DefineProperty(const std::string& name,
bool cmPropertyDefinitionMap::IsPropertyDefined(const std::string& name) const
{
- cmPropertyDefinitionMap::const_iterator it = this->find(name);
- if (it == this->end()) {
- return false;
- }
-
- return true;
+ return this->find(name) != this->end();
}
bool cmPropertyDefinitionMap::IsPropertyChained(const std::string& name) const
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index ac64397..dc44f3e 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -636,14 +636,14 @@ void cmQtAutoGenerators::ParseCppFile(
}
} else {
std::string fileToMoc = absFilename;
- if ((basename != scannedFileBasename) || (requiresMoc == false)) {
+ if (!requiresMoc || basename != scannedFileBasename) {
std::string mocSubDir = extractSubDir(absPath, currentMoc);
std::string headerToMoc =
findMatchingHeader(absPath, mocSubDir, basename, headerExtensions);
if (!headerToMoc.empty()) {
// this is for KDE4 compatibility:
fileToMoc = headerToMoc;
- if ((requiresMoc == false) && (basename == scannedFileBasename)) {
+ if (!requiresMoc && basename == scannedFileBasename) {
std::stringstream err;
err << "AUTOGEN: warning: " << absFilename
<< ": The file "
@@ -696,8 +696,8 @@ void cmQtAutoGenerators::ParseCppFile(
// If this is the case, the moc_foo.cpp should probably be generated from
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
- if ((dotMocIncluded == false) && (requiresMoc == true)) {
- if (mocUnderscoreIncluded == true) {
+ if (!dotMocIncluded && requiresMoc) {
+ if (mocUnderscoreIncluded) {
// this is for KDE4 compatibility:
std::stringstream err;
err << "AUTOGEN: warning: " << absFilename << ": The file "
@@ -833,8 +833,7 @@ void cmQtAutoGenerators::StrictParseCppFile(
// foo.cpp instead of foo.h, because otherwise it won't build.
// But warn, since this is not how it is supposed to be used.
std::string macroName;
- if ((dotMocIncluded == false) &&
- (requiresMocing(contentsString, macroName))) {
+ if (!dotMocIncluded && requiresMocing(contentsString, macroName)) {
// otherwise always error out since it will not compile:
std::stringstream err;
err << "AUTOGEN: error: " << absFilename << ": The file "
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 3219f36..a89d1e8 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -177,10 +177,7 @@ bool cmSourceFileLocation::MatchesAmbiguousExtension(
}
std::vector<std::string> hdrExts =
mf->GetCMakeInstance()->GetHeaderExtensions();
- if (std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end()) {
- return true;
- }
- return false;
+ return std::find(hdrExts.begin(), hdrExts.end(), ext) != hdrExts.end();
}
bool cmSourceFileLocation::Matches(cmSourceFileLocation const& loc)
diff --git a/Source/cmSourceGroup.cxx b/Source/cmSourceGroup.cxx
index 394b33a..f27b572 100644
--- a/Source/cmSourceGroup.cxx
+++ b/Source/cmSourceGroup.cxx
@@ -86,11 +86,7 @@ bool cmSourceGroup::MatchesRegex(const char* name)
bool cmSourceGroup::MatchesFiles(const char* name)
{
- std::set<std::string>::const_iterator i = this->GroupFiles.find(name);
- if (i != this->GroupFiles.end()) {
- return true;
- }
- return false;
+ return this->GroupFiles.find(name) != this->GroupFiles.end();
}
void cmSourceGroup::AssignSource(const cmSourceFile* sf)
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 7dece47..7156948 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2108,11 +2108,8 @@ bool cmSystemTools::GuessLibrarySOName(std::string const& fullPath,
// If the symlink points at an extended version of the same name
// assume it is the soname.
std::string name = cmSystemTools::GetFilenameName(fullPath);
- if (soname.length() > name.length() &&
- soname.substr(0, name.length()) == name) {
- return true;
- }
- return false;
+ return soname.length() > name.length() &&
+ soname.compare(0, name.length(), name) == 0;
}
bool cmSystemTools::GuessLibraryInstallName(std::string const& fullPath,
diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx
index 471028a..535dead 100644
--- a/Source/cmcmd.cxx
+++ b/Source/cmcmd.cxx
@@ -1027,11 +1027,7 @@ int cmcmd::ExecuteEchoColor(std::vector<std::string>& args)
// Enable or disable color based on the switch value.
std::string value = args[i].substr(9);
if (!value.empty()) {
- if (cmSystemTools::IsOn(value.c_str())) {
- enabled = true;
- } else {
- enabled = false;
- }
+ enabled = cmSystemTools::IsOn(value.c_str());
}
} else if (cmHasLiteralPrefix(args[i], "--progress-dir=")) {
progressDir = args[i].substr(15);
@@ -1226,7 +1222,7 @@ int cmcmd::VisualStudioLink(std::vector<std::string>& args, int type)
if (args.size() < 2) {
return -1;
}
- bool verbose = cmSystemTools::GetEnv("VERBOSE") ? true : false;
+ bool verbose = cmSystemTools::GetEnv("VERBOSE") != NULL;
std::vector<std::string> expandedArgs;
for (std::vector<std::string>::iterator i = args.begin(); i != args.end();
++i) {