Ram101 / marisa-trie

Automatically exported from code.google.com/p/marisa-trie
Other
0 stars 0 forks source link

hardcoded archtecture list for word size #22

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This is reported in debian.
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=739126

Could you consider apply a patch or use stdint.h method?

---from---
marisa fails to build from source on s390x due to testsuite failures. It
appears that it uses an hardcoded list of architectures to determine the
size of a size_t type, which doesn't include s390x. The patch below
fixes the issue:

--- marisa-0.2.4.orig/lib/marisa/base.h
+++ marisa-0.2.4/lib/marisa/base.h
@@ -30,7 +30,7 @@ typedef uint64_t marisa_uint64;

 #if defined(_WIN64) || defined(__amd64__) || defined(__x86_64__) || \
     defined(__ia64__) || defined(__ppc64__) || defined(__powerpc64__) || \
-    defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__)
+    defined(__sparc64__) || defined(__mips64__) || defined(__aarch64__) || 
defined(__s390x__)
  #define MARISA_WORD_SIZE 64
 #else  // defined(_WIN64), etc.
  #define MARISA_WORD_SIZE 32

BTW, __sparc64__ doesn't exist and should be replaced by (__sparc__ && 
__arch64__)

That said, I don't really see the point of using an hardcoded
architecture list to determine the size of a size_t type. This can be
done the following way:

| #include <stdint.h>
|
| #if SIZE_MAX == UINT64_MAX
|  #define MARISA_WORD_SIZE 64
| #else
|  #define MARISA_WORD_SIZE 32
| #endif

However as marisa is using autotools, the best way to do that would be
to add a test in configure.
------

Original issue reported on code.google.com by mty.shib...@gmail.com on 22 Feb 2014 at 5:28

GoogleCodeExporter commented 9 years ago
Adding a check to configure will make life harder for 
https://github.com/kmike/marisa-trie Python wrapper because it doesn't use 
autotools (it relies on Python's distutils).

Original comment by kmik...@gmail.com on 24 Apr 2014 at 7:42