[flang-commits] [flang] b7d1271 - [Flang] Fix build failures (NFC)

Andrzej Warzynski via flang-commits flang-commits at lists.llvm.org
Fri Oct 30 04:51:21 PDT 2020


Author: Andrzej Warzynski
Date: 2020-10-30T11:50:13Z
New Revision: b7d1271a01b72a079ea016a9d4e31a73091d5f0e

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

LOG: [Flang] Fix build failures (NFC)

Some changes introduced in https://reviews.llvm.org/D88655 cause compiler
warnings. Since in Flang warnings are treated as errors (`-Werror` is on by
default), these are in practice compiler errors (verified with clang-10 and
clang-11, gcc-10). This patches fixes these warning/failures.

Warning/error 1:
```
llvm-project/flang/lib/Semantics/check-omp-structure.cpp:107:3: error:
unannotated fall-through between switch labels [-Werror,-Wimplicit-fallthrough]
```

Warning/error 2:
```
llvm-project/flang/lib/Semantics/check-directive-structure.h:39:9: error: field
'currentDirective_' will be initialized after field 'upperCaseDirName_'
[-Werror,-Wreorder-ctor]
```

Failing buildbot:
* http://lab.llvm.org:8011/#/builders/33/builds/386

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/check-directive-structure.h b/flang/lib/Semantics/check-directive-structure.h
index 1de0b3b9d26b..29996a75823d 100644
--- a/flang/lib/Semantics/check-directive-structure.h
+++ b/flang/lib/Semantics/check-directive-structure.h
@@ -36,8 +36,8 @@ template <typename D> class NoBranchingEnforce {
       parser::CharBlock sourcePosition, D directive,
       std::string &&upperCaseDirName)
       : context_{context}, sourcePosition_{sourcePosition},
-        currentDirective_{directive}, upperCaseDirName_{
-                                          std::move(upperCaseDirName)} {}
+        upperCaseDirName_{std::move(upperCaseDirName)}, currentDirective_{
+                                                            directive} {}
   template <typename T> bool Pre(const T &) { return true; }
   template <typename T> void Post(const T &) {}
 

diff  --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index 583021b5c701..a5b935ed2173 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -104,6 +104,7 @@ void OmpStructureChecker::Enter(const parser::OpenMPBlockConstruct &x) {
   switch (beginDir.v) {
   case llvm::omp::OMPD_parallel:
     CheckNoBranching(block, llvm::omp::OMPD_parallel, beginDir.source);
+    break;
   default:
     break;
   }


        


More information about the flang-commits mailing list