This enshrines the current testsuite practice of using ffi_arg for returned values. It would be reasonable and logical to use the actual return argument type as passed to ffi_prep_cif, but this would mean changing a large number of tests that use ffi_arg and all backends that write results to an ffi_arg.
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
diff --git a/ChangeLog b/ChangeLog
index 3cb6188..806af18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-13 Alan Modra <amodra@gmail.com>
+
+ * doc/libffi.texi (Simple Example): Correct example code.
+ * doc/libffi.info, doc/stamp-vti, doc/version.texi: Rebuilt.
+
2013-11-13 Anthony Green <green@moxielogic.com>
* include/ffi_common.h: Respect HAVE_ALLOCA_H for GNU compiler
diff --git a/doc/libffi.info b/doc/libffi.info
index fb02d37..4d42f5b 100644
--- a/doc/libffi.info
+++ b/doc/libffi.info
@@ -186,7 +186,7 @@ Here is a trivial example that calls 'puts' a few times.
ffi_type *args[1];
void *values[1];
char *s;
- int rc;
+ ffi_arg rc;
/* Initialize the argument info vectors */
args[0] = &ffi_type_pointer;
@@ -194,7 +194,7 @@ Here is a trivial example that calls 'puts' a few times.
/* Initialize the cif */
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_uint, args) == FFI_OK)
+ &ffi_type_sint, args) == FFI_OK)
{
s = "Hello World!";
ffi_call(&cif, puts, &rc, values);
@@ -363,6 +363,7 @@ The following example initializes a 'ffi_type' object representing the
int i;
tm_type.size = tm_type.alignment = 0;
+ tm_type.type = FFI_TYPE_STRUCT;
tm_type.elements = &tm_type_elements;
for (i = 0; i < 9; i++)
@@ -477,7 +478,7 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
- void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
+ void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
FILE *stream)
{
*ret = fputs(*(char **)args[0], stream);
@@ -502,7 +503,7 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
/* Initialize the cif */
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_uint, args) == FFI_OK)
+ &ffi_type_sint, args) == FFI_OK)
{
/* Initialize the closure, setting stream to stdout */
if (ffi_prep_closure_loc(closure, &cif, puts_binding,
@@ -602,14 +603,14 @@ Node: Introduction1429
Node: Using libffi3061
Node: The Basics3547
Node: Simple Example7198
-Node: Types8225
-Node: Primitive Types8508
-Node: Structures10329
-Node: Type Example11203
-Node: Multiple ABIs12426
-Node: The Closure API12797
-Node: Closure Example15741
-Node: Missing Features17300
-Node: Index17753
+Node: Types8229
+Node: Primitive Types8512
+Node: Structures10333
+Node: Type Example11207
+Node: Multiple ABIs12473
+Node: The Closure API12844
+Node: Closure Example15788
+Node: Missing Features17342
+Node: Index17795
End Tag Table
diff --git a/doc/libffi.texi b/doc/libffi.texi
index eca11dc..d13c5c0 100644
--- a/doc/libffi.texi
+++ b/doc/libffi.texi
@@ -214,7 +214,7 @@ int main()
ffi_type *args[1];
void *values[1];
char *s;
- int rc;
+ ffi_arg rc;
/* Initialize the argument info vectors */
args[0] = &ffi_type_pointer;
@@ -222,7 +222,7 @@ int main()
/* Initialize the cif */
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_uint, args) == FFI_OK)
+ &ffi_type_sint, args) == FFI_OK)
@{
s = "Hello World!";
ffi_call(&cif, puts, &rc, values);
@@ -414,6 +414,7 @@ Here is the corresponding code to describe this struct to
int i;
tm_type.size = tm_type.alignment = 0;
+ tm_type.type = FFI_TYPE_STRUCT;
tm_type.elements = &tm_type_elements;
for (i = 0; i < 9; i++)
@@ -540,7 +541,7 @@ A trivial example that creates a new @code{puts} by binding
#include <ffi.h>
/* Acts like puts with the file given at time of enclosure. */
-void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
+void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
FILE *stream)
@{
*ret = fputs(*(char **)args[0], stream);
@@ -565,7 +566,7 @@ int main()
/* Initialize the cif */
if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
- &ffi_type_uint, args) == FFI_OK)
+ &ffi_type_sint, args) == FFI_OK)
@{
/* Initialize the closure, setting stream to stdout */
if (ffi_prep_closure_loc(closure, &cif, puts_binding,
diff --git a/doc/stamp-vti b/doc/stamp-vti
index fbdde9b..3c7f7b2 100644
--- a/doc/stamp-vti
+++ b/doc/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 2 July 2013
-@set UPDATED-MONTH July 2013
+@set UPDATED 13 November 2013
+@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0
diff --git a/doc/version.texi b/doc/version.texi
index fbdde9b..3c7f7b2 100644
--- a/doc/version.texi
+++ b/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 2 July 2013
-@set UPDATED-MONTH July 2013
+@set UPDATED 13 November 2013
+@set UPDATED-MONTH November 2013
@set EDITION 3.0.14-rc0
@set VERSION 3.0.14-rc0