mirror of
https://github.com/reactos/CMake.git
synced 2025-01-20 02:12:35 +00:00
clang-tidy: Simplify boolean expressions
This commit is contained in:
parent
d4a42dd4a8
commit
414aa6c81e
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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 "
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user