From 7375d81e163d3c706302150d6bb3f07f7dda0db5 Mon Sep 17 00:00:00 2001 From: Phil Williams Date: Fri, 27 Nov 2015 12:20:38 +0000 Subject: [PATCH] Fix a few compiler warnings (clang) --- moses/BitmapContainer.cpp | 8 ++++---- moses/ChartHypothesis.cpp | 1 - moses/ChartHypothesisCollection.h | 2 +- moses/FF/StatefulFeatureFunction.h | 2 +- moses/FF/StatelessFeatureFunction.h | 2 +- moses/Hypothesis.h | 2 +- moses/LM/BilingualLM.cpp | 2 -- moses/Search.cpp | 4 ++-- moses/SearchNormal.cpp | 1 - moses/Sentence.cpp | 1 - moses/Syntax/F2S/HyperPathLoader.cpp | 7 ------- moses/Syntax/F2S/HyperPathLoader.h | 4 ---- moses/Syntax/F2S/HyperTreeLoader.cpp | 6 ++---- moses/Syntax/T2S/RuleTrieLoader.cpp | 4 +--- moses/TargetPhrase.cpp | 2 +- moses/TranslationOptionCollection.cpp | 1 - 16 files changed, 14 insertions(+), 35 deletions(-) diff --git a/moses/BitmapContainer.cpp b/moses/BitmapContainer.cpp index 64a607045..c1823b33d 100644 --- a/moses/BitmapContainer.cpp +++ b/moses/BitmapContainer.cpp @@ -57,8 +57,8 @@ private: public: HypothesisScoreOrdererWithDistortion(const Range* transOptRange, const bool deterministic = false) - : m_transOptRange(transOptRange) - , m_deterministic(deterministic) { + : m_deterministic(deterministic) + , m_transOptRange(transOptRange) { m_totalWeightDistortion = 0; const StaticData &staticData = StaticData::Instance(); @@ -128,8 +128,8 @@ BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer , m_parent(parent) , m_translations(translations) , m_estimatedScores(estimatedScores) - , m_seenPosition() , m_deterministic(deterministic) + , m_seenPosition() { // If either dimension is empty, we haven't got anything to do. @@ -294,8 +294,8 @@ BitmapContainer::BitmapContainer(const Bitmap &bitmap , bool deterministic) : m_bitmap(bitmap) , m_stack(stack) - , m_deterministic(deterministic) , m_numStackInsertions(0) + , m_deterministic(deterministic) { m_hypotheses = HypothesisSet(); m_edges = BackwardsEdgeSet(); diff --git a/moses/ChartHypothesis.cpp b/moses/ChartHypothesis.cpp index 9143be715..c99aec45e 100644 --- a/moses/ChartHypothesis.cpp +++ b/moses/ChartHypothesis.cpp @@ -257,7 +257,6 @@ void ChartHypothesis::CleanupArcList() * so we'll keep all of arc list if nedd distinct n-best list */ AllOptions const& opts = StaticData::Instance().options(); - const StaticData &staticData = StaticData::Instance(); size_t nBestSize = opts.nbest.nbest_size; bool distinctNBest = (opts.nbest.only_distinct || opts.mbr.enabled diff --git a/moses/ChartHypothesisCollection.h b/moses/ChartHypothesisCollection.h index 666037f24..c5fe7bf2b 100644 --- a/moses/ChartHypothesisCollection.h +++ b/moses/ChartHypothesisCollection.h @@ -29,7 +29,7 @@ namespace Moses { class ChartSearchGraphWriter; -class AllOptions; +struct AllOptions; //! functor to compare (chart) hypotheses by (descending) score class ChartHypothesisScoreOrderer diff --git a/moses/FF/StatefulFeatureFunction.h b/moses/FF/StatefulFeatureFunction.h index 5c8c2bbd6..cafa2c469 100644 --- a/moses/FF/StatefulFeatureFunction.h +++ b/moses/FF/StatefulFeatureFunction.h @@ -10,7 +10,7 @@ class FFState; namespace Syntax { -class SHyperedge; +struct SHyperedge; } /** base class for all stateful feature functions. diff --git a/moses/FF/StatelessFeatureFunction.h b/moses/FF/StatelessFeatureFunction.h index 8cd754583..a364a811f 100644 --- a/moses/FF/StatelessFeatureFunction.h +++ b/moses/FF/StatelessFeatureFunction.h @@ -8,7 +8,7 @@ namespace Moses namespace Syntax { -class SHyperedge; +struct SHyperedge; } /** base class for all stateless feature functions. diff --git a/moses/Hypothesis.h b/moses/Hypothesis.h index cd26f5a2d..129d241f3 100644 --- a/moses/Hypothesis.h +++ b/moses/Hypothesis.h @@ -50,7 +50,7 @@ class FFState; class StatelessFeatureFunction; class StatefulFeatureFunction; class Manager; -class ReportingOptions; +struct ReportingOptions; typedef std::vector ArcList; diff --git a/moses/LM/BilingualLM.cpp b/moses/LM/BilingualLM.cpp index b8974bb5e..f7c36a4e8 100644 --- a/moses/LM/BilingualLM.cpp +++ b/moses/LM/BilingualLM.cpp @@ -248,8 +248,6 @@ void BilingualLM::getAllAlignments(const ChartHypothesis& cur_hypo, size_t featu int source_word_mid_idx; //The word alignment //Get source sent - const ChartManager& manager = cur_hypo.GetManager(); - const Sentence& source_sent = static_cast(manager.GetSource()); const AlignmentInfo& alignments = targetPhrase.GetAlignTerm(); // get absolute position in source sentence for each source word in rule diff --git a/moses/Search.cpp b/moses/Search.cpp index ac2e46343..8579ad152 100644 --- a/moses/Search.cpp +++ b/moses/Search.cpp @@ -10,11 +10,11 @@ namespace Moses Search::Search(Manager& manager, const InputType &source) : m_manager(manager) , m_source(source) + , m_options(manager.options()) , m_inputPath() , m_initialTransOpt() - , m_options(manager.options()) - , interrupted_flag(0) , m_bitmaps(source.GetSize(), source.m_sourceCompleted) + , interrupted_flag(0) { m_initialTransOpt.SetInputPath(m_inputPath); } diff --git a/moses/SearchNormal.cpp b/moses/SearchNormal.cpp index bca49a6af..be92525d9 100644 --- a/moses/SearchNormal.cpp +++ b/moses/SearchNormal.cpp @@ -293,7 +293,6 @@ void SearchNormal::ExpandHypothesis(const Hypothesis &hypothesis, float estimatedScore, const Bitmap &bitmap) { - const StaticData &staticData = StaticData::Instance(); SentenceStats &stats = m_manager.GetSentenceStats(); Hypothesis *newHypo; diff --git a/moses/Sentence.cpp b/moses/Sentence.cpp index 0ba6a2012..2b6367f71 100644 --- a/moses/Sentence.cpp +++ b/moses/Sentence.cpp @@ -324,7 +324,6 @@ std::vector Sentence:: GetXmlChartTranslationOptions(AllOptions const& opts) const { - const StaticData &staticData = StaticData::Instance(); std::vector ret; // XML Options diff --git a/moses/Syntax/F2S/HyperPathLoader.cpp b/moses/Syntax/F2S/HyperPathLoader.cpp index 9ae2c731f..4d4d677c3 100644 --- a/moses/Syntax/F2S/HyperPathLoader.cpp +++ b/moses/Syntax/F2S/HyperPathLoader.cpp @@ -9,13 +9,6 @@ namespace Syntax namespace F2S { -HyperPathLoader::HyperPathLoader(FactorDirection direction, - const std::vector &factorOrder) - : m_direction(direction) - , m_factorOrder(factorOrder) -{ -} - void HyperPathLoader::Load(const StringPiece &s, HyperPath &path) { path.nodeSeqs.clear(); diff --git a/moses/Syntax/F2S/HyperPathLoader.h b/moses/Syntax/F2S/HyperPathLoader.h index 3a3586a8e..120ed1b8e 100644 --- a/moses/Syntax/F2S/HyperPathLoader.h +++ b/moses/Syntax/F2S/HyperPathLoader.h @@ -30,8 +30,6 @@ namespace F2S class HyperPathLoader { public: - HyperPathLoader(FactorDirection, const std::vector &); - void Load(const StringPiece &, HyperPath &); private: @@ -58,8 +56,6 @@ private: return FactorCollection::Instance().AddFactor(s, true); } - FactorDirection m_direction; - const std::vector &m_factorOrder; std::vector m_tokenSeq; std::vector m_nodeTupleSeq; std::stack m_parentStack; diff --git a/moses/Syntax/F2S/HyperTreeLoader.cpp b/moses/Syntax/F2S/HyperTreeLoader.cpp index d5ef65c5e..03305a017 100644 --- a/moses/Syntax/F2S/HyperTreeLoader.cpp +++ b/moses/Syntax/F2S/HyperTreeLoader.cpp @@ -60,7 +60,7 @@ bool HyperTreeLoader::Load(const std::vector &input, double_conversion::StringToDoubleConverter converter(double_conversion::StringToDoubleConverter::NO_FLAGS, NAN, NAN, "inf", "nan"); - HyperPathLoader hyperPathLoader(Input, input); + HyperPathLoader hyperPathLoader; Phrase dummySourcePhrase; { @@ -87,9 +87,7 @@ bool HyperTreeLoader::Load(const std::vector &input, alignString = temp; } - if (++pipes) { - StringPiece str(*pipes); //counts - } + ++pipes; // counts scoreVector.clear(); for (util::TokenIter s(scoreString, " \t"); s; ++s) { diff --git a/moses/Syntax/T2S/RuleTrieLoader.cpp b/moses/Syntax/T2S/RuleTrieLoader.cpp index 71d4b24d0..bcfcc819e 100644 --- a/moses/Syntax/T2S/RuleTrieLoader.cpp +++ b/moses/Syntax/T2S/RuleTrieLoader.cpp @@ -77,9 +77,7 @@ bool RuleTrieLoader::Load(const std::vector &input, alignString = temp; } - if (++pipes) { - StringPiece str(*pipes); //counts - } + ++pipes; // counts bool isLHSEmpty = (sourcePhraseString.find_first_not_of(" \t", 0) == std::string::npos); if (isLHSEmpty && !staticData.IsWordDeletionEnabled()) { diff --git a/moses/TargetPhrase.cpp b/moses/TargetPhrase.cpp index 94e733aca..f416fdaa7 100644 --- a/moses/TargetPhrase.cpp +++ b/moses/TargetPhrase.cpp @@ -135,8 +135,8 @@ TargetPhrase::TargetPhrase(const TargetPhrase ©) , m_scoreBreakdown(copy.m_scoreBreakdown) , m_alignTerm(copy.m_alignTerm) , m_alignNonTerm(copy.m_alignNonTerm) - , m_properties(copy.m_properties) , m_scope(copy.m_scope) + , m_properties(copy.m_properties) , m_container(copy.m_container) { if (copy.m_lhsTarget) { diff --git a/moses/TranslationOptionCollection.cpp b/moses/TranslationOptionCollection.cpp index 302b5ba81..1e729b6ad 100644 --- a/moses/TranslationOptionCollection.cpp +++ b/moses/TranslationOptionCollection.cpp @@ -173,7 +173,6 @@ TranslationOptionCollection:: ProcessOneUnknownWord(const InputPath &inputPath, size_t sourcePos, size_t length, const ScorePair *inputScores) { - const StaticData &staticData = StaticData::Instance(); const UnknownWordPenaltyProducer& unknownWordPenaltyProducer = UnknownWordPenaltyProducer::Instance(); float unknownScore = FloorScore(TransformScore(0));