summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRegina Pfeifer <regina@mailbox.org>2018-12-13 19:41:05 +0100
committerBrad King <brad.king@kitware.com>2019-01-15 11:40:25 -0500
commit414aa6c81ec62ab2f728fab31aa189ce674484a4 (patch)
tree0b70c8ae470b1cfebd205af33754bf577c3b277d
parentd4a42dd4a87c9caa222a7a40150db937258698d2 (diff)
downloadcmake-414aa6c81ec62ab2f728fab31aa189ce674484a4.tar.gz
clang-tidy: Simplify boolean expressions
-rw-r--r--.clang-tidy1
-rw-r--r--Source/CPack/OSXScriptLauncher.cxx3
-rw-r--r--Source/CPack/cmCPackFreeBSDGenerator.cxx9
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmMachO.cxx10
-rw-r--r--Source/cmQtAutoGenInitializer.cxx6
-rw-r--r--Source/cmServer.cxx2
-rw-r--r--Source/cmSourceGroupCommand.cxx24
9 files changed, 17 insertions, 42 deletions
diff --git a/.clang-tidy b/.clang-tidy
index dc6071474b..3ae249fabf 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -32,7 +32,6 @@ readability-*,\
-readability-inconsistent-declaration-parameter-name,\
-readability-named-parameter,\
-readability-redundant-declaration,\
--readability-simplify-boolean-expr,\
"
HeaderFilterRegex: 'Source/cm[^/]*\.(h|hxx|cxx)$'
CheckOptions:
diff --git a/Source/CPack/OSXScriptLauncher.cxx b/Source/CPack/OSXScriptLauncher.cxx
index d3de02b478..4966d09f26 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 2fcd1a8ec1..1e6b1184c7 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 56eb2bfa48..5d6f301c61 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 eb3df16b47..627e66d13d 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 7294c1cbfd..7368812ec0 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 e4d2c8215d..5ac080ad6c 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 fe0bdc9c2a..f7d38799fa 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 c3df313e18..08f4d1ab07 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(