Browse Source

cmake: Remove broken '--warn-unused-vars' option

This option has been broken since commit b9f9915516 (cmMakefile: Remove
VarUsageStack., 2015-05-17, v3.3.0-rc1~52^2).  That commit removed the
check that an initialized variable has actually been used and caused the
option to warn on every variable ever set.  This was not caught by the
test suite because the test for the feature only checked that warnings
appear when needed and not that they do not appear when not needed.

The option was never very practical to use.  Remove it to avoid the
runtime cost of usage tracking and checks for every variable (which we
were doing even when the option was not used).
Brad King 5 years ago
parent
commit
df6b077625

+ 3 - 3
Help/manual/cmake.1.rst

@@ -341,9 +341,9 @@ Options
  Print a warning when an uninitialized variable is used.
  Print a warning when an uninitialized variable is used.
 
 
 ``--warn-unused-vars``
 ``--warn-unused-vars``
- Warn about unused variables.
-
- Find variables that are declared or set, but not used.
+ Does nothing.  In CMake versions 3.2 and below this enabled warnings about
+ unused variables.  In CMake versions 3.3 through 3.18 the option was broken.
+ In CMake 3.19 and above the option has been removed.
 
 
 ``--no-warn-unused-cli``
 ``--no-warn-unused-cli``
  Don't warn about command line options.
  Don't warn about command line options.

+ 6 - 0
Help/release/dev/remove-warn-unused-vars.rst

@@ -0,0 +1,6 @@
+remove-warn-unused-vars
+-----------------------
+
+* The :manual:`cmake(1)` command-line option ``--warn-unused-vars`` has
+  been removed and is now silently ignored.  The option has not worked
+  correctly since CMake 3.3.

+ 0 - 6
Source/QtDialog/CMakeSetupDialog.cxx

@@ -152,9 +152,6 @@ CMakeSetupDialog::CMakeSetupDialog()
   this->WarnUninitializedAction =
   this->WarnUninitializedAction =
     OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
     OptionsMenu->addAction(tr("&Warn Uninitialized (--warn-uninitialized)"));
   this->WarnUninitializedAction->setCheckable(true);
   this->WarnUninitializedAction->setCheckable(true);
-  this->WarnUnusedAction =
-    OptionsMenu->addAction(tr("&Warn Unused (--warn-unused-vars)"));
-  this->WarnUnusedAction->setCheckable(true);
 
 
   QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
   QAction* debugAction = OptionsMenu->addAction(tr("&Debug Output"));
   debugAction->setCheckable(true);
   debugAction->setCheckable(true);
@@ -290,9 +287,6 @@ void CMakeSetupDialog::initialize()
   QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
   QObject::connect(this->WarnUninitializedAction, SIGNAL(triggered(bool)),
                    this->CMakeThread->cmakeInstance(),
                    this->CMakeThread->cmakeInstance(),
                    SLOT(setWarnUninitializedMode(bool)));
                    SLOT(setWarnUninitializedMode(bool)));
-  QObject::connect(this->WarnUnusedAction, SIGNAL(triggered(bool)),
-                   this->CMakeThread->cmakeInstance(),
-                   SLOT(setWarnUnusedMode(bool)));
 
 
   if (!this->SourceDirectory->text().isEmpty() ||
   if (!this->SourceDirectory->text().isEmpty() ||
       !this->BinaryDirectory->lineEdit()->text().isEmpty()) {
       !this->BinaryDirectory->lineEdit()->text().isEmpty()) {

+ 0 - 1
Source/QtDialog/CMakeSetupDialog.h

@@ -111,7 +111,6 @@ protected:
   QAction* ConfigureAction;
   QAction* ConfigureAction;
   QAction* GenerateAction;
   QAction* GenerateAction;
   QAction* WarnUninitializedAction;
   QAction* WarnUninitializedAction;
-  QAction* WarnUnusedAction;
   QAction* InstallForCommandLineAction;
   QAction* InstallForCommandLineAction;
   State CurrentState;
   State CurrentState;
 
 

+ 0 - 7
Source/QtDialog/QCMake.cxx

@@ -21,7 +21,6 @@ QCMake::QCMake(QObject* p)
   : QObject(p)
   : QObject(p)
 {
 {
   this->WarnUninitializedMode = false;
   this->WarnUninitializedMode = false;
-  this->WarnUnusedMode = false;
   qRegisterMetaType<QCMakeProperty>();
   qRegisterMetaType<QCMakeProperty>();
   qRegisterMetaType<QCMakePropertyList>();
   qRegisterMetaType<QCMakePropertyList>();
 
 
@@ -170,7 +169,6 @@ void QCMake::configure()
   this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data());
   this->CMakeInstance->SetGeneratorToolset(this->Toolset.toLocal8Bit().data());
   this->CMakeInstance->LoadCache();
   this->CMakeInstance->LoadCache();
   this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
   this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
-  this->CMakeInstance->SetWarnUnused(this->WarnUnusedMode);
   this->CMakeInstance->PreLoadCMakeFiles();
   this->CMakeInstance->PreLoadCMakeFiles();
 
 
   InterruptFlag = 0;
   InterruptFlag = 0;
@@ -478,11 +476,6 @@ void QCMake::setWarnUninitializedMode(bool value)
   this->WarnUninitializedMode = value;
   this->WarnUninitializedMode = value;
 }
 }
 
 
-void QCMake::setWarnUnusedMode(bool value)
-{
-  this->WarnUnusedMode = value;
-}
-
 void QCMake::checkOpenPossible()
 void QCMake::checkOpenPossible()
 {
 {
   std::string data = this->BinaryDirectory.toLocal8Bit().data();
   std::string data = this->BinaryDirectory.toLocal8Bit().data();

+ 0 - 4
Source/QtDialog/QCMake.h

@@ -114,8 +114,6 @@ public slots:
   void setDeprecatedWarningsAsErrors(bool value);
   void setDeprecatedWarningsAsErrors(bool value);
   /// set whether to run cmake with warnings about uninitialized variables
   /// set whether to run cmake with warnings about uninitialized variables
   void setWarnUninitializedMode(bool value);
   void setWarnUninitializedMode(bool value);
-  /// set whether to run cmake with warnings about unused variables
-  void setWarnUnusedMode(bool value);
   /// check if project IDE open is possible and emit openPossible signal
   /// check if project IDE open is possible and emit openPossible signal
   void checkOpenPossible();
   void checkOpenPossible();
 
 
@@ -175,8 +173,6 @@ protected:
   void stderrCallback(std::string const& msg);
   void stderrCallback(std::string const& msg);
 
 
   bool WarnUninitializedMode;
   bool WarnUninitializedMode;
-  bool WarnUnusedMode;
-  bool WarnUnusedAllMode;
   QString SourceDirectory;
   QString SourceDirectory;
   QString BinaryDirectory;
   QString BinaryDirectory;
   QString Generator;
   QString Generator;

+ 0 - 14
Source/cmDefinitions.cxx

@@ -19,7 +19,6 @@ cmDefinitions::Def const& cmDefinitions::GetInternal(const std::string& key,
   {
   {
     auto it = begin->Map.find(cm::String::borrow(key));
     auto it = begin->Map.find(cm::String::borrow(key));
     if (it != begin->Map.end()) {
     if (it != begin->Map.end()) {
-      it->second.Used = true;
       return it->second;
       return it->second;
     }
     }
   }
   }
@@ -108,16 +107,3 @@ void cmDefinitions::Unset(const std::string& key)
 {
 {
   this->Map[key] = Def();
   this->Map[key] = Def();
 }
 }
-
-std::vector<std::string> cmDefinitions::UnusedKeys() const
-{
-  std::vector<std::string> keys;
-  keys.reserve(this->Map.size());
-  // Consider local definitions.
-  for (auto const& mi : this->Map) {
-    if (!mi.second.Used) {
-      keys.push_back(*mi.first.str_if_stable());
-    }
-  }
-  return keys;
-}

+ 0 - 4
Source/cmDefinitions.h

@@ -48,9 +48,6 @@ public:
   /** Unset a definition.  */
   /** Unset a definition.  */
   void Unset(const std::string& key);
   void Unset(const std::string& key);
 
 
-  /** List of unused keys.  */
-  std::vector<std::string> UnusedKeys() const;
-
 private:
 private:
   /** String with existence boolean.  */
   /** String with existence boolean.  */
   struct Def
   struct Def
@@ -62,7 +59,6 @@ private:
     {
     {
     }
     }
     cm::String Value;
     cm::String Value;
-    bool Used = false;
   };
   };
   static Def NoDef;
   static Def NoDef;
 
 

+ 2 - 42
Source/cmMakefile.cxx

@@ -83,7 +83,6 @@ cmMakefile::cmMakefile(cmGlobalGenerator* globalGenerator,
 {
 {
   this->IsSourceFileTryCompile = false;
   this->IsSourceFileTryCompile = false;
 
 
-  this->WarnUnused = this->GetCMakeInstance()->GetWarnUnused();
   this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
   this->CheckSystemVars = this->GetCMakeInstance()->GetCheckSystemVars();
 
 
   this->SuppressSideEffects = false;
   this->SuppressSideEffects = false;
@@ -751,7 +750,6 @@ void cmMakefile::ReadListFile(cmListFile const& listFile,
       break;
       break;
     }
     }
   }
   }
-  this->CheckForUnusedVariables();
 
 
   this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile);
   this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile);
   this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile);
   this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile);
@@ -1511,8 +1509,6 @@ void cmMakefile::PopFunctionScope(bool reportError)
 #endif
 #endif
 
 
   this->PopLoopBlockBarrier();
   this->PopLoopBlockBarrier();
-
-  this->CheckForUnusedVariables();
 }
 }
 
 
 void cmMakefile::PushMacroScope(std::string const& fileName,
 void cmMakefile::PushMacroScope(std::string const& fileName,
@@ -1859,9 +1855,6 @@ void cmMakefile::AddSystemIncludeDirectories(const std::set<std::string>& incs)
 
 
 void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
 void cmMakefile::AddDefinition(const std::string& name, cm::string_view value)
 {
 {
-  if (this->VariableInitialized(name)) {
-    this->LogUnused("changing definition", name);
-  }
   this->StateSnapshot.SetDefinition(name, value);
   this->StateSnapshot.SetDefinition(name, value);
 
 
 #ifndef CMAKE_BOOTSTRAP
 #ifndef CMAKE_BOOTSTRAP
@@ -1922,16 +1915,6 @@ void cmMakefile::AddCacheDefinition(const std::string& name, const char* value,
   this->StateSnapshot.RemoveDefinition(name);
   this->StateSnapshot.RemoveDefinition(name);
 }
 }
 
 
-void cmMakefile::CheckForUnusedVariables() const
-{
-  if (!this->WarnUnused) {
-    return;
-  }
-  for (const std::string& key : this->StateSnapshot.UnusedKeys()) {
-    this->LogUnused("out of scope", key);
-  }
-}
-
 void cmMakefile::MarkVariableAsUsed(const std::string& var)
 void cmMakefile::MarkVariableAsUsed(const std::string& var)
 {
 {
   this->StateSnapshot.GetDefinition(var);
   this->StateSnapshot.GetDefinition(var);
@@ -1959,29 +1942,8 @@ void cmMakefile::MaybeWarnUninitialized(std::string const& variable,
   }
   }
 }
 }
 
 
-void cmMakefile::LogUnused(const char* reason, const std::string& name) const
-{
-  if (this->WarnUnused) {
-    std::string path;
-    if (!this->ExecutionStatusStack.empty()) {
-      path = this->GetExecutionContext().FilePath;
-    } else {
-      path = cmStrCat(this->GetCurrentSourceDirectory(), "/CMakeLists.txt");
-    }
-
-    if (this->CheckSystemVars || this->IsProjectFile(path.c_str())) {
-      std::ostringstream msg;
-      msg << "unused variable (" << reason << ") \'" << name << "\'";
-      this->IssueMessage(MessageType::AUTHOR_WARNING, msg.str());
-    }
-  }
-}
-
 void cmMakefile::RemoveDefinition(const std::string& name)
 void cmMakefile::RemoveDefinition(const std::string& name)
 {
 {
-  if (this->VariableInitialized(name)) {
-    this->LogUnused("unsetting", name);
-  }
   this->StateSnapshot.RemoveDefinition(name);
   this->StateSnapshot.RemoveDefinition(name);
 #ifndef CMAKE_BOOTSTRAP
 #ifndef CMAKE_BOOTSTRAP
   cmVariableWatch* vv = this->GetVariableWatch();
   cmVariableWatch* vv = this->GetVariableWatch();
@@ -3724,7 +3686,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
   if (cmakeArgs) {
   if (cmakeArgs) {
     // FIXME: Workaround to ignore unused CLI variables in try-compile.
     // FIXME: Workaround to ignore unused CLI variables in try-compile.
     //
     //
-    // Ideally we should use SetArgs to honor options like --warn-unused-vars.
+    // Ideally we should use SetArgs for options like --no-warn-unused-cli.
     // However, there is a subtle problem when certain arguments are passed to
     // However, there is a subtle problem when certain arguments are passed to
     // a macro wrapping around try_compile or try_run that does not escape
     // a macro wrapping around try_compile or try_run that does not escape
     // semicolons in its parameters but just passes ${ARGV} or ${ARGN}.  In
     // semicolons in its parameters but just passes ${ARGV} or ${ARGN}.  In
@@ -3743,7 +3705,7 @@ int cmMakefile::TryCompile(const std::string& srcdir,
     // the value VAR=a is sufficient for the try_compile or try_run to get the
     // the value VAR=a is sufficient for the try_compile or try_run to get the
     // correct result.  Calling SetArgs here would break such projects that
     // correct result.  Calling SetArgs here would break such projects that
     // previously built.  Instead we work around the issue by never reporting
     // previously built.  Instead we work around the issue by never reporting
-    // unused arguments and ignoring options such as --warn-unused-vars.
+    // unused arguments and ignoring options such as --no-warn-unused-cli.
     cm.SetWarnUnusedCli(false);
     cm.SetWarnUnusedCli(false);
     // cm.SetArgs(*cmakeArgs, true);
     // cm.SetArgs(*cmakeArgs, true);
 
 
@@ -4247,8 +4209,6 @@ void cmMakefile::PopScope()
 
 
   this->PopLoopBlockBarrier();
   this->PopLoopBlockBarrier();
 
 
-  this->CheckForUnusedVariables();
-
   this->PopSnapshot();
   this->PopSnapshot();
 }
 }
 
 

+ 0 - 7
Source/cmMakefile.h

@@ -995,9 +995,6 @@ protected:
   // add link libraries and directories to the target
   // add link libraries and directories to the target
   void AddGlobalLinkInformation(cmTarget& target);
   void AddGlobalLinkInformation(cmTarget& target);
 
 
-  // Check for a an unused variable
-  void LogUnused(const char* reason, const std::string& name) const;
-
   mutable std::set<cmListFileContext> CMP0054ReportedIds;
   mutable std::set<cmListFileContext> CMP0054ReportedIds;
 
 
   // libraries, classes, and executables
   // libraries, classes, and executables
@@ -1233,10 +1230,6 @@ private:
                                  std::string const& config,
                                  std::string const& config,
                                  const std::string& feature) const;
                                  const std::string& feature) const;
 
 
-  void CheckForUnusedVariables() const;
-
-  // Unused variable flags
-  bool WarnUnused;
   bool CheckSystemVars;
   bool CheckSystemVars;
   bool CheckCMP0000;
   bool CheckCMP0000;
   std::set<std::string> WarnedCMP0074;
   std::set<std::string> WarnedCMP0074;

+ 3 - 2
Source/cmServerProtocol.cxx

@@ -136,6 +136,7 @@ bool cmServerProtocol::Activate(cmServer* server,
   this->m_Server = server;
   this->m_Server = server;
   this->m_CMakeInstance =
   this->m_CMakeInstance =
     cm::make_unique<cmake>(cmake::RoleProject, cmState::Project);
     cm::make_unique<cmake>(cmake::RoleProject, cmState::Project);
+  this->m_WarnUnused = false;
   const bool result = this->DoActivate(request, errorMessage);
   const bool result = this->DoActivate(request, errorMessage);
   if (!result) {
   if (!result) {
     this->m_CMakeInstance = nullptr;
     this->m_CMakeInstance = nullptr;
@@ -636,7 +637,7 @@ cmServerResponse cmServerProtocol1::ProcessGlobalSettings(
   obj[kTRACE_KEY] = cm->GetTrace();
   obj[kTRACE_KEY] = cm->GetTrace();
   obj[kTRACE_EXPAND_KEY] = cm->GetTraceExpand();
   obj[kTRACE_EXPAND_KEY] = cm->GetTraceExpand();
   obj[kWARN_UNINITIALIZED_KEY] = cm->GetWarnUninitialized();
   obj[kWARN_UNINITIALIZED_KEY] = cm->GetWarnUninitialized();
-  obj[kWARN_UNUSED_KEY] = cm->GetWarnUnused();
+  obj[kWARN_UNUSED_KEY] = m_WarnUnused;
   obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli();
   obj[kWARN_UNUSED_CLI_KEY] = cm->GetWarnUnusedCli();
   obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars();
   obj[kCHECK_SYSTEM_VARS_KEY] = cm->GetCheckSystemVars();
 
 
@@ -682,7 +683,7 @@ cmServerResponse cmServerProtocol1::ProcessSetGlobalSettings(
   setBool(request, kTRACE_EXPAND_KEY, [cm](bool e) { cm->SetTraceExpand(e); });
   setBool(request, kTRACE_EXPAND_KEY, [cm](bool e) { cm->SetTraceExpand(e); });
   setBool(request, kWARN_UNINITIALIZED_KEY,
   setBool(request, kWARN_UNINITIALIZED_KEY,
           [cm](bool e) { cm->SetWarnUninitialized(e); });
           [cm](bool e) { cm->SetWarnUninitialized(e); });
-  setBool(request, kWARN_UNUSED_KEY, [cm](bool e) { cm->SetWarnUnused(e); });
+  setBool(request, kWARN_UNUSED_KEY, [this](bool e) { m_WarnUnused = e; });
   setBool(request, kWARN_UNUSED_CLI_KEY,
   setBool(request, kWARN_UNUSED_CLI_KEY,
           [cm](bool e) { cm->SetWarnUnusedCli(e); });
           [cm](bool e) { cm->SetWarnUnusedCli(e); });
   setBool(request, kCHECK_SYSTEM_VARS_KEY,
   setBool(request, kCHECK_SYSTEM_VARS_KEY,

+ 1 - 0
Source/cmServerProtocol.h

@@ -94,6 +94,7 @@ protected:
   // Implement protocol specific activation tasks here. Called from Activate().
   // Implement protocol specific activation tasks here. Called from Activate().
   virtual bool DoActivate(const cmServerRequest& request,
   virtual bool DoActivate(const cmServerRequest& request,
                           std::string* errorMessage);
                           std::string* errorMessage);
+  bool m_WarnUnused = false; // storage for legacy option
 
 
 private:
 private:
   std::unique_ptr<cmake> m_CMakeInstance;
   std::unique_ptr<cmake> m_CMakeInstance;

+ 0 - 5
Source/cmStateSnapshot.cxx

@@ -232,11 +232,6 @@ void cmStateSnapshot::RemoveDefinition(std::string const& name)
   this->Position->Vars->Unset(name);
   this->Position->Vars->Unset(name);
 }
 }
 
 
-std::vector<std::string> cmStateSnapshot::UnusedKeys() const
-{
-  return this->Position->Vars->UnusedKeys();
-}
-
 std::vector<std::string> cmStateSnapshot::ClosureKeys() const
 std::vector<std::string> cmStateSnapshot::ClosureKeys() const
 {
 {
   return cmDefinitions::ClosureKeys(this->Position->Vars,
   return cmDefinitions::ClosureKeys(this->Position->Vars,

+ 0 - 1
Source/cmStateSnapshot.h

@@ -28,7 +28,6 @@ public:
   bool IsInitialized(std::string const& name) const;
   bool IsInitialized(std::string const& name) const;
   void SetDefinition(std::string const& name, cm::string_view value);
   void SetDefinition(std::string const& name, cm::string_view value);
   void RemoveDefinition(std::string const& name);
   void RemoveDefinition(std::string const& name);
-  std::vector<std::string> UnusedKeys() const;
   std::vector<std::string> ClosureKeys() const;
   std::vector<std::string> ClosureKeys() const;
   bool RaiseScope(std::string const& var, const char* varDef);
   bool RaiseScope(std::string const& var, const char* varDef);
 
 

+ 1 - 2
Source/cmake.cxx

@@ -773,8 +773,7 @@ void cmake::SetArgs(const std::vector<std::string>& args)
       std::cout << "Warn about uninitialized values.\n";
       std::cout << "Warn about uninitialized values.\n";
       this->SetWarnUninitialized(true);
       this->SetWarnUninitialized(true);
     } else if (cmHasLiteralPrefix(arg, "--warn-unused-vars")) {
     } else if (cmHasLiteralPrefix(arg, "--warn-unused-vars")) {
-      std::cout << "Finding unused variables.\n";
-      this->SetWarnUnused(true);
+      // Option was removed.
     } else if (cmHasLiteralPrefix(arg, "--no-warn-unused-cli")) {
     } else if (cmHasLiteralPrefix(arg, "--no-warn-unused-cli")) {
       std::cout << "Not searching for unused variables given on the "
       std::cout << "Not searching for unused variables given on the "
                 << "command line.\n";
                 << "command line.\n";

+ 0 - 3
Source/cmake.h

@@ -450,8 +450,6 @@ public:
 
 
   bool GetWarnUninitialized() { return this->WarnUninitialized; }
   bool GetWarnUninitialized() { return this->WarnUninitialized; }
   void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
   void SetWarnUninitialized(bool b) { this->WarnUninitialized = b; }
-  bool GetWarnUnused() { return this->WarnUnused; }
-  void SetWarnUnused(bool b) { this->WarnUnused = b; }
   bool GetWarnUnusedCli() { return this->WarnUnusedCli; }
   bool GetWarnUnusedCli() { return this->WarnUnusedCli; }
   void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
   void SetWarnUnusedCli(bool b) { this->WarnUnusedCli = b; }
   bool GetCheckSystemVars() { return this->CheckSystemVars; }
   bool GetCheckSystemVars() { return this->CheckSystemVars; }
@@ -605,7 +603,6 @@ private:
   TraceFormat TraceFormatVar = TRACE_HUMAN;
   TraceFormat TraceFormatVar = TRACE_HUMAN;
   cmGeneratedFileStream TraceFile;
   cmGeneratedFileStream TraceFile;
   bool WarnUninitialized = false;
   bool WarnUninitialized = false;
-  bool WarnUnused = false;
   bool WarnUnusedCli = true;
   bool WarnUnusedCli = true;
   bool CheckSystemVars = false;
   bool CheckSystemVars = false;
   std::map<std::string, bool> UsedCliVariables;
   std::map<std::string, bool> UsedCliVariables;

+ 0 - 1
Source/cmakemain.cxx

@@ -93,7 +93,6 @@ const char* cmDocumentationOptions[][2] = {
   { "--trace-redirect=<file>",
   { "--trace-redirect=<file>",
     "Redirect trace output to a file instead of stderr." },
     "Redirect trace output to a file instead of stderr." },
   { "--warn-uninitialized", "Warn about uninitialized values." },
   { "--warn-uninitialized", "Warn about uninitialized values." },
-  { "--warn-unused-vars", "Warn about unused variables." },
   { "--no-warn-unused-cli", "Don't warn about command line options." },
   { "--no-warn-unused-cli", "Don't warn about command line options." },
   { "--check-system-vars",
   { "--check-system-vars",
     "Find problems with variable usage in system "
     "Find problems with variable usage in system "

+ 0 - 30
Tests/CMakeLists.txt

@@ -2417,36 +2417,6 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
     list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
     list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BundleGeneratorTest")
   endif()
   endif()
 
 
-  add_test(WarnUnusedUnusedViaSet ${CMAKE_CTEST_COMMAND}
-    --build-and-test
-    "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaSet"
-    "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet"
-    ${build_generator_args}
-    --build-noclean
-    --build-project WarnUnusedUnusedViaSet
-    --build-options
-      "--warn-unused-vars")
-  set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
-    PASS_REGULAR_EXPRESSION "unused variable \\(changing definition\\) 'UNUSED_VARIABLE'")
-  set_tests_properties(WarnUnusedUnusedViaSet PROPERTIES
-    FAIL_REGULAR_EXPRESSION "unused variable \\(unsetting\\) 'UNUSED_VARIABLE'")
-  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaSet")
-
-  add_test(WarnUnusedUnusedViaUnset ${CMAKE_CTEST_COMMAND}
-    --build-and-test
-    "${CMake_SOURCE_DIR}/Tests/VariableUnusedViaUnset"
-    "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset"
-    ${build_generator_args}
-    --build-noclean
-    --build-project WarnUnusedUnusedViaUnset
-    --build-options
-      "--warn-unused-vars")
-  set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
-    PASS_REGULAR_EXPRESSION "CMake Warning \\(dev\\) at CMakeLists.txt:7 \\(set\\):")
-  set_tests_properties(WarnUnusedUnusedViaUnset PROPERTIES
-    FAIL_REGULAR_EXPRESSION "CMakeLists.txt:5 \\(set\\):")
-  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/WarnUnusedUnusedViaUnset")
-
   add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
   add_test(WarnUnusedCliUnused ${CMAKE_CTEST_COMMAND}
     --build-and-test
     --build-and-test
     "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused"
     "${CMake_SOURCE_DIR}/Tests/WarnUnusedCliUnused"

+ 0 - 4
Tests/VariableUnusedViaSet/CMakeLists.txt

@@ -1,4 +0,0 @@
-set(UNUSED_VARIABLE)
-# Warning should occur here
-set(UNUSED_VARIABLE "Usage")
-message(STATUS "${UNUSED_VARIABLE}")

+ 0 - 8
Tests/VariableUnusedViaUnset/CMakeLists.txt

@@ -1,8 +0,0 @@
-# NOTE: Changing lines in here changes the test results since the first
-# instance shouldn't warn, but the second should and they have the same message
-
-# A warning should NOT be issued for this line:
-set(UNUSED_VARIABLE)
-# Warning should occur here:
-set(UNUSED_VARIABLE)
-message(STATUS "${UNUSED_VARIABLE}")