From 3457c494850bd1e5b08d039380d5673c5d95e24f Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Oct 2016 14:26:04 -0700 Subject: [PATCH 1/4] Remove unused strstream header --- src/bed2vector.cpp | 1 - src/maqread.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/bed2vector.cpp b/src/bed2vector.cpp index 63e9499..ea45033 100644 --- a/src/bed2vector.cpp +++ b/src/bed2vector.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/src/maqread.cpp b/src/maqread.cpp index 896068f..862839b 100644 --- a/src/maqread.cpp +++ b/src/maqread.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include #include From 7bb9f6a408a13e6badb2df6cc3bae1b926d3b442 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Oct 2016 15:03:55 -0700 Subject: [PATCH 2/4] Rename hash_* to ordered_* The template was renamed when it was standardized, and the old names are deprecated by gcc 6.1 --- src/bed2vector.cpp | 52 +++++++++++++++++++++++----------------------- src/maqread.cpp | 4 ++-- src/pc.h | 15 ++----------- 3 files changed, 30 insertions(+), 41 deletions(-) diff --git a/src/bed2vector.cpp b/src/bed2vector.cpp index ea45033..6ff86fe 100644 --- a/src/bed2vector.cpp +++ b/src/bed2vector.cpp @@ -114,7 +114,7 @@ SEXP read_bed_ends(SEXP filename) { vector< vector > pos; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; typedef boost::tokenizer > tokType; @@ -159,7 +159,7 @@ SEXP read_bed_ends(SEXP filename) { } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -250,7 +250,7 @@ SEXP read_meland_old(SEXP filename) { vector< vector > poslen; // length // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -292,7 +292,7 @@ SEXP read_meland_old(SEXP filename) { int fpos=atoi(str_pos.c_str()); // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -428,7 +428,7 @@ SEXP read_meland_old(SEXP filename) { vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -472,7 +472,7 @@ SEXP read_meland_old(SEXP filename) { int fpos=atoi(str_pos.c_str()); // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -620,7 +620,7 @@ SEXP read_eland_mismatches(SEXP filename) { vector< vector > mm2; // position of the second mismatch // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -688,7 +688,7 @@ SEXP read_eland_mismatches(SEXP filename) { } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -813,7 +813,7 @@ SEXP read_eland_mismatches(SEXP filename) { vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -864,7 +864,7 @@ SEXP read_eland_mismatches(SEXP filename) { } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -1000,7 +1000,7 @@ SEXP read_eland_mismatches(SEXP filename) { vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -1074,7 +1074,7 @@ SEXP read_eland_mismatches(SEXP filename) { } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -1209,7 +1209,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -1362,7 +1362,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -1496,7 +1496,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -1571,7 +1571,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -1710,7 +1710,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -1788,7 +1788,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ int nm=atoi(str_ndel.c_str())+atoi(str_nins.c_str())+atoi(str_nsub.c_str()); // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -1937,7 +1937,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -1980,7 +1980,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ } // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -2115,7 +2115,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > posnm; // number of mismatches // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -2157,7 +2157,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ int nm=atoi(str_qual.c_str()); // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -2266,7 +2266,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > posnm; // number of mismatches // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -2325,7 +2325,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome @@ -2437,7 +2437,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ vector< vector > poslen; // length of the match // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -2526,7 +2526,7 @@ SEXP read_eland_multi(SEXP filename,SEXP read_tag_names_R,SEXP eland_tag_length_ // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome diff --git a/src/maqread.cpp b/src/maqread.cpp index 862839b..5b3d6b9 100644 --- a/src/maqread.cpp +++ b/src/maqread.cpp @@ -54,7 +54,7 @@ extern "C" { vector< vector > tagnames; // chromosome map - hash_map,equal_to > cind_map; + unordered_map,equal_to > cind_map; vector cnames; @@ -88,7 +88,7 @@ extern "C" { // determine the chromosome index - hash_map,equal_to >::const_iterator li=cind_map.find(chr); + unordered_map,equal_to >::const_iterator li=cind_map.find(chr); int cind=-1; if(li==cind_map.end()) { // register new chromosome diff --git a/src/pc.h b/src/pc.h index 3611c97..b77cd4a 100644 --- a/src/pc.h +++ b/src/pc.h @@ -1,17 +1,6 @@ #ifndef PC_H #define PC_H 1 #include -#include - -namespace __gnu_cxx -{ - template<> struct hash< std::string > - { - size_t operator()( const std::string& x ) const - { - return hash< const char* >()( x.c_str() ); - } - }; -} - +#include +#include #endif From fec09937a79b142855f549ebd6da0f7175f8f0d8 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Oct 2016 15:05:10 -0700 Subject: [PATCH 3/4] Remove using namespace __gnu_cxx since the maps and sets are now standard there's no need to use a gcc specific namespace --- src/bed2vector.cpp | 1 - src/maqread.cpp | 1 - src/peaks.cpp | 1 - src/wdl.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/src/bed2vector.cpp b/src/bed2vector.cpp index 6ff86fe..f0e5f00 100644 --- a/src/bed2vector.cpp +++ b/src/bed2vector.cpp @@ -30,7 +30,6 @@ ssize_t getline_local(char **lineptr, size_t *n, FILE *stream); } using namespace std; -using namespace __gnu_cxx; class lessAbsoluteValue { diff --git a/src/maqread.cpp b/src/maqread.cpp index 5b3d6b9..999f07d 100644 --- a/src/maqread.cpp +++ b/src/maqread.cpp @@ -19,7 +19,6 @@ extern "C" { } using namespace std; -using namespace __gnu_cxx; class lessAbsoluteValue { diff --git a/src/peaks.cpp b/src/peaks.cpp index 37770d5..b55824f 100644 --- a/src/peaks.cpp +++ b/src/peaks.cpp @@ -14,7 +14,6 @@ extern "C" { } using namespace std; -using namespace __gnu_cxx; /** * Calculate all local peaks diff --git a/src/wdl.cpp b/src/wdl.cpp index 18a2258..fd4f1c1 100644 --- a/src/wdl.cpp +++ b/src/wdl.cpp @@ -14,7 +14,6 @@ extern "C" { } using namespace std; -using namespace __gnu_cxx; //#define DEBUG 1 From c2780c4ab193c385da20b2dc50d459c9b13f6ee0 Mon Sep 17 00:00:00 2001 From: Diane Trout Date: Wed, 12 Oct 2016 15:09:08 -0700 Subject: [PATCH 4/4] add -std=c++11 so gcc 5 provides unordered_* --- src/Makevars.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Makevars.in b/src/Makevars.in index 61631ba..8f3085b 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -1,4 +1,3 @@ PKG_LIBS=@LIBS@ -lz -PKG_CFLAGS=-I./ -D_FASTMAP -DMAQ_LONGREADS @HAVE_LIBBZ2@ -PKG_CXXFLAGS=-I./ -D_FASTMAP -DMAQ_LONGREADS @HAVE_LIBBZ2@ @BOOST_CPPFLAGS@ - +PKG_CFLAGS=-I./ -D_FASTMAP -DMAQ_LONGREADS -std=c++11 @HAVE_LIBBZ2@ +PKG_CXXFLAGS=-I./ -D_FASTMAP -DMAQ_LONGREADS -std=c++11 @HAVE_LIBBZ2@ @BOOST_CPPFLAGS@