Small syntatic fixes.

This commit is contained in:
Davi Reis 2014-03-23 22:51:31 -03:00
parent c113674a89
commit 91ad6123ad
10 changed files with 67 additions and 7 deletions

View File

@ -4,5 +4,6 @@ pkgconfig_DATA = cmph.pc
if USE_CXXMPH if USE_CXXMPH
pkgconfig_DATA += cxxmph.pc pkgconfig_DATA += cxxmph.pc
endif endif
ACLOCAL_AMFLAGS="-I m4"
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig

View File

@ -40,7 +40,7 @@ if test x$cxxmph = xtrue; then
AC_COMPILE_STDCXX_0X AC_COMPILE_STDCXX_0X
if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; then if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; then
if test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then if test x$ac_cv_cxx_compile_cxx0x_cxx = "xyes"; then
CXXFLAGS="$CXXFLAGS -std=c++0x" CXXFLAGS="$CXXFLAGS -std=c++11"
elif test x$ac_cv_cxx_compile_cxx0x_gxx = "xyes"; then elif test x$ac_cv_cxx_compile_cxx0x_gxx = "xyes"; then
CXXFLAGS="$CXXFLAGS -std=gnu++0x" CXXFLAGS="$CXXFLAGS -std=gnu++0x"
else else

58
cxxmph/.ycm_extra_conf.py Normal file
View File

@ -0,0 +1,58 @@
import os
import ycm_core
flags = [
'-Wall',
'-Wextra',
'-Werror',
'-DNDEBUG',
'-DUSE_CLANG_COMPLETER',
'-std=c++11',
'-x',
'c++',
'-isystem'
'/usr/lib/c++/v1',
'-I',
'.',
]
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def FlagsForFile( filename ):
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}

View File

@ -12,7 +12,7 @@ using cxxmph::hollow_iterator_base;
using cxxmph::make_hollow; using cxxmph::make_hollow;
using cxxmph::is_empty; using cxxmph::is_empty;
int main(int argc, char** argv) { int main(int, char**) {
vector<int> v; vector<int> v;
vector<bool> p; vector<bool> p;
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i) {

View File

@ -44,7 +44,7 @@ class dynamic_2bitset {
other.data_.swap(data_); other.data_.swap(data_);
} }
void clear() { data_.clear(); size_ = 0; } void clear() { data_.clear(); size_ = 0; }
uint32_t size() const { return size_; } uint32_t size() const { return size_; }
static const uint8_t vmask[]; static const uint8_t vmask[];
const std::vector<uint8_t>& data() const { return data_; } const std::vector<uint8_t>& data() const { return data_; }

View File

@ -39,6 +39,7 @@ namespace cxxmph {
MPHIndex::~MPHIndex() { MPHIndex::~MPHIndex() {
clear(); clear();
} }
void MPHIndex::clear() { void MPHIndex::clear() {

View File

@ -238,7 +238,7 @@ MPH_MAP_INLINE_METHOD_DECL(my_int32_t, index)(const key_type& k) const {
MPH_MAP_METHOD_DECL(data_type&, operator[])(const key_type& k) { MPH_MAP_METHOD_DECL(data_type&, operator[])(const key_type& k) {
return insert(make_pair(k, data_type())).first->second; return insert(make_pair(k, data_type())).first->second;
} }
MPH_MAP_METHOD_DECL(void_type, rehash)(size_type nbuckets) { MPH_MAP_METHOD_DECL(void_type, rehash)(size_type /*nbuckets*/) {
pack(); pack();
vector<value_type>(values_.begin(), values_.end()).swap(values_); vector<value_type>(values_.begin(), values_.end()).swap(values_);
vector<bool>(present_.begin(), present_.end()).swap(present_); vector<bool>(present_.begin(), present_.end()).swap(present_);

View File

@ -15,7 +15,7 @@ namespace cxxmph {
struct h128 { struct h128 {
const uint32_t& operator[](uint8_t i) const { return uint32[i]; } const uint32_t& operator[](uint8_t i) const { return uint32[i]; }
uint32_t& operator[](uint8_t i) { return uint32[i]; } uint32_t& operator[](uint8_t i) { return uint32[i]; }
const uint64_t get64(bool second) const { return (static_cast<uint64_t>(uint32[second << 1]) << 32) | uint32[1 + (second << 1)]; } uint64_t get64(bool second) const { return (static_cast<uint64_t>(uint32[second << 1]) << 32) | uint32[1 + (second << 1)]; }
void set64(uint64_t v, bool second) { uint32[second << 1] = v >> 32; uint32[1+(second<<1)] = ((v << 32) >> 32); } void set64(uint64_t v, bool second) { uint32[second << 1] = v >> 32; uint32[1+(second<<1)] = ((v << 32) >> 32); }
bool operator==(const h128 rhs) const { return memcmp(uint32, rhs.uint32, sizeof(uint32)) == 0; } bool operator==(const h128 rhs) const { return memcmp(uint32, rhs.uint32, sizeof(uint32)) == 0; }

View File

@ -1,6 +1,6 @@
noinst_PROGRAMS = vector_adapter_ex1 file_adapter_ex2 struct_vector_adapter_ex3 small_set_ex4 noinst_PROGRAMS = vector_adapter_ex1 file_adapter_ex2 struct_vector_adapter_ex3 small_set_ex4
INCLUDES = -I../src/ AM_CPPFLAGS = -I../src/
vector_adapter_ex1_LDADD = ../src/libcmph.la vector_adapter_ex1_LDADD = ../src/libcmph.la
vector_adapter_ex1_SOURCES = vector_adapter_ex1.c vector_adapter_ex1_SOURCES = vector_adapter_ex1.c

View File

@ -2,7 +2,7 @@ TESTS = $(check_PROGRAMS)
check_PROGRAMS = graph_tests select_tests compressed_seq_tests compressed_rank_tests cmph_benchmark_test check_PROGRAMS = graph_tests select_tests compressed_seq_tests compressed_rank_tests cmph_benchmark_test
noinst_PROGRAMS = packed_mphf_tests mphf_tests noinst_PROGRAMS = packed_mphf_tests mphf_tests
INCLUDES = -I../src/ AM_CPPFLAGS = -I../src/
graph_tests_SOURCES = graph_tests.c graph_tests_SOURCES = graph_tests.c
graph_tests_LDADD = ../src/libcmph.la graph_tests_LDADD = ../src/libcmph.la