Skip to content

Commit

Permalink
Revert "c++11"
Browse files Browse the repository at this point in the history
This reverts commit a4991cf.
  • Loading branch information
mr-c committed Sep 15, 2014
1 parent a4991cf commit 1292fa7
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 47 deletions.
13 changes: 6 additions & 7 deletions Makefile
Expand Up @@ -4,7 +4,7 @@
# and documentation
# make coverage-report to check coverage of the python scripts by the tests

CPPSOURCES=$(wildcard lib/*.cc lib/*.hh khmer/_khmermodule.cc) setup.py
CPPSOURCES=$(wildcard lib/*.cc lib/*.hh khmer/_khmermodule.cc)
PYSOURCES=$(wildcard khmer/*.py scripts/*.py)
SOURCES=$(PYSOURCES) $(CPPSOURCES) setup.py
DEVPKGS=sphinxcontrib-autoprogram pep8==1.5 diff_cover \
Expand All @@ -24,8 +24,7 @@ khmer/_khmermodule.so: $(CPPSOURCES)
./setup.py build_ext --inplace

coverage-debug: $(CPPSOURCES)
export CFLAGS="-pg -fprofile-arcs -ftest-coverage -O0 \
-D_GLIBCXX_DEBUG_PEDANTIC -D_GLIBCXX_DEBUG"; ./setup.py \
export CFLAGS="-pg -fprofile-arcs -ftest-coverage -O0"; ./setup.py \
build_ext --debug --inplace --libraries gcov
touch coverage-debug

Expand All @@ -47,8 +46,8 @@ clean: FORCE
rm -Rf .coverage || true

debug: FORCE
export CFLAGS="-pg -fprofile-arcs -D_GLIBCXX_DEBUG_PEDANTIC \
-D_GLIBCXX_DEBUG"; python setup.py build_ext --debug --inplace
export CFLAGS="-pg -fprofile-arcs"; python setup.py build_ext --debug \
--inplace

doc: build/sphinx/html/index.html

Expand All @@ -69,13 +68,13 @@ build/sphinx/latex/khmer.pdf: $(SOURCES) doc/conf.py $(wildcard doc/*.txt)
cppcheck-result.xml: $(CPPSOURCES)
ls lib/*.cc khmer/_khmermodule.cc | grep -v test | cppcheck -DNDEBUG \
-DVERSION=0.0.cppcheck -UNO_UNIQUE_RC --enable=all \
--file-list=- -j8 --platform=unix64 --std=c++11 --xml \
--file-list=- -j8 --platform=unix64 --std=posix --xml \
--xml-version=2 2> cppcheck-result.xml

cppcheck: $(CPPSOURCES)
ls lib/*.cc khmer/_khmermodule.cc | grep -v test | cppcheck -DNDEBUG \
-DVERSION=0.0.cppcheck -UNO_UNIQUE_RC --enable=all \
--file-list=- -j8 --platform=unix64 --std=c++11 --quiet
--file-list=- -j8 --platform=unix64 --std=posix --quiet

pep8: $(PYSOURCES) $(wildcard tests/*.py)
pep8 --exclude=_version.py setup.py khmer/ scripts/ tests/ || true
Expand Down
4 changes: 2 additions & 2 deletions lib/counting.cc
Expand Up @@ -228,12 +228,12 @@ void CountingHash::fasta_dump_kmers_by_abundance(
for (unsigned int i = 0; i < seq.length() - _ksize + 1; i++) {
string kmer = seq.substr(i, i + _ksize);
BoundedCounterType n = get_count(kmer.c_str());
char * ss = new char[_ksize + 1];
char ss[_ksize + 1];
strncpy(ss, kmer.c_str(), _ksize);
ss[_ksize] = 0;

if (n == limit_by_count) {
cout << &ss << endl;
cout << ss << endl;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/counting.hh
Expand Up @@ -271,7 +271,7 @@ class CountingHashGzFileWriter : public CountingHashFile
public:
CountingHashGzFileWriter(const std::string &outfilename, const CountingHash &ht);
};
}
};

#endif // COUNTING_HH

Expand Down
2 changes: 1 addition & 1 deletion lib/hashbits.hh
Expand Up @@ -229,7 +229,7 @@ public:
return 1;
}
};
}
};

#include "counting.hh"
#include "labelhash.hh"
Expand Down
2 changes: 1 addition & 1 deletion lib/hashtable.hh
Expand Up @@ -559,7 +559,7 @@ public:
return kmer_degree(kmer_f, kmer_r);
}
};
}
};



Expand Down
2 changes: 1 addition & 1 deletion lib/kmer_hash.cc
Expand Up @@ -94,4 +94,4 @@ std::string _revhash(HashIntoType hash, WordLength k)
}


}
};
2 changes: 1 addition & 1 deletion lib/kmer_hash.hh
Expand Up @@ -73,6 +73,6 @@ HashIntoType _hash(const char * kmer, const WordLength k,
HashIntoType _hash_forward(const char * kmer, WordLength k);

std::string _revhash(HashIntoType hash, WordLength k);
}
};

#endif // KMER_HASH_HH
2 changes: 1 addition & 1 deletion lib/labelhash.hh
Expand Up @@ -147,7 +147,7 @@ public:
LabelPtrSet& found_labels);

};
}
};

#define ACQUIRE_TAG_COLORS_SPIN_LOCK \
while(!__sync_bool_compare_and_swap( &_tag_labels_spin_lock, 0, 1));
Expand Down
34 changes: 10 additions & 24 deletions lib/read_parsers.cc
Expand Up @@ -8,7 +8,6 @@
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <stdexcept>

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -1593,15 +1592,10 @@ _parse_read( ParserState &state, Read &the_read )
);
#endif
the_read.bytes_consumed += (line.length( ) + 1);
try {
if ('>' != line.at(0))
throw InvalidFASTAFileFormat(
"invalid sequence name indicator", line.c_str( )
);
}
catch (std::out_of_range oor) {
throw InvalidFASTAFileFormat("invalid sequence name identifiter", line.c_str( ) );
}
if ('>' != line[ 0 ])
throw InvalidFASTAFileFormat(
"invalid sequence name indicator", line.c_str( )
);
the_read.name = line.substr( 1 );

// Grab sequence lines until exit conditions are met.
Expand All @@ -1616,11 +1610,8 @@ _parse_read( ParserState &state, Read &the_read )
#endif

// If a new record is detected, then existing one is complete.
try {
if ('>' == line.at(0)) {
break;
}
} catch (std::out_of_range oor) {
if ('>' == line[ 0 ]) {
break;
}

// TODO? Uppercase and validate entire sequence here.
Expand Down Expand Up @@ -1670,15 +1661,10 @@ _parse_read( ParserState &state, Read &the_read )
);
#endif
the_read.bytes_consumed += (line.length( ) + 1);
try {
if ('@' != line.at(0))
throw InvalidFASTQFileFormat(
"invalid sequence name indicator", line.c_str( )
);
} catch (std::out_of_range oor) {
throw InvalidFASTQFileFormat("invalid sequence name indicator",
line.c_str() );
}
if ('@' != line[ 0 ])
throw InvalidFASTQFileFormat(
"invalid sequence name indicator", line.c_str( )
);
the_read.name = line.substr( 1 );

// Grab sequence lines until exit conditions are met.
Expand Down
15 changes: 8 additions & 7 deletions lib/subset.cc
Expand Up @@ -1623,12 +1623,12 @@ unsigned long long SubsetPartition::repartition_largest_partition(

// find biggest.
PartitionCountDistribution::const_iterator di = d.end();
if (di == d.begin()) {
--di;

if (d.empty()) {
throw khmer_exception();
}

--di;

for (PartitionCountMap::const_iterator cmi = cm.begin(); cmi != cm.end();
++cmi) {
if (cmi->second == di->first) {
Expand All @@ -1641,13 +1641,14 @@ unsigned long long SubsetPartition::repartition_largest_partition(

#if VERBOSE_REPARTITION
std::cout << "biggest partition: " << di->first << "\n";
#endif // 0
--di;

#if VERBOSE_REPARTITION
std::cout << "biggest partition ID: " << biggest_p << "\n";
#endif // 0

if (di != d.begin()) {
--di;
next_largest = di->first;
}
next_largest = di->first;

#if VERBOSE_REPARTITION
std::cout << "next biggest partition: " << di->first << "\n";
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -57,7 +57,7 @@
"read_parsers", "kmer_hash", "hashtable", "hashbits", "labelhash",
"counting", "subset", "read_aligner"])

EXTRA_COMPILE_ARGS = ['-O3', '-std=c++0x', '-pedantic' ]
EXTRA_COMPILE_ARGS = ['-O3']

if sys.platform == 'darwin':
EXTRA_COMPILE_ARGS.extend(['-arch', 'x86_64']) # force 64bit only builds
Expand Down

0 comments on commit 1292fa7

Please sign in to comment.