diff options
author | Regina Pfeifer <regina@mailbox.org> | 2018-12-13 18:41:05 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-01-15 16:40:25 (GMT) |
commit | 414aa6c81ec62ab2f728fab31aa189ce674484a4 (patch) | |
tree | 0b70c8ae470b1cfebd205af33754bf577c3b277d /Source | |
parent | d4a42dd4a87c9caa222a7a40150db937258698d2 (diff) | |
download | CMake-414aa6c81ec62ab2f728fab31aa189ce674484a4.zip CMake-414aa6c81ec62ab2f728fab31aa189ce674484a4.tar.gz CMake-414aa6c81ec62ab2f728fab31aa189ce674484a4.tar.bz2 |
clang-tidy: Simplify boolean expressions
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CPack/OSXScriptLauncher.cxx | 3 | ||||
-rw-r--r-- | Source/CPack/cmCPackFreeBSDGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionDAGChecker.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionNode.cxx | 2 | ||||
-rw-r--r-- | Source/cmMachO.cxx | 10 | ||||
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 6 | ||||
-rw-r--r-- | Source/cmServer.cxx | 2 | ||||
-rw-r--r-- | Source/cmSourceGroupCommand.cxx | 24 |
8 files changed, 17 insertions, 41 deletions
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx index d3de02b..4966d09 100644 --- a/Source/CPack/OSXScriptLauncher.cxx +++ b/Source/CPack/OSXScriptLauncher.cxx @@ -46,8 +46,7 @@ int main(int argc, char* argv[]) // get the file system path of the url as a cstring // in an encoding suitable for posix apis - if (CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX) == - false) { + if (!CFURLGetFileSystemRepresentation(scriptFileURL, true, path, PATH_MAX)) { DebugError("CFURLGetFileSystemRepresentation failed"); return 1; } diff --git a/Source/CPack/cmCPackFreeBSDGenerator.cxx b/Source/CPack/cmCPackFreeBSDGenerator.cxx index 2fcd1a8..1e6b118 100644 --- a/Source/CPack/cmCPackFreeBSDGenerator.cxx +++ b/Source/CPack/cmCPackFreeBSDGenerator.cxx @@ -257,13 +257,8 @@ void cmCPackFreeBSDGenerator::write_manifest_fields( static bool ignore_file(const std::string& filename) { struct stat statbuf; - - if (!((stat(filename.c_str(), &statbuf) >= 0) && - ((statbuf.st_mode & S_IFMT) == S_IFREG))) { - return true; - } - // May be other reasons to return false - return false; + return stat(filename.c_str(), &statbuf) < 0 || + (statbuf.st_mode & S_IFMT) != S_IFREG; } // Write the given list of @p files to the manifest stream @p s, diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx index 56eb2bf..5d6f301 100644 --- a/Source/cmGeneratorExpressionDAGChecker.cxx +++ b/Source/cmGeneratorExpressionDAGChecker.cxx @@ -55,7 +55,7 @@ void cmGeneratorExpressionDAGChecker::Initialize() if (CheckResult == DAG && (CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD( - TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(clang-tidy) + TEST_TRANSITIVE_PROPERTY_METHOD) false)) // NOLINT(*) #undef TEST_TRANSITIVE_PROPERTY_METHOD { std::map<cmGeneratorTarget const*, std::set<std::string>>::const_iterator diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index eb3df16..627e66d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1257,7 +1257,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode #define TRANSITIVE_PROPERTY_COMPARE(PROPERTY) \ (#PROPERTY == propertyName || "INTERFACE_" #PROPERTY == propertyName) || if (CM_FOR_EACH_TRANSITIVE_PROPERTY_NAME( - TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(clang-tidy) + TRANSITIVE_PROPERTY_COMPARE) false) { // NOLINT(*) reportError( context, content->GetOriginalExpression(), "$<TARGET_PROPERTY:...> expression in link libraries " diff --git a/Source/cmMachO.cxx b/Source/cmMachO.cxx index 7294c1c..7368812 100644 --- a/Source/cmMachO.cxx +++ b/Source/cmMachO.cxx @@ -52,10 +52,7 @@ bool peek(cmsys::ifstream& fin, T& v) template <typename T> bool read(cmsys::ifstream& fin, T& v) { - if (!fin.read(reinterpret_cast<char*>(&v), sizeof(T))) { - return false; - } - return true; + return !!fin.read(reinterpret_cast<char*>(&v), sizeof(T)); } // read from the file and fill multiple data structures where @@ -67,10 +64,7 @@ bool read(cmsys::ifstream& fin, std::vector<T>& v) if (v.empty()) { return true; } - if (!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size())) { - return false; - } - return true; + return !!fin.read(reinterpret_cast<char*>(&v[0]), sizeof(T) * v.size()); } } diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index e4d2c82..5ac080a 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1231,11 +1231,7 @@ bool cmQtAutoGenInitializer::SetupCustomTargets() } // Write AUTORCC info files - if (this->Rcc.Enabled && !this->SetupWriteRccInfo()) { - return false; - } - - return true; + return !this->Rcc.Enabled || this->SetupWriteRccInfo(); } bool cmQtAutoGenInitializer::SetupWriteAutogenInfo() diff --git a/Source/cmServer.cxx b/Source/cmServer.cxx index fe0bdc9..f7d3879 100644 --- a/Source/cmServer.cxx +++ b/Source/cmServer.cxx @@ -417,7 +417,7 @@ static void __start_thread(void* arg) auto server = static_cast<cmServerBase*>(arg); std::string error; bool success = server->Serve(&error); - if (!success || error.empty() == false) { + if (!success || !error.empty()) { std::cerr << "Error during serve: " << error << std::endl; } } diff --git a/Source/cmSourceGroupCommand.cxx b/Source/cmSourceGroupCommand.cxx index c3df313..08f4d1a 100644 --- a/Source/cmSourceGroupCommand.cxx +++ b/Source/cmSourceGroupCommand.cxx @@ -254,16 +254,12 @@ bool cmSourceGroupCommand::InitialPass(std::vector<std::string> const& args, bool cmSourceGroupCommand::checkArgumentsPreconditions( const ParsedArguments& parsedArguments, std::string& errorMsg) const { - if (!checkSingleParameterArgumentPreconditions(kPrefixOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kTreeOptionName, - parsedArguments, errorMsg) || - !checkSingleParameterArgumentPreconditions(kRegexOptionName, - parsedArguments, errorMsg)) { - return false; - } - - return true; + return checkSingleParameterArgumentPreconditions( + kPrefixOptionName, parsedArguments, errorMsg) && + checkSingleParameterArgumentPreconditions(kTreeOptionName, parsedArguments, + errorMsg) && + checkSingleParameterArgumentPreconditions(kRegexOptionName, + parsedArguments, errorMsg); } bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, @@ -286,12 +282,8 @@ bool cmSourceGroupCommand::processTree(ParsedArguments& parsedArguments, std::set<std::string> sourceGroupPaths = getSourceGroupFilesPaths(root, filesVector); - if (!addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, - *(this->Makefile), errorMsg)) { - return false; - } - - return true; + return addFilesToItsSourceGroups(root, sourceGroupPaths, prefix, + *(this->Makefile), errorMsg); } bool cmSourceGroupCommand::checkSingleParameterArgumentPreconditions( |