From b882e02b51f8745b257c830cf8b61d15d1867692 Mon Sep 17 00:00:00 2001 From: Franck Dary <franck.dary@lis-lab.fr> Date: Wed, 10 Feb 2021 09:10:14 +0100 Subject: [PATCH] Fixed unused parameter warnings --- reading_machine/src/Action.cpp | 37 +++++++++++++--------------------- torch_modules/src/CNN.cpp | 2 +- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/reading_machine/src/Action.cpp b/reading_machine/src/Action.cpp index 75ca4fa..da2a3be 100644 --- a/reading_machine/src/Action.cpp +++ b/reading_machine/src/Action.cpp @@ -369,7 +369,7 @@ Action Action::addHypothesisRelativeRelaxed(const std::string & colName, Config: return addHypothesis(colName, lineIndex, "").undo(config, a); }; - auto appliable = [colName, object, relativeIndex](const Config & config, const Action & a) + auto appliable = [](const Config &, const Action &) { return true; }; @@ -487,7 +487,7 @@ Action Action::emptyStack() } }; - auto appliable = [](const Config & config, const Action &) + auto appliable = [](const Config &, const Action &) { return true; }; @@ -497,12 +497,12 @@ Action Action::emptyStack() Action Action::ignoreCurrentCharacter() { - auto apply = [](Config & config, Action & a) + auto apply = [](Config & config, Action &) { config.moveCharacterIndex(1); }; - auto undo = [](Config & config, Action & a) + auto undo = [](Config & config, Action &) { config.moveCharacterIndex(-1); }; @@ -575,7 +575,7 @@ Action Action::assertIsNotEmpty(const std::string & colName, Config::Object obje Action Action::addCharsToCol(const std::string & col, int n, Config::Object object, int relativeIndex) { - auto apply = [col, n, object, relativeIndex](Config & config, Action & a) + auto apply = [col, n, object, relativeIndex](Config & config, Action &) { auto index = config.getRelativeWordIndex(object, relativeIndex); auto & curWord = config.getLastNotEmptyHyp(col, index); @@ -591,7 +591,7 @@ Action Action::addCharsToCol(const std::string & col, int n, Config::Object obje curWord = fmt::format("{}{}", curWord, config.getLetter(config.getCharacterIndex()+i)); }; - auto undo = [col, n, object, relativeIndex](Config & config, Action & a) + auto undo = [col, n, object, relativeIndex](Config & config, Action &) { auto index = config.getRelativeWordIndex(object, relativeIndex); auto & curWord = config.getLastNotEmptyHyp(col, index); @@ -703,7 +703,7 @@ Action Action::setRoot(int bufferIndex) Action Action::updateIds(int bufferIndex) { - auto apply = [bufferIndex](Config & config, Action & a) + auto apply = [bufferIndex](Config & config, Action &) { int lineIndex = config.getRelativeWordIndex(Config::Object::Buffer, bufferIndex); int firstIndexOfSentence = -1; @@ -762,7 +762,7 @@ Action Action::updateIds(int bufferIndex) } }; - auto undo = [](Config & config, Action & a) + auto undo = [](Config &, Action &) { // TODO : undo this }; @@ -796,7 +796,7 @@ Action Action::attach(Config::Object governorObject, int governorIndex, Config:: a.data.pop_back(); }; - auto appliable = [governorObject, governorIndex, dependentObject, dependentIndex](const Config & config, const Action & action) + auto appliable = [governorObject, governorIndex, dependentObject, dependentIndex](const Config & config, const Action &) { if (!config.hasRelativeWordIndex(governorObject, governorIndex) or !config.hasRelativeWordIndex(dependentObject, dependentIndex)) return false; @@ -815,15 +815,6 @@ Action Action::attach(Config::Object governorObject, int governorIndex, Config:: if (!util::isEmpty(config.getAsFeature(Config::headColName, depLineIndex))) return false; - // Check for cycles -// while (govLineIndex != depLineIndex) -// { -// try -// { -// govLineIndex = std::stoi(config.getAsFeature(Config::headColName, govLineIndex)); -// } catch(std::exception &) {return true;} -// } - return true; }; @@ -859,7 +850,7 @@ Action Action::split(int index) Action Action::setRootUpdateIdsEmptyStackIfSentChanged() { - auto apply = [](Config & config, Action & a) + auto apply = [](Config & config, Action &) { int lineIndex = config.getWordIndex(); int rootIndex = lineIndex; @@ -934,7 +925,7 @@ Action Action::setRootUpdateIdsEmptyStackIfSentChanged() config.popStack(); }; - auto undo = [](Config & config, Action & a) + auto undo = [](Config &, Action &) { //TODO undo this }; @@ -960,7 +951,7 @@ Action Action::deprel(std::string value) addHypothesis(Config::deprelColName, config.getLastAttached(), "").undo(config, a); }; - auto appliable = [](const Config & config, const Action & action) + auto appliable = [](const Config & config, const Action &) { return config.has(0,config.getLastAttached(),0); }; @@ -1062,7 +1053,7 @@ Action Action::uppercaseIndex(std::string col, Config::Object obj, int index, in addHypothesis(col, lineIndex, fmt::format("{}", res)).apply(config, a); }; - auto undo = [col, obj, index](Config & config, Action & a) + auto undo = [col, obj, index](Config & config, Action &) { int lineIndex = config.getRelativeWordIndex(obj, index); auto & value = config.getLastNotEmptyHyp(col, lineIndex); @@ -1126,7 +1117,7 @@ Action Action::lowercaseIndex(std::string col, Config::Object obj, int index, in addHypothesis(col, lineIndex, fmt::format("{}", res)).apply(config, a); }; - auto undo = [col, obj, index](Config & config, Action & a) + auto undo = [col, obj, index](Config & config, Action &) { int lineIndex = config.getRelativeWordIndex(obj, index); auto & value = config.getLastNotEmptyHyp(col, lineIndex); diff --git a/torch_modules/src/CNN.cpp b/torch_modules/src/CNN.cpp index 2aaffec..38f656d 100644 --- a/torch_modules/src/CNN.cpp +++ b/torch_modules/src/CNN.cpp @@ -1,7 +1,7 @@ #include "CNN.hpp" #include "fmt/core.h" -CNNImpl::CNNImpl(int inputSize, int outputSize, ModuleOptions options) : outputSize(outputSize) +CNNImpl::CNNImpl(int inputSize, int outputSize, ModuleOptions) : outputSize(outputSize) { for (auto & windowSize : windowSizes) { -- GitLab