components/python/cffi/patches/s11.patch
author Danek Duvall <danek.duvall@oracle.com>
Tue, 29 Apr 2014 13:36:04 -0700
branchs11-update
changeset 3113 49fd14223e17
permissions -rw-r--r--
PSARC/2014/110 CFFI: foreign function interface for Python calling C code 18468609 integrate cffi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3113
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     1
This patch contains some workarounds specially needed for Solaris 11.
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     2
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     3
Due to
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     4
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     5
    18617452 SIZEOF_WCHAR_T undefined in pyconfig.h on 11.2
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     6
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     7
SIZEOF_WCHAR_T isn't ever defined, leading to poor support of wchar_t and
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     8
unicode.  Defining that constant prior to including wchar_helper.h helps
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     9
work around most of the resulting test failures.
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    10
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    11
In Solaris 12, libnsl has been turned into a filter library for libc, and
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    12
symbols like inet_ntoa are available directly from libc.  But this has not
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    13
happened in Solaris 11, so opening libnsl is required in order to find that
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    14
particular symbol.
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    15
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    16
--- cffi-0.8.2/c/_cffi_backend.c	2014-03-06 22:51:56.000000000 -0800
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    17
+++ cffi-0.8.2/c/_cffi_backend.c	2014-04-17 15:46:17.277512131 -0700
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    18
@@ -219,6 +219,7 @@ static void init_errno(void) { }
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    19
 # include "file_emulator.h"
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    20
 #endif
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    21
 
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    22
+#define SIZEOF_WCHAR_T 4
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    23
 #ifdef HAVE_WCHAR_H
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    24
 # include "wchar_helper.h"
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    25
 #endif
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    26
--- cffi-0.8.2/testing/test_function.py	2014-03-06 22:51:56.000000000 -0800
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    27
+++ cffi-0.8.2/testing/test_function.py	2014-04-17 13:37:51.091873904 -0700
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    28
@@ -286,7 +286,7 @@ class TestFunction(object):
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    29
             struct in_addr { unsigned int s_addr; };
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    30
             char *inet_ntoa(struct in_addr in);
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    31
         """)
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    32
-        ffi.C = ffi.dlopen(None)
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    33
+        ffi.C = ffi.dlopen("nsl")
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    34
         ina = ffi.new("struct in_addr *", [0x04040404])
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    35
         a = ffi.C.inet_ntoa(ina[0])
49fd14223e17 PSARC/2014/110 CFFI: foreign function interface for Python calling C code
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    36
         assert ffi.string(a) == b'4.4.4.4'