From 91ad6123adcf86c663320b636b58a09c50d6042b Mon Sep 17 00:00:00 2001 From: Davi Reis Date: Sun, 23 Mar 2014 22:51:31 -0300 Subject: [PATCH] Small syntatic fixes. --- Makefile.am | 1 + configure.ac | 2 +- cxxmph/.ycm_extra_conf.py | 58 ++++++++++++++++++++++++++++++++++ cxxmph/hollow_iterator_test.cc | 2 +- cxxmph/mph_bits.h | 2 +- cxxmph/mph_index.cc | 1 + cxxmph/mph_map.h | 2 +- cxxmph/seeded_hash.h | 2 +- examples/Makefile.am | 2 +- tests/Makefile.am | 2 +- 10 files changed, 67 insertions(+), 7 deletions(-) create mode 100644 cxxmph/.ycm_extra_conf.py diff --git a/Makefile.am b/Makefile.am index aaae22b..cdc3a23 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,5 +4,6 @@ pkgconfig_DATA = cmph.pc if USE_CXXMPH pkgconfig_DATA += cxxmph.pc endif +ACLOCAL_AMFLAGS="-I m4" pkgconfigdir = $(libdir)/pkgconfig diff --git a/configure.ac b/configure.ac index fd51246..b0c7e08 100644 --- a/configure.ac +++ b/configure.ac @@ -40,7 +40,7 @@ if test x$cxxmph = xtrue; then AC_COMPILE_STDCXX_0X if test x$ac_cv_cxx_compile_cxx0x_native = "xno"; 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 CXXFLAGS="$CXXFLAGS -std=gnu++0x" else diff --git a/cxxmph/.ycm_extra_conf.py b/cxxmph/.ycm_extra_conf.py new file mode 100644 index 0000000..91da0a6 --- /dev/null +++ b/cxxmph/.ycm_extra_conf.py @@ -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 + } diff --git a/cxxmph/hollow_iterator_test.cc b/cxxmph/hollow_iterator_test.cc index de235c0..b3647dd 100644 --- a/cxxmph/hollow_iterator_test.cc +++ b/cxxmph/hollow_iterator_test.cc @@ -12,7 +12,7 @@ using cxxmph::hollow_iterator_base; using cxxmph::make_hollow; using cxxmph::is_empty; -int main(int argc, char** argv) { +int main(int, char**) { vector v; vector p; for (int i = 0; i < 100; ++i) { diff --git a/cxxmph/mph_bits.h b/cxxmph/mph_bits.h index 3a3bb47..eab677e 100644 --- a/cxxmph/mph_bits.h +++ b/cxxmph/mph_bits.h @@ -44,7 +44,7 @@ class dynamic_2bitset { other.data_.swap(data_); } void clear() { data_.clear(); size_ = 0; } - + uint32_t size() const { return size_; } static const uint8_t vmask[]; const std::vector& data() const { return data_; } diff --git a/cxxmph/mph_index.cc b/cxxmph/mph_index.cc index fba852e..f5be3dd 100644 --- a/cxxmph/mph_index.cc +++ b/cxxmph/mph_index.cc @@ -39,6 +39,7 @@ namespace cxxmph { MPHIndex::~MPHIndex() { clear(); + } void MPHIndex::clear() { diff --git a/cxxmph/mph_map.h b/cxxmph/mph_map.h index db81233..5948348 100644 --- a/cxxmph/mph_map.h +++ b/cxxmph/mph_map.h @@ -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) { 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(); vector(values_.begin(), values_.end()).swap(values_); vector(present_.begin(), present_.end()).swap(present_); diff --git a/cxxmph/seeded_hash.h b/cxxmph/seeded_hash.h index 1204b6f..162521d 100644 --- a/cxxmph/seeded_hash.h +++ b/cxxmph/seeded_hash.h @@ -15,7 +15,7 @@ namespace cxxmph { struct h128 { const uint32_t& operator[](uint8_t i) const { return uint32[i]; } uint32_t& operator[](uint8_t i) { return uint32[i]; } - const uint64_t get64(bool second) const { return (static_cast(uint32[second << 1]) << 32) | uint32[1 + (second << 1)]; } + uint64_t get64(bool second) const { return (static_cast(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); } bool operator==(const h128 rhs) const { return memcmp(uint32, rhs.uint32, sizeof(uint32)) == 0; } diff --git a/examples/Makefile.am b/examples/Makefile.am index 69593d8..df5763f 100755 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,6 @@ 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_SOURCES = vector_adapter_ex1.c diff --git a/tests/Makefile.am b/tests/Makefile.am index 361c67b..285ff37 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,7 +2,7 @@ TESTS = $(check_PROGRAMS) check_PROGRAMS = graph_tests select_tests compressed_seq_tests compressed_rank_tests cmph_benchmark_test noinst_PROGRAMS = packed_mphf_tests mphf_tests -INCLUDES = -I../src/ +AM_CPPFLAGS = -I../src/ graph_tests_SOURCES = graph_tests.c graph_tests_LDADD = ../src/libcmph.la