[pypy-commit] pypy default: Update to cffi/ecf4fb44f740.

arigo noreply at buildbot.pypy.org
Fri Dec 26 17:28:50 CET 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r75126:731706d14816
Date: 2014-12-26 17:28 +0100
http://bitbucket.org/pypy/pypy/changeset/731706d14816/

Log:	Update to cffi/ecf4fb44f740.

diff --git a/pypy/module/_cffi_backend/newtype.py b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -62,9 +62,29 @@
 
 eptype("intptr_t",  rffi.INTPTR_T,  ctypeprim.W_CTypePrimitiveSigned)
 eptype("uintptr_t", rffi.UINTPTR_T, ctypeprim.W_CTypePrimitiveUnsigned)
-eptype("ptrdiff_t", rffi.INTPTR_T,  ctypeprim.W_CTypePrimitiveSigned) # <-xxx
+eptype("ptrdiff_t", rffi.PTRDIFF_T, ctypeprim.W_CTypePrimitiveSigned)
 eptype("size_t",    rffi.SIZE_T,    ctypeprim.W_CTypePrimitiveUnsigned)
 eptype("ssize_t",   rffi.SSIZE_T,   ctypeprim.W_CTypePrimitiveSigned)
+eptype("intmax_t",  rffi.INTMAX_T,  ctypeprim.W_CTypePrimitiveSigned)
+eptype("uintmax_t", rffi.UINTMAX_T, ctypeprim.W_CTypePrimitiveUnsigned)
+
+eptype("int_least8_t",  rffi.INT_LEAST8_T,  ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_least16_t", rffi.INT_LEAST16_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_least32_t", rffi.INT_LEAST32_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_least64_t", rffi.INT_LEAST64_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("uint_least8_t", rffi.UINT_LEAST8_T,  ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_least16_t",rffi.UINT_LEAST16_T, ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_least32_t",rffi.UINT_LEAST32_T, ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_least64_t",rffi.UINT_LEAST64_T, ctypeprim.W_CTypePrimitiveUnsigned)
+
+eptype("int_fast8_t",  rffi.INT_FAST8_T,  ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_fast16_t", rffi.INT_FAST16_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_fast32_t", rffi.INT_FAST32_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("int_fast64_t", rffi.INT_FAST64_T, ctypeprim.W_CTypePrimitiveSigned)
+eptype("uint_fast8_t", rffi.UINT_FAST8_T,  ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_fast16_t",rffi.UINT_FAST16_T, ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_fast32_t",rffi.UINT_FAST32_T, ctypeprim.W_CTypePrimitiveUnsigned)
+eptype("uint_fast64_t",rffi.UINT_FAST64_T, ctypeprim.W_CTypePrimitiveUnsigned)
 
 @unwrap_spec(name=str)
 def new_primitive_type(space, name):
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -2718,7 +2718,16 @@
 def test_nonstandard_integer_types():
     for typename in ['int8_t', 'uint8_t', 'int16_t', 'uint16_t', 'int32_t',
                      'uint32_t', 'int64_t', 'uint64_t', 'intptr_t',
-                     'uintptr_t', 'ptrdiff_t', 'size_t', 'ssize_t']:
+                     'uintptr_t', 'ptrdiff_t', 'size_t', 'ssize_t',
+                     'int_least8_t',  'uint_least8_t',
+                     'int_least16_t', 'uint_least16_t',
+                     'int_least32_t', 'uint_least32_t',
+                     'int_least64_t', 'uint_least64_t',
+                     'int_fast8_t',  'uint_fast8_t',
+                     'int_fast16_t', 'uint_fast16_t',
+                     'int_fast32_t', 'uint_fast32_t',
+                     'int_fast64_t', 'uint_fast64_t',
+                     'intmax_t', 'uintmax_t']:
         new_primitive_type(typename)    # works
 
 def test_cannot_convert_unicode_to_charp():
diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -461,7 +461,16 @@
 TYPES += ['signed char', 'unsigned char',
           'long long', 'unsigned long long',
           'size_t', 'time_t', 'wchar_t',
-          'uintptr_t', 'intptr_t',
+          'uintptr_t', 'intptr_t', 'ptrdiff_t',
+          'int_least8_t',  'uint_least8_t',
+          'int_least16_t', 'uint_least16_t',
+          'int_least32_t', 'uint_least32_t',
+          'int_least64_t', 'uint_least64_t',
+          'int_fast8_t',  'uint_fast8_t',
+          'int_fast16_t', 'uint_fast16_t',
+          'int_fast32_t', 'uint_fast32_t',
+          'int_fast64_t', 'uint_fast64_t',
+          'intmax_t', 'uintmax_t',
           'void*']    # generic pointer type
 
 # This is a bit of a hack since we can't use rffi_platform here.
@@ -471,7 +480,6 @@
 except CompilationError:
     pass
 
-_TYPES_ARE_UNSIGNED = set(['size_t', 'uintptr_t'])   # plus "unsigned *"
 if os.name != 'nt':
     TYPES.append('mode_t')
     TYPES.append('pid_t')
@@ -489,8 +497,10 @@
         if name.startswith('unsigned'):
             name = 'u' + name[9:]
             signed = False
+        elif name == 'size_t' or name.startswith('uint'):
+            signed = False
         else:
-            signed = (name not in _TYPES_ARE_UNSIGNED)
+            signed = True
         name = name.replace(' ', '')
         names.append(name)
         populatelist.append((name.upper(), c_name, signed))
diff --git a/rpython/rtyper/tool/rfficache.py b/rpython/rtyper/tool/rfficache.py
--- a/rpython/rtyper/tool/rfficache.py
+++ b/rpython/rtyper/tool/rfficache.py
@@ -14,7 +14,7 @@
     from rpython.translator.platform import platform
     includes = ['stdlib.h', 'stdio.h', 'sys/types.h']
     if platform.name != 'msvc':
-        includes += ['inttypes.h']
+        includes += ['inttypes.h', 'stddef.h']
     include_string = "\n".join(["#include <%s>" % i for i in includes])
     c_source = py.code.Source('''
     // includes


More information about the pypy-commit mailing list