From 0e96269737f75f7565c1484072b9a0eeea324f21 Mon Sep 17 00:00:00 2001 From: Eric Schweitz Date: Fri, 15 Mar 2019 11:35:18 -0700 Subject: [PATCH] [flang] muzzle clang++ warnings 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 | 16 ++++++++-------- flang/lib/FIR/statements.h | 5 ++--- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/flang/lib/FIR/afforestation.cc b/flang/lib/FIR/afforestation.cc index ff7fdf5..1842497 100644 --- a/flang/lib/FIR/afforestation.cc +++ b/flang/lib/FIR/afforestation.cc @@ -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 &refs) { auto &cases{ std::get>(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( result.defLab, result.values, result.labels); return result; @@ -1308,8 +1308,8 @@ public: const std::vector &refs) { auto &ranks{std::get>( 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( selectRankConstruct)}) { (void)name; // get rid of warning @@ -1324,8 +1324,8 @@ public: const std::vector &refs) { auto &types{std::get>( 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( selectTypeConstruct)}) { (void)name; // get rid of warning diff --git a/flang/lib/FIR/statements.h b/flang/lib/FIR/statements.h index eaf5862..dc8c1f2 100644 --- a/flang/lib/FIR/statements.h +++ b/flang/lib/FIR/statements.h @@ -581,9 +581,8 @@ public: } std::string dump() const; - static constexpr std::size_t offsetof_impl() { - Statement *s{nullptr}; - return reinterpret_cast(&s->u) - reinterpret_cast(s); + static std::size_t offsetof_impl() { + return reinterpret_cast(&static_cast(nullptr)->u); } static Statement *From(Stmt_impl *stmt) { return reinterpret_cast( -- 2.7.4