Browse Source

Merge topic 'clang-warnings'

37859e3244 Source: Fix clang -Wimplicit-fallthrough warnings
907d098838 Source: Fix clang -Wextra-semi warnings

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !6561
Brad King 4 years ago
parent
commit
5bd94332c7
40 changed files with 97 additions and 44 deletions
  1. 1 1
      Source/cmCTest.cxx
  2. 1 1
      Source/cmCommand.h
  3. 5 1
      Source/cmComputeLinkInformation.cxx
  4. 2 0
      Source/cmComputeTargetDepends.cxx
  5. 2 1
      Source/cmConditionEvaluator.cxx
  6. 3 0
      Source/cmCoreTryCompile.cxx
  7. 1 0
      Source/cmExportCommand.cxx
  8. 2 2
      Source/cmExtraCodeBlocksGenerator.cxx
  9. 5 4
      Source/cmExtraCodeLiteGenerator.cxx
  10. 2 1
      Source/cmFileCommand.cxx
  11. 2 2
      Source/cmFindLibraryCommand.cxx
  12. 6 0
      Source/cmGeneratorTarget.cxx
  13. 1 1
      Source/cmGeneratorTarget.h
  14. 2 0
      Source/cmGetTargetPropertyCommand.cxx
  15. 2 0
      Source/cmGlobalGenerator.cxx
  16. 2 2
      Source/cmGlobalNinjaGenerator.cxx
  17. 1 0
      Source/cmIncludeCommand.cxx
  18. 2 0
      Source/cmInstallCommand.cxx
  19. 1 0
      Source/cmInstallSubdirectoryGenerator.cxx
  20. 1 1
      Source/cmLinkDirectoriesCommand.cxx
  21. 1 1
      Source/cmListCommand.cxx
  22. 3 2
      Source/cmLocalGenerator.cxx
  23. 2 1
      Source/cmLocalNinjaGenerator.cxx
  24. 1 1
      Source/cmLocalUnixMakefileGenerator3.h
  25. 11 4
      Source/cmMakefile.cxx
  26. 1 1
      Source/cmMakefileProfilingData.cxx
  27. 1 0
      Source/cmMakefileTargetGenerator.cxx
  28. 1 1
      Source/cmOptionCommand.cxx
  29. 1 1
      Source/cmOutputConverter.cxx
  30. 1 1
      Source/cmQtAutoGenGlobalInitializer.h
  31. 12 4
      Source/cmQtAutoGenInitializer.h
  32. 2 2
      Source/cmQtAutoMocUic.cxx
  33. 1 1
      Source/cmState.cxx
  34. 1 1
      Source/cmStringCommand.cxx
  35. 2 0
      Source/cmTarget.cxx
  36. 4 0
      Source/cmTargetLinkLibrariesCommand.cxx
  37. 2 0
      Source/cmTargetPropertyComputer.cxx
  38. 1 1
      Source/cmUVHandlePtr.h
  39. 2 2
      Source/cmWorkerPool.h
  40. 3 3
      Tests/CMakeLib/testUVRAII.cxx

+ 1 - 1
Source/cmCTest.cxx

@@ -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;

+ 1 - 1
Source/cmCommand.h

@@ -44,7 +44,7 @@ public:
   cmMakefile* GetMakefile() { return this->Makefile; }
 
   void SetExecutionStatus(cmExecutionStatus* s);
-  cmExecutionStatus* GetExecutionStatus() { return this->Status; };
+  cmExecutionStatus* GetExecutionStatus() { return this->Status; }
 
   /**
    * This is called by the cmMakefile when the command is first

+ 5 - 1
Source/cmComputeLinkInformation.cxx

@@ -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.

+ 2 - 0
Source/cmComputeTargetDepends.cxx

@@ -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();

+ 2 - 1
Source/cmConditionEvaluator.cxx

@@ -117,7 +117,7 @@ bool looksLikeSpecialVariable(const std::string& var,
     {                                                                         \
     }
 #else
-#  define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base;
+#  define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base
 #endif
 
 // BEGIN cmConditionEvaluator::cmArgumentList
@@ -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;

+ 3 - 0
Source/cmCoreTryCompile.cxx

@@ -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.

+ 1 - 0
Source/cmExportCommand.cxx

@@ -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")) {

+ 2 - 2
Source/cmExtraCodeBlocksGenerator.cxx

@@ -396,8 +396,8 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
             CbpUnit& cbpUnit = allFiles[fullPath];
             cbpUnit.Targets.push_back(target.get());
           }
-        }
-        default: // intended fallthrough
+        } break;
+        default:
           break;
       }
     }

+ 5 - 4
Source/cmExtraCodeLiteGenerator.cxx

@@ -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);

+ 2 - 1
Source/cmFileCommand.cxx

@@ -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;
     }

+ 2 - 2
Source/cmFindLibraryCommand.cxx

@@ -247,7 +247,7 @@ struct cmFindLibraryHelper
         cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr);
       this->DebugSearches.FailedAt(path, regexName);
     }
-  };
+  }
 
   void DebugLibraryFound(std::string const& name, std::string const& path)
   {
@@ -256,7 +256,7 @@ struct cmFindLibraryHelper
         cmStrCat(this->PrefixRegexStr, name, this->SuffixRegexStr);
       this->DebugSearches.FoundAt(path, regexName);
     }
-  };
+  }
 };
 
 namespace {

+ 6 - 0
Source/cmGeneratorTarget.cxx

@@ -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:

+ 1 - 1
Source/cmGeneratorTarget.h

@@ -221,7 +221,7 @@ public:
     {
       this->PreviousState = target.SetDeviceLink(true);
     }
-    ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); };
+    ~DeviceLinkSetter() { this->Target.SetDeviceLink(this->PreviousState); }
 
   private:
     cmGeneratorTarget& Target;

+ 2 - 0
Source/cmGetTargetPropertyCommand.cxx

@@ -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 \""

+ 2 - 0
Source/cmGlobalGenerator.cxx

@@ -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;

+ 2 - 2
Source/cmGlobalNinjaGenerator.cxx

@@ -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: {

+ 1 - 0
Source/cmIncludeCommand.cxx

@@ -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:

+ 2 - 0
Source/cmInstallCommand.cxx

@@ -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

+ 1 - 0
Source/cmInstallSubdirectoryGenerator.cxx

@@ -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;

+ 1 - 1
Source/cmLinkDirectoriesCommand.cxx

@@ -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;

+ 1 - 1
Source/cmListCommand.cxx

@@ -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

+ 3 - 2
Source/cmLocalGenerator.cxx

@@ -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;

+ 2 - 1
Source/cmLocalNinjaGenerator.cxx

@@ -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:

+ 1 - 1
Source/cmLocalUnixMakefileGenerator3.h

@@ -299,7 +299,7 @@ private:
     cmGeneratorTarget const* target)
   {
     return this->CommandsVisited[target];
-  };
+  }
 
   std::map<cmGeneratorTarget const*, std::set<cmSourceFile const*>>
     CommandsVisited;

+ 11 - 4
Source/cmMakefile.cxx

@@ -818,6 +818,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const
         // version.
         this->GetCMakeInstance()->IssueMessage(MessageType::AUTHOR_WARNING,
                                                msg.str(), this->Backtrace);
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         // OLD behavior is to use policy version 2.4 set in
         // cmListFileCache.
@@ -829,7 +830,7 @@ void cmMakefile::EnforceDirectoryLevelRules() const
         this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR,
                                                msg.str(), this->Backtrace);
         cmSystemTools::SetFatalErrorOccured();
-        return;
+        break;
     }
   }
 }
@@ -1001,6 +1002,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
       case cmPolicies::WARN:
         e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0040) << "\n";
         issueMessage = true;
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
       case cmPolicies::NEW:
@@ -1008,6 +1010,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
       case cmPolicies::REQUIRED_ALWAYS:
         issueMessage = true;
         messageType = MessageType::FATAL_ERROR;
+        break;
     }
 
     if (issueMessage) {
@@ -1751,6 +1754,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
           << cmPolicies::GetPolicyWarning(cmPolicies::CMP0014);
         /* clang-format on */
         this->IssueMessage(MessageType::AUTHOR_WARNING, e.str());
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         // OLD behavior does not warn.
         break;
@@ -1761,6 +1765,7 @@ void cmMakefile::ConfigureSubDirectory(cmMakefile* mf)
       case cmPolicies::NEW:
         // NEW behavior prints the error.
         this->IssueMessage(MessageType::FATAL_ERROR, e.str());
+        break;
     }
     return;
   }
@@ -2781,6 +2786,7 @@ MessageType cmMakefile::ExpandVariablesInStringOld(
         case cmPolicies::REQUIRED_ALWAYS:
           error << "\n"
                 << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0010);
+          break;
         case cmPolicies::NEW:
           // NEW behavior is to report the error.
           break;
@@ -3078,8 +3084,8 @@ MessageType cmMakefile::ExpandVariablesInStringNew(
             break;
           }
         }
-      // Failed to find a valid @ expansion; treat it as literal.
-      /* FALLTHROUGH */
+        // Failed to find a valid @ expansion; treat it as literal.
+        CM_FALLTHROUGH;
       default: {
         if (!openstack.empty() &&
             !(isalnum(inc) || inc == '_' || inc == '/' || inc == '.' ||
@@ -4505,7 +4511,8 @@ bool cmMakefile::IgnoreErrorsCMP0061() const
   bool ignoreErrors = true;
   switch (this->GetPolicyStatus(cmPolicies::CMP0061)) {
     case cmPolicies::WARN:
-    // No warning for this policy!
+      // No warning for this policy!
+      CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
     case cmPolicies::REQUIRED_IF_USED:

+ 1 - 1
Source/cmMakefileProfilingData.cxx

@@ -29,7 +29,7 @@ cmMakefileProfilingData::cmMakefileProfilingData(
   }
 
   this->ProfileStream << "[";
-};
+}
 
 cmMakefileProfilingData::~cmMakefileProfilingData() noexcept
 {

+ 1 - 0
Source/cmMakefileTargetGenerator.cxx

@@ -63,6 +63,7 @@ cmMakefileTargetGenerator::cmMakefileTargetGenerator(cmGeneratorTarget* target)
   }
   switch (this->GeneratorTarget->GetPolicyStatusCMP0113()) {
     case cmPolicies::WARN:
+      CM_FALLTHROUGH;
     case cmPolicies::OLD:
       this->CMP0113New = false;
       break;

+ 1 - 1
Source/cmOptionCommand.cxx

@@ -34,7 +34,7 @@ bool cmOptionCommand(std::vector<std::string> const& args,
     switch (policyStatus) {
       case cmPolicies::WARN:
         checkAndWarn = (existsBeforeSet != nullptr);
-        break;
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         // OLD behavior does not warn.
         break;

+ 1 - 1
Source/cmOutputConverter.cxx

@@ -19,7 +19,7 @@ bool PathEqOrSubDir(std::string const& a, std::string const& b)
 {
   return (cmSystemTools::ComparePath(a, b) ||
           cmSystemTools::IsSubDirectory(a, b));
-};
+}
 }
 
 cmOutputConverter::cmOutputConverter(cmStateSnapshot const& snapshot)

+ 1 - 1
Source/cmQtAutoGenGlobalInitializer.h

@@ -49,7 +49,7 @@ public:
     std::vector<std::unique_ptr<cmLocalGenerator>> const& localGenerators);
   ~cmQtAutoGenGlobalInitializer();
 
-  Keywords const& kw() const { return this->Keywords_; };
+  Keywords const& kw() const { return this->Keywords_; }
 
   bool generate();
 

+ 12 - 4
Source/cmQtAutoGenInitializer.h

@@ -95,7 +95,9 @@ public:
 
     GenVarsT(GenT gen)
       : Gen(gen)
-      , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen)){};
+      , GenNameUpper(cmQtAutoGen::GeneratorNameUpper(gen))
+    {
+    }
   };
 
   /** @param mocExecutable The file path to the moc executable. Will be used as
@@ -209,7 +211,9 @@ private:
   struct MocT : public GenVarsT
   {
     MocT()
-      : GenVarsT(GenT::MOC){};
+      : GenVarsT(GenT::MOC)
+    {
+    }
 
     bool RelaxedMode = false;
     bool PathPrefix = false;
@@ -237,7 +241,9 @@ private:
     using UiFileT = std::pair<std::string, std::vector<std::string>>;
 
     UicT()
-      : GenVarsT(GenT::UIC){};
+      : GenVarsT(GenT::UIC)
+    {
+    }
 
     std::set<std::string> SkipUi;
     std::vector<std::string> UiFilesNoOptions;
@@ -252,7 +258,9 @@ private:
   struct RccT : public GenVarsT
   {
     RccT()
-      : GenVarsT(GenT::RCC){};
+      : GenVarsT(GenT::RCC)
+    {
+    }
 
     bool GlobalTarget = false;
     std::vector<Qrc> Qrcs;

+ 2 - 2
Source/cmQtAutoMocUic.cxx

@@ -310,7 +310,7 @@ public:
     cmQtAutoMocUicT* Gen() const
     {
       return static_cast<cmQtAutoMocUicT*>(this->UserData());
-    };
+    }
 
     // -- Accessors. Only valid during Process() call!
     Logger const& Log() const { return this->Gen()->Log(); }
@@ -346,7 +346,7 @@ public:
       : JobT(true)
     {
     }
-    void Process() override{};
+    void Process() override {}
   };
 
   /** Generate moc_predefs.h.  */

+ 1 - 1
Source/cmState.cxx

@@ -453,7 +453,7 @@ void cmState::AddDisallowedCommand(std::string const& name,
         case cmPolicies::WARN:
           mf.IssueMessage(MessageType::AUTHOR_WARNING,
                           cmPolicies::GetPolicyWarning(policy));
-          break;
+          CM_FALLTHROUGH;
         case cmPolicies::OLD:
           break;
         case cmPolicies::REQUIRED_IF_USED:

+ 1 - 1
Source/cmStringCommand.cxx

@@ -1054,7 +1054,7 @@ Json::Value& ResolvePath(Json::Value& json, Args path)
     }
   }
   return *search;
-};
+}
 
 Json::Value ReadJson(const std::string& jsonstr)
 {

+ 2 - 0
Source/cmTarget.cxx

@@ -113,12 +113,14 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>(
           case cmPolicies::WARN:
             e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n";
             noMessage = false;
+            CM_FALLTHROUGH;
           case cmPolicies::OLD:
             break;
           case cmPolicies::REQUIRED_ALWAYS:
           case cmPolicies::REQUIRED_IF_USED:
           case cmPolicies::NEW:
             addContent = true;
+            break;
         }
         if (!noMessage) {
           e << "Target \"" << tgt->GetName()

+ 4 - 0
Source/cmTargetLinkLibrariesCommand.cxx

@@ -143,6 +143,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
       case cmPolicies::WARN:
         e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0039) << "\n";
         modal = "should";
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
       case cmPolicies::REQUIRED_ALWAYS:
@@ -150,6 +151,7 @@ bool cmTargetLinkLibrariesCommand(std::vector<std::string> const& args,
       case cmPolicies::NEW:
         modal = "must";
         messageType = MessageType::FATAL_ERROR;
+        break;
     }
     if (modal) {
       e << "Utility target \"" << target->GetName() << "\" " << modal
@@ -395,6 +397,7 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
       case cmPolicies::WARN:
         e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0023) << "\n";
         modal = "should";
+        CM_FALLTHROUGH;
       case cmPolicies::OLD:
         break;
       case cmPolicies::REQUIRED_ALWAYS:
@@ -402,6 +405,7 @@ bool TLL::HandleLibrary(ProcessingState currentProcessingState,
       case cmPolicies::NEW:
         modal = "must";
         messageType = MessageType::FATAL_ERROR;
+        break;
     }
 
     if (modal) {

+ 2 - 0
Source/cmTargetPropertyComputer.cxx

@@ -21,6 +21,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
     case cmPolicies::WARN:
       e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n";
       modal = "should";
+      CM_FALLTHROUGH;
     case cmPolicies::OLD:
       break;
     case cmPolicies::REQUIRED_ALWAYS:
@@ -28,6 +29,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy(
     case cmPolicies::NEW:
       modal = "may";
       messageType = MessageType::FATAL_ERROR;
+      break;
   }
 
   if (modal) {

+ 1 - 1
Source/cmUVHandlePtr.h

@@ -23,7 +23,7 @@
 
 #else
 
-#  define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base;
+#  define CM_INHERIT_CTOR(Class, Base, Tpl) using Base Tpl ::Base
 
 #endif
 

+ 2 - 2
Source/cmWorkerPool.h

@@ -87,7 +87,7 @@ public:
      * Get the user data.
      * Only valid during the JobT::Process() call!
      */
-    void* UserData() const { return this->Pool_->UserData(); };
+    void* UserData() const { return this->Pool_->UserData(); }
 
     /**
      * Get the worker index.
@@ -138,7 +138,7 @@ public:
     {
     }
     //! Does nothing
-    void Process() override{};
+    void Process() override {}
   };
 
   /**

+ 3 - 3
Tests/CMakeLib/testUVRAII.cxx

@@ -169,7 +169,7 @@ static bool testAllMoves()
   allTypes b(std::move(a));
   allTypes c = std::move(b);
   return true;
-};
+}
 
 static bool testLoopReset()
 {
@@ -192,7 +192,7 @@ static bool testLoopReset()
   }
 
   return true;
-};
+}
 
 static bool testLoopDestructor()
 {
@@ -217,7 +217,7 @@ static bool testLoopDestructor()
   }
 
   return true;
-};
+}
 
 int testUVRAII(int, char** const)
 {