[Flang] Fix build failures (NFC)
authorAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 30 Oct 2020 11:27:04 +0000 (11:27 +0000)
committerAndrzej Warzynski <andrzej.warzynski@arm.com>
Fri, 30 Oct 2020 11:50:13 +0000 (11:50 +0000)
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

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

index 1de0b3b..29996a7 100644 (file)
@@ -36,8 +36,8 @@ public:
       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 &) {}
 
index 583021b..a5b935e 100644 (file)
@@ -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;
   }