Commit 37859e32 authored by Sean McBride's avatar Sean McBride Committed by Brad King
Browse files

Source: Fix clang -Wimplicit-fallthrough warnings

parent 907d0988
Pipeline #248933 canceled with stages
in 34 minutes and 8 seconds
......@@ -2425,7 +2425,7 @@ bool cmCTest::SetArgsFromPreset(const std::string& presetName,
case cmCMakePresetsFile::TestPreset::OutputOptions::VerbosityEnum::
Extra:
this->Impl->ExtraVerbose = true;
// intentional fallthrough
CM_FALLTHROUGH;
case cmCMakePresetsFile::TestPreset::OutputOptions::VerbosityEnum::
Verbose:
this->Impl->Verbose = true;
......
......@@ -1185,6 +1185,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
this->CMP0060WarnItems.insert(item);
}
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_ALWAYS:
......@@ -1454,8 +1455,10 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
this->Target->GetBacktrace());
}
}
case cmPolicies::OLD:
CM_FALLTHROUGH;
case cmPolicies::OLD: // NOLINT(bugprone-branch-clone)
// OLD behavior does not warn.
break;
case cmPolicies::NEW:
// NEW behavior will not get here.
break;
......@@ -1494,6 +1497,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
this->CMakeInstance->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
this->Target->GetBacktrace());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to add the paths containing libraries with
// known full paths as link directories.
......
......@@ -359,6 +359,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
issueMessage = true;
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::NEW:
......@@ -366,6 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(int depender_index,
case cmPolicies::REQUIRED_ALWAYS:
issueMessage = true;
messageType = MessageType::FATAL_ERROR;
break;
}
if (issueMessage) {
cmake* cm = this->GlobalGenerator->GetCMakeInstance();
......
......@@ -447,6 +447,7 @@ bool cmConditionEvaluator::GetBooleanValueWithAutoDereference(
"\" appears in a conditional statement. " +
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0012);
status = MessageType::FATAL_ERROR;
break;
}
case cmPolicies::NEW:
break;
......
......@@ -626,6 +626,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
/* clang-format on */
this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to do nothing.
break;
......@@ -663,6 +664,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
/* clang-format on */
this->Makefile->IssueMessage(MessageType::AUTHOR_WARNING, w.str());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is to do nothing.
break;
......@@ -878,6 +880,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0067));
break;
case cmPolicies::NEW:
// NEW behavior is to honor the language standard variables.
// We already initialized honorStandard to true.
......
......@@ -282,6 +282,7 @@ static bool HandlePackage(std::vector<std::string> const& args,
// CMP0090 decides both the default and what variable changes it.
switch (mf.GetPolicyStatus(cmPolicies::CMP0090)) {
case cmPolicies::WARN:
CM_FALLTHROUGH;
case cmPolicies::OLD:
// Default is to export, but can be disabled.
if (mf.IsOn("CMAKE_EXPORT_NO_PACKAGE_REGISTRY")) {
......
......@@ -396,8 +396,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
CbpUnit& cbpUnit = allFiles[fullPath];
cbpUnit.Targets.push_back(target.get());
}
}
default: // intended fallthrough
} break;
default:
break;
}
}
......
......@@ -208,7 +208,7 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
case cmStateEnums::MODULE_LIBRARY: {
projectType = "Dynamic Library";
} break;
default: // intended fallthrough
default:
break;
}
......@@ -233,8 +233,8 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
otherFiles.insert(fullPath);
}
}
}
default: // intended fallthrough
} break;
default:
break;
}
return projectType;
......@@ -556,7 +556,8 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
visualname = "lib" + targetName;
default: // intended fallthrough
break;
default:
break;
}
xml.Attribute("Name", visualname);
......
......@@ -640,8 +640,9 @@ bool HandleGlobImpl(std::vector<std::string> const& args, bool recurse,
case cmPolicies::NEW:
g.RecurseThroughSymlinksOff();
break;
case cmPolicies::OLD:
case cmPolicies::WARN:
CM_FALLTHROUGH;
case cmPolicies::OLD:
g.RecurseThroughSymlinksOn();
break;
}
......
......@@ -1137,6 +1137,7 @@ bool cmGeneratorTarget::IsInBuildSystem() const
if (!this->SourceEntries.empty()) {
return true;
}
break;
case cmStateEnums::UNKNOWN_LIBRARY:
break;
}
......@@ -2558,6 +2559,7 @@ public:
} break;
case cmPolicies::OLD:
noMessage = true;
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
......@@ -3267,6 +3269,7 @@ void cmGeneratorTarget::AddExplicitLanguageFlags(std::string& flags,
switch (this->GetPolicyStatusCMP0119()) {
case cmPolicies::WARN:
CM_FALLTHROUGH;
case cmPolicies::OLD:
// The OLD behavior is to not add explicit language flags.
return;
......@@ -3565,6 +3568,7 @@ void processIncludeDirectories(cmGeneratorTarget const* tgt,
} break;
case cmPolicies::OLD:
noMessage = true;
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
......@@ -7433,6 +7437,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
cm->IssueMessage(MessageType::AUTHOR_WARNING, w.str(),
this->GetBacktrace());
}
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::NEW: {
......@@ -7670,6 +7675,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
} break;
case cmPolicies::OLD:
noMessage = true;
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
case cmPolicies::NEW:
......
......@@ -62,6 +62,7 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
case cmPolicies::WARN:
issueMessage = true;
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0045) << "\n";
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_IF_USED:
......@@ -69,6 +70,7 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args,
case cmPolicies::NEW:
issueMessage = true;
messageType = MessageType::FATAL_ERROR;
break;
}
if (issueMessage) {
e << "get_target_property() called with non-existent target \""
......
......@@ -965,6 +965,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
mf->IssueMessage(
MessageType::FATAL_ERROR,
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0025));
break;
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
break;
......@@ -1031,6 +1032,7 @@ void cmGlobalGenerator::CheckCompilerIdCompatibility(
mf->IssueMessage(
MessageType::FATAL_ERROR,
cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0089));
break;
case cmPolicies::NEW:
// NEW behavior is to keep AppleClang.
break;
......
......@@ -1263,7 +1263,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
break;
}
}
// FALLTHROUGH
CM_FALLTHROUGH;
case cmStateEnums::EXECUTABLE: {
outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath(
config, cmStateEnums::RuntimeBinaryArtifact, realname)));
......@@ -1275,7 +1275,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
break;
}
}
// FALLTHROUGH
CM_FALLTHROUGH;
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UTILITY: {
......
......@@ -120,6 +120,7 @@ bool cmIncludeCommand(std::vector<std::string> const& args,
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0024) << "\n";
modal = "should";
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_IF_USED:
......
......@@ -1391,6 +1391,7 @@ bool HandleFilesMode(std::vector<std::string> const& args,
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0062) << "\n";
modal = "should";
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_IF_USED:
......@@ -1398,6 +1399,7 @@ bool HandleFilesMode(std::vector<std::string> const& args,
case cmPolicies::NEW:
modal = "may";
messageType = MessageType::FATAL_ERROR;
break;
}
if (modal) {
e << "The file\n " << file
......
......@@ -57,6 +57,7 @@ void cmInstallSubdirectoryGenerator::GenerateScript(std::ostream& os)
this->LocalGenerator->GetPolicyStatus(cmPolicies::CMP0082);
switch (status) {
case cmPolicies::WARN:
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior is handled in cmLocalGenerator::GenerateInstallRules()
break;
......
......@@ -62,7 +62,7 @@ static void AddLinkDir(cmMakefile& mf, std::string const& dir,
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0015);
mf.IssueMessage(MessageType::AUTHOR_WARNING, e.str());
break;
CM_FALLTHROUGH;
case cmPolicies::OLD:
// OLD behavior does not convert
break;
......
......@@ -46,7 +46,7 @@ bool GetIndexArg(const std::string& arg, int* idx, cmMakefile& mf)
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0121),
" Invalid list index \"", arg, "\".");
mf.IssueMessage(MessageType::AUTHOR_WARNING, warn);
break;
CM_FALLTHROUGH;
}
case cmPolicies::OLD:
// OLD behavior is to allow compatibility, so just ignore the
......
......@@ -3780,8 +3780,9 @@ bool cmLocalGenerator::NeedBackwardsCompatibility_2_4()
// variable.
switch (this->GetPolicyStatus(cmPolicies::CMP0001)) {
case cmPolicies::WARN:
// WARN is just OLD without warning because user code does not
// always affect whether this check is done.
// WARN is just OLD without warning because user code does not
// always affect whether this check is done.
CM_FALLTHROUGH;
case cmPolicies::OLD:
// Old behavior is to check the variable.
break;
......
......@@ -796,8 +796,9 @@ cmLocalNinjaGenerator::MakeCustomCommandGenerators(
bool transformDepfile = false;
switch (cc.GetCMP0116Status()) {
case cmPolicies::OLD:
case cmPolicies::WARN:
CM_FALLTHROUGH;
case cmPolicies::OLD:
break;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment