Fix ABI check regression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
diff --git a/Makefile.in b/Makefile.in
index 6bf6cc5..799a0e2 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -403,7 +403,6 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
diff --git a/configure b/configure
index cec095b..f4c3e30 100755
--- a/configure
+++ b/configure
@@ -14395,7 +14395,7 @@ case "$target" in
$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h
;;
- *-apple-darwin1[10]* | *-*-freebsd* | *-*-kfreebsd* | *-*-openbsd* | *-pc-solaris*)
+ *-apple-darwin1[10]* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*)
$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h
diff --git a/doc/libffi.info b/doc/libffi.info
index c0fb005..402f760 100644
--- a/doc/libffi.info
+++ b/doc/libffi.info
@@ -1,10 +1,10 @@
-This is /home/green/libffi/doc/libffi.info, produced by makeinfo
-version 4.13 from /home/green/libffi/doc/libffi.texi.
+This is ../libffi/doc/libffi.info, produced by makeinfo version 4.13
+from ../libffi/doc/libffi.texi.
This manual is for Libffi, a portable foreign-function interface
library.
- Copyright (C) 2008, 2010 Red Hat, Inc.
+ Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License as
@@ -27,7 +27,7 @@ libffi
This manual is for Libffi, a portable foreign-function interface
library.
- Copyright (C) 2008, 2010 Red Hat, Inc.
+ Copyright (C) 2008, 2010, 2011 Red Hat, Inc.
Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License as
@@ -115,8 +115,6 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
want. *note Multiple ABIs:: for more information.
NARGS is the number of arguments that this function accepts.
- `libffi' does not yet handle varargs functions; see *note Missing
- Features:: for more information.
RTYPE is a pointer to an `ffi_type' structure that describes the
return type of the function. *Note Types::.
@@ -129,6 +127,30 @@ To prepare a call interface object, use the function `ffi_prep_cif'.
properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is
incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid.
+ If the function being called is variadic (varargs) then
+`ffi_prep_cif_var' must be used instead of `ffi_prep_cif'.
+
+ -- Function: ffi_status ffi_prep_cif_var (ffi_cif *CIF, ffi_abi
+ varabi, unsigned int NFIXEDARGS, unsigned int varntotalargs,
+ ffi_type *RTYPE, ffi_type **ARGTYPES)
+ This initializes CIF according to the given parameters for a call
+ to a variadic function. In general it's operation is the same as
+ for `ffi_prep_cif' except that:
+
+ NFIXEDARGS is the number of fixed arguments, prior to any variadic
+ arguments. It must be greater than zero.
+
+ NTOTALARGS the total number of arguments, including variadic and
+ fixed arguments.
+
+ Note that, different cif's must be prepped for calls to the same
+ function when different numbers of arguments are passed.
+
+ Also note that a call to `ffi_prep_cif_var' with
+ NFIXEDARGS=NOTOTALARGS is NOT equivalent to a call to
+ `ffi_prep_cif'.
+
+
To call a function using an initialized `ffi_cif', use the
`ffi_call' function:
@@ -511,9 +533,7 @@ File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi,
`libffi' is missing a few features. We welcome patches to add support
for these.
- * There is no support for calling varargs functions. This may work
- on some platforms, depending on how the ABI is defined, but it is
- not reliable.
+ * Variadic closures.
* There is no support for bit fields in structures.
@@ -521,6 +541,9 @@ for these.
* The "raw" API is undocumented.
+ Note that variadic support is very new and tested on a relatively
+small number of platforms.
+
File: libffi.info, Node: Index, Prev: Missing Features, Up: Top
@@ -538,11 +561,12 @@ Index
* closure API: The Closure API. (line 13)
* closures: The Closure API. (line 13)
* FFI: Introduction. (line 31)
-* ffi_call: The Basics. (line 41)
+* ffi_call: The Basics. (line 63)
* ffi_closure_alloc: The Closure API. (line 19)
* ffi_closure_free: The Closure API. (line 26)
* FFI_CLOSURES: The Closure API. (line 13)
* ffi_prep_cif: The Basics. (line 16)
+* ffi_prep_cif_var: The Basics. (line 39)
* ffi_prep_closure_loc: The Closure API. (line 34)
* ffi_status <1>: The Closure API. (line 37)
* ffi_status: The Basics. (line 18)
@@ -570,24 +594,24 @@ Index
* ffi_type_void: Primitive Types. (line 10)
* Foreign Function Interface: Introduction. (line 31)
* void <1>: The Closure API. (line 20)
-* void: The Basics. (line 43)
+* void: The Basics. (line 65)
Tag Table:
-Node: Top724
-Node: Introduction1466
-Node: Using libffi3102
-Node: The Basics3588
-Node: Simple Example6374
-Node: Types7401
-Node: Primitive Types7684
-Node: Structures9504
-Node: Type Example10364
-Node: Multiple ABIs11587
-Node: The Closure API11958
-Node: Closure Example14902
-Node: Missing Features16461
-Node: Index16954
+Node: Top712
+Node: Introduction1460
+Node: Using libffi3096
+Node: The Basics3582
+Node: Simple Example7224
+Node: Types8251
+Node: Primitive Types8534
+Node: Structures10354
+Node: Type Example11214
+Node: Multiple ABIs12437
+Node: The Closure API12808
+Node: Closure Example15752
+Node: Missing Features17311
+Node: Index17764
End Tag Table
diff --git a/include/Makefile.in b/include/Makefile.in
index 6d7634a..b7d88da 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -114,7 +114,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -206,7 +205,6 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
diff --git a/man/Makefile.in b/man/Makefile.in
index 7b47d07..2653d69 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -112,7 +112,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -204,7 +203,6 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
@@ -217,8 +215,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign
-EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
-man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 ffi_prep_cif_var.3
+EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3
+man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3
all: all-am
.SUFFIXES:
diff --git a/patches/fix-xfails b/patches/fix-xfails
index 2d37b2e..4f65e72 100644
--- a/patches/fix-xfails
+++ b/patches/fix-xfails
@@ -68,12 +68,12 @@ Index: libffi/src/prep_cif.c
FFI_ASSERT(cif != NULL);
#ifndef X86_WIN32
- FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
-+ if ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI))
++ if (! (abi > FFI_FIRST_ABI) && (abi <= FFI_LAST_ABI))
+ return FFI_BAD_ABI;
#else
- FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI
- || abi == FFI_THISCALL);
-+ if (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)
++ if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL))
+ return FFI_BAD_ABI;
#endif
diff --git a/src/prep_cif.c b/src/prep_cif.c
index cc2fb74..f50a63c 100644
--- a/src/prep_cif.c
+++ b/src/prep_cif.c
@@ -112,10 +112,10 @@ ffi_status FFI_HIDDEN ffi_prep_cif_core(ffi_cif *cif, ffi_abi abi,
FFI_ASSERT(nfixedargs <= ntotalargs);
#ifndef X86_WIN32
- if ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI))
+ if (! (abi > FFI_FIRST_ABI) && (abi <= FFI_LAST_ABI))
return FFI_BAD_ABI;
#else
- if (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL)
+ if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI || abi == FFI_THISCALL))
return FFI_BAD_ABI;
#endif
diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in
index b446655..bbb634f 100644
--- a/testsuite/Makefile.in
+++ b/testsuite/Makefile.in
@@ -89,7 +89,6 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@
FGREP = @FGREP@
GREP = @GREP@
HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@
@@ -181,7 +180,6 @@ psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@