[flang-commits] [flang] 9168fca - [flang] Fix -Wcovered-switch-default in resolve-directives.cpp (NFC)

Jie Fu via flang-commits flang-commits at lists.llvm.org
Thu Sep 7 16:55:21 PDT 2023


Author: Jie Fu
Date: 2023-09-08T07:53:53+08:00
New Revision: 9168fcacd8b3e3e4f17b12d4ea37dd7038c53640

URL: https://github.com/llvm/llvm-project/commit/9168fcacd8b3e3e4f17b12d4ea37dd7038c53640
DIFF: https://github.com/llvm/llvm-project/commit/9168fcacd8b3e3e4f17b12d4ea37dd7038c53640.diff

LOG: [flang] Fix -Wcovered-switch-default in resolve-directives.cpp (NFC)

/data/llvm-project/flang/lib/Semantics/resolve-directives.cpp:555:7: error: default label in switch which covers all enumeration values [-Werror,-Wcovered-switch-default]
      default:
      ^
1 error generated.

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-directives.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-directives.cpp b/flang/lib/Semantics/resolve-directives.cpp
index 38beae33f40e95..8c3cc844f322c6 100644
--- a/flang/lib/Semantics/resolve-directives.cpp
+++ b/flang/lib/Semantics/resolve-directives.cpp
@@ -533,23 +533,23 @@ class OmpAttributeVisitor : DirectiveAttributeVisitor<llvm::omp::Directive> {
     if (const auto &maptype{std::get<std::optional<parser::OmpMapType>>(x.t)}) {
       using Type = parser::OmpMapType::Type;
       const Type &type{std::get<Type>(maptype->t)};
-      switch (type) {
-      case Type::To:
+      switch ((uint32_t)type) { // Avoid -Wcovered-switch-default
+      case (uint32_t)Type::To:
         ompFlag = Symbol::Flag::OmpMapTo;
         break;
-      case Type::From:
+      case (uint32_t)Type::From:
         ompFlag = Symbol::Flag::OmpMapFrom;
         break;
-      case Type::Tofrom:
+      case (uint32_t)Type::Tofrom:
         ompFlag = Symbol::Flag::OmpMapToFrom;
         break;
-      case Type::Alloc:
+      case (uint32_t)Type::Alloc:
         ompFlag = Symbol::Flag::OmpMapAlloc;
         break;
-      case Type::Release:
+      case (uint32_t)Type::Release:
         ompFlag = Symbol::Flag::OmpMapRelease;
         break;
-      case Type::Delete:
+      case (uint32_t)Type::Delete:
         ompFlag = Symbol::Flag::OmpMapDelete;
         break;
       default:


        


More information about the flang-commits mailing list