[flang] muzzle clang++ warnings
authorEric Schweitz <eschweitz@nvidia.com>
Fri, 15 Mar 2019 18:35:18 +0000 (11:35 -0700)
committerEric Schweitz <eschweitz@nvidia.com>
Fri, 15 Mar 2019 18:35:18 +0000 (11:35 -0700)
Original-commit: flang-compiler/f18@02decb4040e4e7c57a6404adef17215ce8f276a5
Reviewed-on: https://github.com/flang-compiler/f18/pull/334
Tree-same-pre-rewrite: false

flang/lib/FIR/afforestation.cc
flang/lib/FIR/statements.h

index ff7fdf5..1842497 100644 (file)
@@ -1270,7 +1270,7 @@ public:
     return builder_->CreateExpr(ExprRef(x.thing));
   }
   SwitchArguments ComposeSwitchArgs(const LinearSwitch &op) {
-    SwitchArguments result{NOTHING, unspecifiedLabel, {}, op.refs};
+    SwitchArguments result{{NOTHING, unspecifiedLabel, {}, op.refs}};
     std::visit(
         common::visitors{
             [&](const parser::ComputedGotoStmt *c) {
@@ -1296,9 +1296,9 @@ public:
       const std::vector<LinearLabelRef> &refs) {
     auto &cases{
         std::get<std::list<parser::CaseConstruct::Case>>(caseConstruct->t)};
-    SwitchCaseArguments result{GetSwitchCaseSelector(caseConstruct),
-        unspecifiedLabel, populateSwitchValues(builder_, cases),
-        std::move(refs)};
+    SwitchCaseArguments result{
+        {GetSwitchCaseSelector(caseConstruct), unspecifiedLabel,
+            populateSwitchValues(builder_, cases), std::move(refs)}};
     cleanupSwitchPairs<SwitchCaseStmt>(
         result.defLab, result.values, result.labels);
     return result;
@@ -1308,8 +1308,8 @@ public:
       const std::vector<LinearLabelRef> &refs) {
     auto &ranks{std::get<std::list<parser::SelectRankConstruct::RankCase>>(
         selectRankConstruct->t)};
-    SwitchRankArguments result{GetSwitchRankSelector(selectRankConstruct),
-        unspecifiedLabel, populateSwitchValues(ranks), std::move(refs)};
+    SwitchRankArguments result{{GetSwitchRankSelector(selectRankConstruct),
+        unspecifiedLabel, populateSwitchValues(ranks), std::move(refs)}};
     if (auto &name{GetSwitchAssociateName<parser::SelectRankStmt>(
             selectRankConstruct)}) {
       (void)name;  // get rid of warning
@@ -1324,8 +1324,8 @@ public:
       const std::vector<LinearLabelRef> &refs) {
     auto &types{std::get<std::list<parser::SelectTypeConstruct::TypeCase>>(
         selectTypeConstruct->t)};
-    SwitchTypeArguments result{GetSwitchTypeSelector(selectTypeConstruct),
-        unspecifiedLabel, populateSwitchValues(types), std::move(refs)};
+    SwitchTypeArguments result{{GetSwitchTypeSelector(selectTypeConstruct),
+        unspecifiedLabel, populateSwitchValues(types), std::move(refs)}};
     if (auto &name{GetSwitchAssociateName<parser::SelectTypeStmt>(
             selectTypeConstruct)}) {
       (void)name;  // get rid of warning
index eaf5862..dc8c1f2 100644 (file)
@@ -581,9 +581,8 @@ public:
   }
   std::string dump() const;
 
-  static constexpr std::size_t offsetof_impl() {
-    Statement *s{nullptr};
-    return reinterpret_cast<char *>(&s->u) - reinterpret_cast<char *>(s);
+  static std::size_t offsetof_impl() {
+    return reinterpret_cast<std::size_t>(&static_cast<Statement *>(nullptr)->u);
   }
   static Statement *From(Stmt_impl *stmt) {
     return reinterpret_cast<Statement *>(