Browse Source

Source: Convince NVHPC that RAII variables are used

Brad King 4 years ago
parent
commit
5ad8862318
2 changed files with 15 additions and 0 deletions
  1. 9 0
      Source/cmLoadCommandCommand.cxx
  2. 6 0
      Source/cmQtAutoMocUic.cxx

+ 9 - 0
Source/cmLoadCommandCommand.cxx

@@ -90,6 +90,9 @@ struct LoadedCommandImpl : cmLoadedCommandInfo
   {
     if (this->Destructor) {
       SignalHandlerGuard guard(this->Name);
+#if defined(__NVCOMPILER)
+      static_cast<void>(guard); // convince compiler var is used
+#endif
       this->Destructor(this);
     }
     if (this->Error != nullptr) {
@@ -103,12 +106,18 @@ struct LoadedCommandImpl : cmLoadedCommandInfo
   int DoInitialPass(cmMakefile* mf, int argc, char* argv[])
   {
     SignalHandlerGuard guard(this->Name);
+#if defined(__NVCOMPILER)
+    static_cast<void>(guard); // convince compiler var is used
+#endif
     return this->InitialPass(this, mf, argc, argv);
   }
 
   void DoFinalPass(cmMakefile* mf)
   {
     SignalHandlerGuard guard(this->Name);
+#if defined(__NVCOMPILER)
+    static_cast<void>(guard); // convince compiler var is used
+#endif
     this->FinalPass(this, mf);
   }
 };

+ 6 - 0
Source/cmQtAutoMocUic.cxx

@@ -2723,6 +2723,9 @@ void cmQtAutoMocUicT::CreateParseJobs(SourceFileMapT const& sourceMap)
 std::string cmQtAutoMocUicT::CollapseFullPathTS(std::string const& path) const
 {
   std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
+#if defined(__NVCOMPILER)
+  static_cast<void>(guard); // convince compiler var is used
+#endif
   return cmSystemTools::CollapseFullPath(path,
                                          this->ProjectDirs().CurrentSource);
 }
@@ -2962,6 +2965,9 @@ std::vector<std::string> cmQtAutoMocUicT::dependenciesFromDepFile(
   const char* filePath)
 {
   std::lock_guard<std::mutex> guard(this->CMakeLibMutex_);
+#if defined(__NVCOMPILER)
+  static_cast<void>(guard); // convince compiler var is used
+#endif
   auto const content = cmReadGccDepfile(filePath);
   if (!content || content->empty()) {
     return {};