diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2020-06-23 18:05:25 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 18:05:25 +0300 |
commit | dad2fd45ec3ada550eeff1e321adce20c50af513 (patch) | |
tree | 902dc997921c5252e77a22cb0ec081bfd275d51b | |
parent | cd8646d2c3f9ad5ef6af6159c65b581813908a25 (diff) | |
parent | 3a1a636f9d78b9e068cb97d8230d16a8ff886868 (diff) |
Fix compiler warnings for gcc 9
-rw-r--r-- | GIZA++-v2/D4Tables.h | 12 | ||||
-rw-r--r-- | GIZA++-v2/Makefile | 2 | ||||
-rw-r--r-- | GIZA++-v2/TTables.h | 3 | ||||
-rw-r--r-- | GIZA++-v2/Vector.h | 7 | ||||
-rw-r--r-- | GIZA++-v2/file_spec.h | 7 | ||||
-rw-r--r-- | GIZA++-v2/hmm.cpp | 2 | ||||
-rw-r--r-- | GIZA++-v2/main.cpp | 3 | ||||
-rw-r--r-- | GIZA++-v2/model1.cpp | 2 | ||||
-rw-r--r-- | GIZA++-v2/model2.cpp | 2 | ||||
-rw-r--r-- | GIZA++-v2/model3_viterbi.cpp | 2 |
10 files changed, 17 insertions, 25 deletions
diff --git a/GIZA++-v2/D4Tables.h b/GIZA++-v2/D4Tables.h index e047bcc..868d998 100644 --- a/GIZA++-v2/D4Tables.h +++ b/GIZA++-v2/D4Tables.h @@ -92,8 +92,10 @@ class compare1 if(deps&DEP_MODEL_F){if( a.F<b.F )return 1;if( b.F<a.F )return 0;} if(deps&DEP_MODEL_E){if( a.E<b.E )return 1;if( b.E<a.E )return 0;} //if(deps&DEP_MODEL_pj){if( a.prevj<b.prevj )return 1;if( b.prevj<a.prevj )return 0;} - if(a.vacancies1<b.vacancies1)return 1;if(b.vacancies1<a.vacancies1)return 0; - if(a.vacancies2<b.vacancies2)return 1;if(b.vacancies2<a.vacancies2)return 0; + if(a.vacancies1<b.vacancies1)return 1; + if(b.vacancies1<a.vacancies1)return 0; + if(a.vacancies2<b.vacancies2)return 1; + if(b.vacancies2<a.vacancies2)return 0; return 0; } }; @@ -111,8 +113,10 @@ class compareb1 if(deps&DEP_MODELb_F){if( a.F<b.F )return 1;if( b.F<a.F )return 0;} if(deps&DEP_MODELb_E){if( a.E<b.E )return 1;if( b.E<a.E )return 0;} //if(deps&DEP_MODELb_pj){if( a.prevJ<b.prevJ )return 1;if( b.prevJ<a.prevJ )return 0;} - if(a.vacancies1<b.vacancies1)return 1;if(b.vacancies1<a.vacancies1)return 0; - if(a.vacancies2<b.vacancies2)return 1;if(b.vacancies2<a.vacancies2)return 0; + if(a.vacancies1<b.vacancies1)return 1; + if(b.vacancies1<a.vacancies1)return 0; + if(a.vacancies2<b.vacancies2)return 1; + if(b.vacancies2<a.vacancies2)return 0; return 0; } }; diff --git a/GIZA++-v2/Makefile b/GIZA++-v2/Makefile index 17daae5..a79405d 100644 --- a/GIZA++-v2/Makefile +++ b/GIZA++-v2/Makefile @@ -6,7 +6,7 @@ INSTALLDIR ?= /usr/local/bin/ CFLAGS = $(CFLAGS_GLOBAL) -Wall -Wno-parentheses #CFLAGS_OPT = $(CFLAGS) -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -O3 -DNDEBUG -DWORDINDEX_WITH_4_BYTE -ffast-math -CFLAGS_OPT = $(CFLAGS) -O3 -funroll-loops -DNDEBUG -DWORDINDEX_WITH_4_BYTE -DBINARY_SEARCH_FOR_TTABLE -DWORDINDEX_WITH_4_BYTE +CFLAGS_OPT = $(CFLAGS) -O3 -funroll-loops -DNDEBUG -DWORDINDEX_WITH_4_BYTE -DBINARY_SEARCH_FOR_TTABLE CFLAGS_PRF = $(CFLAGS) -O2 -pg -DNDEBUG -DWORDINDEX_WITH_4_BYTE CFLAGS_DBG = $(CFLAGS) -g -DDEBUG -DWORDINDEX_WITH_4_BYTE CFLAGS_NRM = $(CFLAGS) -DWORDINDEX_WITH_4_BYTE diff --git a/GIZA++-v2/TTables.h b/GIZA++-v2/TTables.h index 85673ef..73efdfd 100644 --- a/GIZA++-v2/TTables.h +++ b/GIZA++-v2/TTables.h @@ -194,7 +194,7 @@ public: { int count=0,count2=0; ifstream infile2(fn.c_str()); - int e,f,olde=-1,oldf=-1; + int e,f,olde=-1; pair<unsigned int,CPPair> cp; vector< pair<unsigned int,CPPair> > cps; while(infile2>>e>>f) @@ -216,7 +216,6 @@ public: } cps.push_back(cp); olde=e; - oldf=f; count++; } lexmat.resize(olde+1); diff --git a/GIZA++-v2/Vector.h b/GIZA++-v2/Vector.h index 96d26ad..6589233 100644 --- a/GIZA++-v2/Vector.h +++ b/GIZA++-v2/Vector.h @@ -252,12 +252,11 @@ template<class T> class Vector (*this)[maxWritten]=x; return top(); } - /* bool writeTo(ostream&out) const { out << "Vector "; out << size() << " "; - out << a << '\n'; + //out << a << '\n'; for(int iv=0;iv<=maxWritten;iv++) { writeOb(out, (*this)[iv]); @@ -265,8 +264,6 @@ template<class T> class Vector } return 1; } - */ - bool readFrom(istream&in) { string s; @@ -283,7 +280,7 @@ template<class T> class Vector } int biggest; in >> biggest; - in >> a; + //in >> a; resize(biggest); for(int iv=0;iv<size();iv++) { diff --git a/GIZA++-v2/file_spec.h b/GIZA++-v2/file_spec.h index 54fbb25..3f56e31 100644 --- a/GIZA++-v2/file_spec.h +++ b/GIZA++-v2/file_spec.h @@ -43,9 +43,10 @@ char *Get_File_Spec (){ t = time(NULL); local = localtime(&t); - sprintf(time_stmp, "%04d-%02d-%02d.%02d%02d%02d.", 1900 + local->tm_year, - (local->tm_mon + 1), local->tm_mday, local->tm_hour, - local->tm_min, local->tm_sec); + // sprintf(time_stmp, "%04d-%02d-%02d.%02d%02d%02d.", 1900 + local->tm_year, + // (local->tm_mon + 1), local->tm_mday, local->tm_hour, + // local->tm_min, local->tm_sec); + strftime(time_stmp, 19, "%Y-%m-%d.%H%M%S.", local); user = getenv("USER"); file_spec = (char *)malloc(sizeof(char) * diff --git a/GIZA++-v2/hmm.cpp b/GIZA++-v2/hmm.cpp index fc4284c..81a86b9 100644 --- a/GIZA++-v2/hmm.cpp +++ b/GIZA++-v2/hmm.cpp @@ -76,7 +76,6 @@ int hmm::em_with_tricks(int noIterations) int dumpFreq=ModelH_Dump_Freq; time_t it_st, st, it_fn, fn; string tfile, afile,afileh, number, alignfile, test_alignfile; - int pair_no = 0; bool dump_files = false ; ofstream of2 ; st = time(NULL) ; @@ -84,7 +83,6 @@ int hmm::em_with_tricks(int noIterations) cout << "\n==========================================================\n"; cout << modelName << " Training Started at: " << ctime(&st); for(int it=1; it <= noIterations ; it++){ - pair_no = 0; it_st = time(NULL) ; cout << endl << "-----------\n" << modelName << ": Iteration " << it << '\n'; dump_files = (dumpFreq != 0) && ((it % dumpFreq) == 0) && !NODUMPS; diff --git a/GIZA++-v2/main.cpp b/GIZA++-v2/main.cpp index d1b588f..7a672e6 100644 --- a/GIZA++-v2/main.cpp +++ b/GIZA++-v2/main.cpp @@ -704,12 +704,11 @@ int main(int argc, char* argv[]) printGIZAPars(cout); int a=-1; - double errors=0.0; if( OldADBACKOFF!=0 ) cerr << "WARNING: Parameter -adBackOff does not exist further; use CompactADTable instead.\n"; if( MAX_SENTENCE_LENGTH > MAX_SENTENCE_LENGTH_ALLOWED ) cerr << "ERROR: MAX_SENTENCE_LENGTH is too big " << MAX_SENTENCE_LENGTH << " > " << MAX_SENTENCE_LENGTH_ALLOWED << '\n'; - errors=StartTraining(a); + StartTraining(a); fn = time(NULL); // finish time cout << '\n' << "Entire Training took: " << difftime(fn, st1) << " seconds\n"; cout << "Program Finished at: "<< ctime(&fn) << '\n'; diff --git a/GIZA++-v2/model1.cpp b/GIZA++-v2/model1.cpp index b1b6d92..d3a9ce5 100644 --- a/GIZA++-v2/model1.cpp +++ b/GIZA++-v2/model1.cpp @@ -69,14 +69,12 @@ int model1::em_with_tricks(int noIterations, /*Perplexity& perp, sentenceHandler string modelName="Model1",shortModelName="1"; time_t st, it_st, fn, it_fn; string tfile, number, alignfile, test_alignfile; - int pair_no; bool dump_files = false ; st = time(NULL); sHandler1.rewind(); cout << "==========================================================\n"; cout << modelName << " Training Started at: "<< ctime(&st) << "\n"; for(int it = 1; it <= noIterations; it++){ - pair_no = 0 ; it_st = time(NULL); cout << "-----------\n" << modelName << ": Iteration " << it << '\n'; dump_files = (Model1_Dump_Freq != 0) && ((it % Model1_Dump_Freq) == 0) && !NODUMPS ; diff --git a/GIZA++-v2/model2.cpp b/GIZA++-v2/model2.cpp index 945b91e..d245d4e 100644 --- a/GIZA++-v2/model2.cpp +++ b/GIZA++-v2/model2.cpp @@ -61,7 +61,6 @@ int model2::em_with_tricks(int noIterations) string modelName="Model2",shortModelName="2"; time_t it_st, st, it_fn, fn; string tfile, afile, number, alignfile, test_alignfile; - int pair_no = 0; bool dump_files = false ; ofstream of2 ; st = time(NULL) ; @@ -69,7 +68,6 @@ int model2::em_with_tricks(int noIterations) cout << "\n==========================================================\n"; cout << modelName << " Training Started at: " << ctime(&st) << " iter: " << noIterations << "\n"; for(int it=1; it <= noIterations ; it++){ - pair_no = 0; it_st = time(NULL) ; cout << endl << "-----------\n" << modelName << ": Iteration " << it << '\n'; dump_files = (Model2_Dump_Freq != 0) && ((it % Model2_Dump_Freq) == 0) && !NODUMPS; diff --git a/GIZA++-v2/model3_viterbi.cpp b/GIZA++-v2/model3_viterbi.cpp index bf1e7ab..81798df 100644 --- a/GIZA++-v2/model3_viterbi.cpp +++ b/GIZA++-v2/model3_viterbi.cpp @@ -428,7 +428,6 @@ void model3::findAlignmentsNeighborhood(Vector<WordIndex>& es, WordIndex i,j,l,m,old_i,j1; Vector<WordIndex> A(fs.size(),0); Vector<WordIndex> Fert(es.size(),0); - time_t it_st; best_score = 0 ; l = es.size() - 1; @@ -466,7 +465,6 @@ void model3::findAlignmentsNeighborhood(Vector<WordIndex>& es, cerr << "Condition violated : 2 * Fert[0] <= m " << 2*Fert[0] <<"?"<< m << "\n"; } // end of added code for debugging // Yaser - it_st = time(NULL) ; // Now find add all neighbors of the best alignmet to the collection for (j = 1 ; j <= m ; j++){ |