From 2859980cb46aa1db8f5bf04dda1020477ed7a3ce Mon Sep 17 00:00:00 2001 From: Markus Blatt Date: Fri, 12 Apr 2019 13:26:33 +0200 Subject: [PATCH] Removes nearly all warnings experienced with g++-8.3 Namely: - unused parameter - type qualifiers ignored ... - catchinhg polymorphic type ... by value --- examples/msim.cpp | 2 +- msim/src/msim.cpp | 4 ++-- src/opm/output/eclipse/AggregateGroupData.cpp | 12 ++++++------ src/opm/output/eclipse/AggregateMSWData.cpp | 2 +- src/opm/output/eclipse/AggregateWellData.cpp | 2 +- .../EclipseState/Schedule/ArrayDimChecker.cpp | 4 ++-- .../eclipse/EclipseState/Schedule/RFTConfig.cpp | 2 +- .../eclipse/EclipseState/Tables/Rock2dTable.cpp | 2 +- .../eclipse/EclipseState/Tables/Rock2dtrTable.cpp | 2 +- src/opm/parser/eclipse/Parser/Parser.cpp | 2 +- tests/msim/test_msim.cpp | 4 ++-- tests/msim/test_msim_ACTIONX.cpp | 12 ++++++------ tests/test_AggregateConnectionData.cpp | 2 +- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/msim.cpp b/examples/msim.cpp index cc297e498..9d5b2d8b5 100644 --- a/examples/msim.cpp +++ b/examples/msim.cpp @@ -30,7 +30,7 @@ #include -int main(int argc, char** argv) { +int main(int /* argc */, char** argv) { std::string deck_file = argv[1]; Opm::Parser parser; Opm::ParseContext parse_context; diff --git a/msim/src/msim.cpp b/msim/src/msim.cpp index fbe7bdddb..8416599ed 100644 --- a/msim/src/msim.cpp +++ b/msim/src/msim.cpp @@ -51,7 +51,7 @@ void msim::run(Schedule& schedule, EclipseIO& io) { } -void msim::post_step(Schedule& schedule, data::Solution& sol, data::Wells& well_data, size_t report_step, EclipseIO& io) const { +void msim::post_step(Schedule& schedule, data::Solution& /* sol */, data::Wells& /* well_data */, size_t report_step, EclipseIO& io) const { const auto& actions = schedule.actions(); if (actions.empty()) return; @@ -98,7 +98,7 @@ void msim::run_step(const Schedule& schedule, data::Solution& sol, data::Wells& -void msim::output(size_t report_step, bool substep, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const { +void msim::output(size_t report_step, bool /* substep */, double seconds_elapsed, const data::Solution& sol, const data::Wells& well_data, EclipseIO& io) const { RestartValue value(sol, well_data); io.writeTimeStep(report_step, false, diff --git a/src/opm/output/eclipse/AggregateGroupData.cpp b/src/opm/output/eclipse/AggregateGroupData.cpp index 33c53bdda..a56fa873f 100644 --- a/src/opm/output/eclipse/AggregateGroupData.cpp +++ b/src/opm/output/eclipse/AggregateGroupData.cpp @@ -53,9 +53,9 @@ namespace { return inteHead[19]; } - const int groupType(const Opm::Schedule& sched, + int groupType(const Opm::Schedule& sched, const Opm::Group& group, - const std::size_t simStep) + std::size_t simStep) { const std::string& groupName = group.name(); if (!sched.hasGroup(groupName)) @@ -118,7 +118,7 @@ namespace { return groupIndexMap; } - const int currentGroupLevel(const Opm::Schedule& sched, const Opm::Group& group, const size_t simStep) + int currentGroupLevel(const Opm::Schedule& sched, const Opm::Group& group, size_t simStep) { int level = 0; const std::vector< const Opm::Group* > groups = sched.getGroups(simStep); @@ -462,8 +462,8 @@ namespace { void Opm::RestartIO::Helpers::groupMaps:: currentGrpTreeNameSeqIndMap(const Opm::Schedule& sched, - const size_t simStep, - const std::map& GnIMap, + size_t simStep, + const std::map& /* GnIMap */, const std::map& IGMap) { const auto& grpTreeNSIMap = (sched.getGroupTree(simStep)).nameSeqIndMap(); @@ -545,7 +545,7 @@ captureDeclaredGroupData(const Opm::Schedule& sched, // Define Static Contributions to SGrp Array. groupLoop(curGroups, - [this](const Group& group, const std::size_t groupID) -> void + [this](const Group& /* group */, std::size_t groupID) -> void { auto sw = this->sGroup_[groupID]; SGrp::staticContrib(sw); diff --git a/src/opm/output/eclipse/AggregateMSWData.cpp b/src/opm/output/eclipse/AggregateMSWData.cpp index ccce63548..12c15401e 100644 --- a/src/opm/output/eclipse/AggregateMSWData.cpp +++ b/src/opm/output/eclipse/AggregateMSWData.cpp @@ -416,7 +416,7 @@ namespace { void staticContrib(const Opm::Well& well, const std::size_t rptStep, const std::vector& inteHead, - const Opm::EclipseGrid& grid, + const Opm::EclipseGrid& /* grid */, ISegArray& iSeg ) { diff --git a/src/opm/output/eclipse/AggregateWellData.cpp b/src/opm/output/eclipse/AggregateWellData.cpp index 0dd719355..3b23cdabb 100644 --- a/src/opm/output/eclipse/AggregateWellData.cpp +++ b/src/opm/output/eclipse/AggregateWellData.cpp @@ -265,7 +265,7 @@ namespace { const std::size_t msWellID, const std::map & GroupMapNameInd, /*const std::vector& groupNames,*/ - const int maxGroups, + const int /* maxGroups */, const std::size_t sim_step, IWellArray& iWell) { diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp index 556a24c31..f67904600 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/ArrayDimChecker.cpp @@ -41,7 +41,7 @@ namespace { const Opm::ParseContext& ctxt, Opm::ErrorGuard& guard) { - const auto nWells = sched.numWells(); + auto nWells = sched.numWells(); if (nWells > static_cast(wdims.maxWellsInField())) { @@ -83,7 +83,7 @@ namespace { const Opm::ParseContext& ctxt, Opm::ErrorGuard& guard) { - const auto nGroups = sched.numGroups(); + auto nGroups = sched.numGroups(); // Note: "1 +" to account for FIELD group being in 'sched.numGroups()' // but excluded from WELLDIMS(3). diff --git a/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp b/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp index 96abc8e59..ecbbc0ba5 100644 --- a/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp +++ b/src/opm/parser/eclipse/EclipseState/Schedule/RFTConfig.cpp @@ -150,7 +150,7 @@ std::size_t RFTConfig::firstRFTOutput() const { for (const auto& rft_pair : this->plt_config) { const auto& dynamic_state = rft_pair.second; - auto pred = [] (const std::pair& elm) { return false; }; + auto pred = [] (const std::pair& ) { return false; }; int this_first_rft = dynamic_state.find_if(pred); if (this_first_rft >= 0) first_rft = std::min(first_rft, static_cast(this_first_rft)); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp index 8455df30c..f26c6be11 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/Rock2dTable.cpp @@ -29,7 +29,7 @@ namespace Opm { { } - void Rock2dTable::init(const DeckRecord& record, size_t tableIdx) + void Rock2dTable::init(const DeckRecord& record, size_t /* tableIdx */) { m_pressureValues.push_back(record.getItem("PRESSURE").getSIDoubleData()[0]); m_pvmultValues.push_back(record.getItem("PVMULT").getSIDoubleData()); diff --git a/src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp b/src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp index 0fbb883b4..668eca378 100644 --- a/src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp +++ b/src/opm/parser/eclipse/EclipseState/Tables/Rock2dtrTable.cpp @@ -29,7 +29,7 @@ namespace Opm { { } - void Rock2dtrTable::init(const DeckRecord& record, size_t tableIdx) + void Rock2dtrTable::init(const DeckRecord& record, size_t /* tableIdx */) { m_pressureValues.push_back(record.getItem("PRESSURE").getSIDoubleData()[0]); m_transMultValues.push_back(record.getItem("TRANSMULT").getSIDoubleData()); diff --git a/src/opm/parser/eclipse/Parser/Parser.cpp b/src/opm/parser/eclipse/Parser/Parser.cpp index 44aa32bee..19c78fbd2 100644 --- a/src/opm/parser/eclipse/Parser/Parser.cpp +++ b/src/opm/parser/eclipse/Parser/Parser.cpp @@ -322,7 +322,7 @@ void ParserState::loadFile(const boost::filesystem::path& inputFile) { boost::filesystem::path inputFileCanonical; try { inputFileCanonical = boost::filesystem::canonical(inputFile); - } catch (boost::filesystem::filesystem_error fs_error) { + } catch (const boost::filesystem::filesystem_error& fs_error) { std::string msg = "Could not open file: " + inputFile.string(); parseContext.handleError( ParseContext::PARSE_MISSING_INCLUDE , msg, errors); return; diff --git a/tests/msim/test_msim.cpp b/tests/msim/test_msim.cpp index 2ca190bc3..449be4b80 100644 --- a/tests/msim/test_msim.cpp +++ b/tests/msim/test_msim.cpp @@ -44,12 +44,12 @@ using namespace Opm; -double prod_opr(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_opr(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double seconds_elapsed) { const auto& units = es.getUnits(); return -units.to_si(UnitSystem::measure::rate, seconds_elapsed); } -void pressure(const EclipseState& es, const Schedule& sched, data::Solution& sol, size_t report_step, double seconds_elapsed) { +void pressure(const EclipseState& es, const Schedule& /* sched */, data::Solution& sol, size_t /* report_step */, double seconds_elapsed) { const auto& grid = es.getInputGrid(); const auto& units = es.getUnits(); if (!sol.has("PRESSURE")) diff --git a/tests/msim/test_msim_ACTIONX.cpp b/tests/msim/test_msim_ACTIONX.cpp index 8c5d33b0c..0825ab938 100644 --- a/tests/msim/test_msim_ACTIONX.cpp +++ b/tests/msim/test_msim_ACTIONX.cpp @@ -66,25 +66,25 @@ struct test_data { }; -double prod_opr(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_opr(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double oil_rate = 1.0; return -units.to_si(UnitSystem::measure::rate, oil_rate); } -double prod_opr_low(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_opr_low(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double oil_rate = 0.5; return -units.to_si(UnitSystem::measure::rate, oil_rate); } -double prod_wpr_P1(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_wpr_P1(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double water_rate = 0.0; return -units.to_si(UnitSystem::measure::rate, water_rate); } -double prod_wpr_P2(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_wpr_P2(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t report_step, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double water_rate = 0.0; if (report_step > 5) @@ -93,13 +93,13 @@ double prod_wpr_P2(const EclipseState& es, const Schedule& sched, const data::S return -units.to_si(UnitSystem::measure::rate, water_rate); } -double prod_wpr_P3(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_wpr_P3(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t /* report_step */, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double water_rate = 0.0; return -units.to_si(UnitSystem::measure::rate, water_rate); } -double prod_wpr_P4(const EclipseState& es, const Schedule& sched, const data::Solution& sol, size_t report_step, double seconds_elapsed) { +double prod_wpr_P4(const EclipseState& es, const Schedule& /* sched */, const data::Solution& /* sol */, size_t report_step, double /* seconds_elapsed */) { const auto& units = es.getUnits(); double water_rate = 0.0; if (report_step > 10) diff --git a/tests/test_AggregateConnectionData.cpp b/tests/test_AggregateConnectionData.cpp index 53e8546ec..c7543f961 100644 --- a/tests/test_AggregateConnectionData.cpp +++ b/tests/test_AggregateConnectionData.cpp @@ -71,7 +71,7 @@ struct MockIH MockIH::MockIH(const int numWells, const int nsegWell, - const int ncwMax, + const int /* ncwMax */, const int iConnPerConn, const int sConnPerConn, const int xConnPerConn)