[flang-commits] [flang] 5225901 - [flang] Add [[maybe_unused]] to fix -Werror build (#83456)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 29 13:02:42 PST 2024


Author: Peter Klausler
Date: 2024-02-29T13:02:39-08:00
New Revision: 5225901ecd53ba1e3f1519f3edea7d1aec15502d

URL: https://github.com/llvm/llvm-project/commit/5225901ecd53ba1e3f1519f3edea7d1aec15502d
DIFF: https://github.com/llvm/llvm-project/commit/5225901ecd53ba1e3f1519f3edea7d1aec15502d.diff

LOG: [flang] Add [[maybe_unused]] to fix -Werror build (#83456)

Add the [[maybe_unused]] attribute to a variable in
lib/Lower/OpenMP/OpenMP.cpp to avoid a (possibly bogus) unused variable
warning when building with GCC 9.3.0.

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 21ad51c53d8742..90fc1f80f57ab7 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -840,7 +840,8 @@ genEnterExitUpdateDataOp(Fortran::lower::AbstractConverter &converter,
   llvm::SmallVector<mlir::Attribute> dependTypeOperands;
 
   Fortran::parser::OmpIfClause::DirectiveNameModifier directiveName;
-  llvm::omp::Directive directive;
+  // GCC 9.3.0 emits a (probably) bogus warning about an unused variable.
+  [[maybe_unused]] llvm::omp::Directive directive;
   if constexpr (std::is_same_v<OpTy, mlir::omp::EnterDataOp>) {
     directiveName =
         Fortran::parser::OmpIfClause::DirectiveNameModifier::TargetEnterData;


        


More information about the flang-commits mailing list