pytries / datrie

Fast, efficiently stored Trie for Python. Uses libdatrie.
http://pypi.python.org/pypi/datrie/
GNU Lesser General Public License v2.1
530 stars 88 forks source link

src/datrie.c pointer-type warnings vs datrie/alpha-map.h #57

Open dmacks opened 5 years ago

dmacks commented 5 years ago

Building datrie-0.7.1 for python2.7 on OS X 10.13 using Debian's patch for external libdatrie-0.2.12 I get some compiler warnings.

gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -fwrapv -O3 -Wall -Wstrict-prototypes -I/sw/include -I/sw/include/python2.7 -c src/datrie.c -o build/temp.macosx-10.13-x86_64-2.7/src/datrie.o
src/datrie.c:2821:36: warning: incompatible pointer types passing
      'struct AlphaMap *' to parameter of type 'const AlphaMap *' (aka 'const
      struct _AlphaMap *') [-Wincompatible-pointer-types]
  __pyx_v_self->_c_trie = trie_new(__pyx_v_alpha_map->_c_alpha_map);
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/datrie/trie.h:120:35: note: passing argument to parameter
      'alpha_map' here
Trie *  trie_new (const AlphaMap *alpha_map);
                                  ^
src/datrie.c:3399:30: warning: incompatible pointer types passing
      'struct AlphaMap *' to parameter of type 'const AlphaMap *' (aka 'const
      struct _AlphaMap *') [-Wincompatible-pointer-types]
  __pyx_v__c_trie = trie_new(__pyx_v_alpha_map->_c_alpha_map);
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/datrie/trie.h:120:35: note: passing argument to parameter
      'alpha_map' here
Trie *  trie_new (const AlphaMap *alpha_map);
                                  ^
src/datrie.c:19997:30: warning: incompatible pointer types assigning to
      'struct AlphaMap *' from 'AlphaMap *' (aka 'struct _AlphaMap *')
      [-Wincompatible-pointer-types]
  __pyx_v_self->_c_alpha_map = alpha_map_new();
                             ^ ~~~~~~~~~~~~~~~
src/datrie.c:20054:20: warning: incompatible pointer types passing
      'struct AlphaMap *' to parameter of type 'AlphaMap *' (aka
      'struct _AlphaMap *') [-Wincompatible-pointer-types]
    alpha_map_free(__pyx_v_self->_c_alpha_map);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/datrie/alpha-map.h:72:39: note: passing argument to parameter
      'alpha_map' here
void        alpha_map_free (AlphaMap *alpha_map);
                                      ^
src/datrie.c:20445:49: warning: incompatible pointer types passing
      'struct AlphaMap *' to parameter of type 'const AlphaMap *' (aka 'const
      struct _AlphaMap *') [-Wincompatible-pointer-types]
  __pyx_v_clone->_c_alpha_map = alpha_map_clone(__pyx_v_self->_c_alpha_map);
                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/datrie/alpha-map.h:70:46: note: passing argument to parameter
      'a_map' here
AlphaMap *  alpha_map_clone (const AlphaMap *a_map);
                                             ^
src/datrie.c:20445:31: warning: incompatible pointer types assigning to
      'struct AlphaMap *' from 'AlphaMap *' (aka 'struct _AlphaMap *')
      [-Wincompatible-pointer-types]
  __pyx_v_clone->_c_alpha_map = alpha_map_clone(__pyx_v_self->_c_alpha_map);
                              ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/datrie.c:20987:38: warning: incompatible pointer types passing
      'struct AlphaMap *' to parameter of type 'AlphaMap *' (aka
      'struct _AlphaMap *') [-Wincompatible-pointer-types]
  __pyx_v_code = alpha_map_add_range(__pyx_v_self->_c_alpha_map, __pyx_v...
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
/sw/include/datrie/alpha-map.h:74:45: note: passing argument to parameter
      'alpha_map' here
int         alpha_map_add_range (AlphaMap  *alpha_map,
                                            ^
7 warnings generated.

I see no relevant differences between the lib's public headers installed on my system and the same files in datrie's copy of it. Sorry, I don't know a thing about python glue code to begin to solve this myself. But if there's anything specific you'd like me to try, let me know.