[flang-commits] [flang] 2778af9 - [flang] Fix warnings

Kazu Hirata via flang-commits flang-commits at lists.llvm.org
Mon Nov 11 10:09:29 PST 2024


Author: Kazu Hirata
Date: 2024-11-11T10:09:24-08:00
New Revision: 2778af9a70bd4b4365bba2d20d50568f7ee3d18f

URL: https://github.com/llvm/llvm-project/commit/2778af9a70bd4b4365bba2d20d50568f7ee3d18f
DIFF: https://github.com/llvm/llvm-project/commit/2778af9a70bd4b4365bba2d20d50568f7ee3d18f.diff

LOG: [flang] Fix warnings

This patch fixes:

  flang/lib/Semantics/check-omp-structure.cpp:979:24: error: unused
  variable 'top' [-Werror,-Wunused-variable]

  flang/lib/Semantics/check-omp-structure.cpp:4441:24: error: unused
  variable 'top' [-Werror,-Wunused-variable]

Added: 
    

Modified: 
    flang/lib/Semantics/check-omp-structure.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index dc90b4cccabd26..720f3853968b34 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -976,8 +976,8 @@ void OmpStructureChecker::Leave(const parser::OpenMPLoopConstruct &x) {
   dirContext_.pop_back();
 
   assert(!loopStack_.empty() && "Expecting non-empty loop stack");
-  const LoopConstruct &top{loopStack_.back()};
 #ifndef NDEBUG
+  const LoopConstruct &top{loopStack_.back()};
   auto *loopc{std::get_if<const parser::OpenMPLoopConstruct *>(&top)};
   assert(loopc != nullptr && *loopc == &x && "Mismatched loop constructs");
 #endif
@@ -4438,8 +4438,8 @@ void OmpStructureChecker::Enter(const parser::DoConstruct &x) {
 
 void OmpStructureChecker::Leave(const parser::DoConstruct &x) {
   assert(!loopStack_.empty() && "Expecting non-empty loop stack");
-  const LoopConstruct &top = loopStack_.back();
 #ifndef NDEBUG
+  const LoopConstruct &top = loopStack_.back();
   auto *doc{std::get_if<const parser::DoConstruct *>(&top)};
   assert(doc != nullptr && *doc == &x && "Mismatched loop constructs");
 #endif


        


More information about the flang-commits mailing list