ソースを参照

Source: Fix clang -Wunused-but-set-variable warnings

Brad King 3 年 前
コミット
75e8173322

+ 0 - 6
Source/CTest/cmCTestCoverageHandler.cxx

@@ -1218,11 +1218,8 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
           cmCTestLog(this->CTest, ERROR_MESSAGE,
                      "Cannot open file: " << gcovFile << std::endl);
         } else {
-          long cnt = -1;
           std::string nl;
           while (cmSystemTools::GetLineFromStream(ifile, nl)) {
-            cnt++;
-
             // Skip empty lines
             if (nl.empty()) {
               continue;
@@ -1528,7 +1525,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
             cmCTestLog(this->CTest, ERROR_MESSAGE,
                        "Cannot open file: " << lcovFile << std::endl);
           } else {
-            long cnt = -1;
             std::string nl;
 
             // Skip the first line
@@ -1537,8 +1533,6 @@ int cmCTestCoverageHandler::HandleLCovCoverage(
                                "File is ready, start reading." << std::endl,
                                this->Quiet);
             while (cmSystemTools::GetLineFromStream(ifile, nl)) {
-              cnt++;
-
               // Skip empty lines
               if (nl.empty()) {
                 continue;

+ 0 - 2
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -1284,10 +1284,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
   }
 
   this->TestHandler->SetMaxIndex(this->FindMaxIndex());
-  int count = 0;
 
   for (auto& it : this->Properties) {
-    count++;
     cmCTestTestHandler::cmCTestTestProperties& p = *it.second;
 
     // Don't worry if this fails, we are only showing the test list, not

+ 2 - 5
Source/CTest/cmCTestTestHandler.cxx

@@ -2486,22 +2486,19 @@ bool cmCTestTestHandler::WriteJUnitXML()
   // Iterate over the test results to get the number of tests that
   // passed, failed, etc.
   auto num_tests = 0;
-  auto num_passed = 0;
   auto num_failed = 0;
   auto num_notrun = 0;
   auto num_disabled = 0;
   SetOfTests resultsSet(this->TestResults.begin(), this->TestResults.end());
   for (cmCTestTestResult const& result : resultsSet) {
     num_tests++;
-    if (result.Status == cmCTestTestHandler::COMPLETED) {
-      num_passed++;
-    } else if (result.Status == cmCTestTestHandler::NOT_RUN) {
+    if (result.Status == cmCTestTestHandler::NOT_RUN) {
       if (result.CompletionStatus == "Disabled") {
         num_disabled++;
       } else {
         num_notrun++;
       }
-    } else {
+    } else if (result.Status != cmCTestTestHandler::COMPLETED) {
       num_failed++;
     }
   }

+ 0 - 2
Source/cmCreateTestSourceList.cxx

@@ -102,7 +102,6 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
   }
 
   std::string functionMapCode;
-  int numTests = 0;
   std::vector<std::string>::iterator j;
   for (i = testsBegin, j = tests_func_name.begin(); i != tests.end();
        ++i, ++j) {
@@ -121,7 +120,6 @@ bool cmCreateTestSourceList(std::vector<std::string> const& args,
     functionMapCode += *j;
     functionMapCode += "\n"
                        "  },\n";
-    numTests++;
   }
   if (!extraInclude.empty()) {
     mf.AddDefinition("CMAKE_TESTDRIVER_EXTRA_INCLUDES", extraInclude);