Rebase
[platform/upstream/libffi.git] / patches / ffi_last_abi
1 Index: libffi/ChangeLog
2 ===================================================================
3 --- libffi.orig/ChangeLog
4 +++ libffi/ChangeLog
5 @@ -65,6 +65,12 @@
6         * testsuite/libffi.call/cls_longdouble.c: Likewise.
7         * testsuite/libffi.call/huge_struct.c: Likewise.
8  
9 +2010-07-22  Dan Witte  <dwitte@mozilla.com>
10 +
11 +       * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI.
12 +       * src/prep_cif.c: Fix ABI assertion.
13 +        * src/cris/ffi.c: Ditto.
14 +
15  2010-07-10  Evan Phoenix  <evan@fallingsnow.net>
16  
17         * src/closures.c (selinux_enabled_check): Fix strncmp usage bug.
18 Index: libffi/src/avr32/ffitarget.h
19 ===================================================================
20 --- libffi.orig/src/avr32/ffitarget.h
21 +++ libffi/src/avr32/ffitarget.h
22 @@ -34,8 +34,8 @@ typedef signed long            ffi_sarg;
23  typedef enum ffi_abi {
24    FFI_FIRST_ABI = 0,
25    FFI_SYSV,
26 -  FFI_DEFAULT_ABI = FFI_SYSV,
27 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
28 +  FFI_LAST_ABI,
29 +  FFI_DEFAULT_ABI = FFI_SYSV
30  } ffi_abi;
31  #endif
32  
33 Index: libffi/src/cris/ffi.c
34 ===================================================================
35 --- libffi.orig/src/cris/ffi.c
36 +++ libffi/src/cris/ffi.c
37 @@ -163,7 +163,7 @@ ffi_prep_cif (ffi_cif * cif,
38    ffi_type **ptr;
39  
40    FFI_ASSERT (cif != NULL);
41 -  FFI_ASSERT ((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
42 +  FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI);
43  
44    cif->abi = abi;
45    cif->arg_types = atypes;
46 Index: libffi/src/cris/ffitarget.h
47 ===================================================================
48 --- libffi.orig/src/cris/ffitarget.h
49 +++ libffi/src/cris/ffitarget.h
50 @@ -34,8 +34,8 @@ typedef signed long            ffi_sarg;
51  typedef enum ffi_abi {
52    FFI_FIRST_ABI = 0,
53    FFI_SYSV,
54 -  FFI_DEFAULT_ABI = FFI_SYSV,
55 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
56 +  FFI_LAST_ABI,
57 +  FFI_DEFAULT_ABI = FFI_SYSV
58  } ffi_abi;
59  #endif
60  
61 Index: libffi/src/frv/ffitarget.h
62 ===================================================================
63 --- libffi.orig/src/frv/ffitarget.h
64 +++ libffi/src/frv/ffitarget.h
65 @@ -35,13 +35,9 @@ typedef signed long            ffi_sarg;
66  
67  typedef enum ffi_abi {
68    FFI_FIRST_ABI = 0,
69 -
70 -#ifdef FRV
71    FFI_EABI,
72 -  FFI_DEFAULT_ABI = FFI_EABI,
73 -#endif
74 -
75 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
76 +  FFI_LAST_ABI,
77 +  FFI_DEFAULT_ABI = FFI_EABI
78  } ffi_abi;
79  #endif
80  
81 Index: libffi/src/ia64/ffitarget.h
82 ===================================================================
83 --- libffi.orig/src/ia64/ffitarget.h
84 +++ libffi/src/ia64/ffitarget.h
85 @@ -34,8 +34,8 @@ typedef signed long long            ffi_
86  typedef enum ffi_abi {
87    FFI_FIRST_ABI = 0,
88    FFI_UNIX,    /* Linux and all Unix variants use the same conventions */
89 -  FFI_DEFAULT_ABI = FFI_UNIX,
90 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
91 +  FFI_LAST_ABI,
92 +  FFI_DEFAULT_ABI = FFI_UNIX
93  } ffi_abi;
94  #endif
95  
96 Index: libffi/src/m32r/ffitarget.h
97 ===================================================================
98 --- libffi.orig/src/m32r/ffitarget.h
99 +++ libffi/src/m32r/ffitarget.h
100 @@ -36,8 +36,8 @@ typedef enum ffi_abi
101    {
102      FFI_FIRST_ABI = 0,
103      FFI_SYSV,
104 -    FFI_DEFAULT_ABI = FFI_SYSV,
105 -    FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
106 +    FFI_LAST_ABI,
107 +    FFI_DEFAULT_ABI = FFI_SYSV
108    } ffi_abi;
109  #endif
110  
111 Index: libffi/src/m68k/ffitarget.h
112 ===================================================================
113 --- libffi.orig/src/m68k/ffitarget.h
114 +++ libffi/src/m68k/ffitarget.h
115 @@ -34,8 +34,8 @@ typedef signed long            ffi_sarg;
116  typedef enum ffi_abi {
117    FFI_FIRST_ABI = 0,
118    FFI_SYSV,
119 -  FFI_DEFAULT_ABI = FFI_SYSV,
120 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
121 +  FFI_LAST_ABI,
122 +  FFI_DEFAULT_ABI = FFI_SYSV
123  } ffi_abi;
124  #endif
125  
126 Index: libffi/src/mips/ffitarget.h
127 ===================================================================
128 --- libffi.orig/src/mips/ffitarget.h
129 +++ libffi/src/mips/ffitarget.h
130 @@ -186,30 +186,29 @@ typedef enum ffi_abi {
131    FFI_O32_SOFT_FLOAT,
132    FFI_N32_SOFT_FLOAT,
133    FFI_N64_SOFT_FLOAT,
134 +  FFI_LAST_ABI,
135  
136  #ifdef FFI_MIPS_O32
137  #ifdef __mips_soft_float
138 -  FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT,
139 +  FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT
140  #else
141 -  FFI_DEFAULT_ABI = FFI_O32,
142 +  FFI_DEFAULT_ABI = FFI_O32
143  #endif
144  #else
145  # if _MIPS_SIM==_ABI64
146  #  ifdef __mips_soft_float
147 -  FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT,
148 +  FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT
149  #  else
150 -  FFI_DEFAULT_ABI = FFI_N64,
151 +  FFI_DEFAULT_ABI = FFI_N64
152  #  endif
153  # else
154  #  ifdef __mips_soft_float
155 -  FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT,
156 +  FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT
157  #  else
158 -  FFI_DEFAULT_ABI = FFI_N32,
159 +  FFI_DEFAULT_ABI = FFI_N32
160  #  endif
161  # endif
162  #endif
163 -
164 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
165  } ffi_abi;
166  
167  #define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag
168 Index: libffi/src/moxie/ffitarget.h
169 ===================================================================
170 --- libffi.orig/src/moxie/ffitarget.h
171 +++ libffi/src/moxie/ffitarget.h
172 @@ -35,13 +35,9 @@ typedef signed long            ffi_sarg;
173  
174  typedef enum ffi_abi {
175    FFI_FIRST_ABI = 0,
176 -
177 -#ifdef MOXIE
178    FFI_EABI,
179 -  FFI_DEFAULT_ABI = FFI_EABI,
180 -#endif
181 -
182 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
183 +  FFI_LAST_ABI,
184 +  FFI_DEFAULT_ABI = FFI_EABI
185  } ffi_abi;
186  #endif
187  
188 Index: libffi/src/pa/ffitarget.h
189 ===================================================================
190 --- libffi.orig/src/pa/ffitarget.h
191 +++ libffi/src/pa/ffitarget.h
192 @@ -38,21 +38,22 @@ typedef enum ffi_abi {
193  
194  #ifdef PA_LINUX
195    FFI_PA32,
196 -  FFI_DEFAULT_ABI = FFI_PA32,
197 +  FFI_LAST_ABI,
198 +  FFI_DEFAULT_ABI = FFI_PA32
199  #endif
200  
201  #ifdef PA_HPUX
202    FFI_PA32,
203 -  FFI_DEFAULT_ABI = FFI_PA32,
204 +  FFI_LAST_ABI,
205 +  FFI_DEFAULT_ABI = FFI_PA32
206  #endif
207  
208  #ifdef PA64_HPUX
209  #error "PA64_HPUX FFI is not yet implemented"
210    FFI_PA64,
211 -  FFI_DEFAULT_ABI = FFI_PA64,
212 +  FFI_LAST_ABI,
213 +  FFI_DEFAULT_ABI = FFI_PA64
214  #endif
215 -
216 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
217  } ffi_abi;
218  #endif
219  
220 Index: libffi/src/prep_cif.c
221 ===================================================================
222 --- libffi.orig/src/prep_cif.c
223 +++ libffi/src/prep_cif.c
224 @@ -93,7 +93,7 @@ ffi_status ffi_prep_cif(ffi_cif *cif, ff
225    ffi_type **ptr;
226  
227    FFI_ASSERT(cif != NULL);
228 -  FFI_ASSERT((abi > FFI_FIRST_ABI) && (abi <= FFI_DEFAULT_ABI));
229 +  FFI_ASSERT(abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI);
230  
231    cif->abi = abi;
232    cif->arg_types = atypes;
233 Index: libffi/src/s390/ffitarget.h
234 ===================================================================
235 --- libffi.orig/src/s390/ffitarget.h
236 +++ libffi/src/s390/ffitarget.h
237 @@ -42,8 +42,8 @@ typedef signed long            ffi_sarg;
238  typedef enum ffi_abi {
239    FFI_FIRST_ABI = 0,
240    FFI_SYSV,
241 -  FFI_DEFAULT_ABI = FFI_SYSV,
242 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
243 +  FFI_LAST_ABI,
244 +  FFI_DEFAULT_ABI = FFI_SYSV
245  } ffi_abi;
246  #endif
247  
248 Index: libffi/src/sh/ffitarget.h
249 ===================================================================
250 --- libffi.orig/src/sh/ffitarget.h
251 +++ libffi/src/sh/ffitarget.h
252 @@ -36,8 +36,8 @@ typedef signed long            ffi_sarg;
253  typedef enum ffi_abi {
254    FFI_FIRST_ABI = 0,
255    FFI_SYSV,
256 -  FFI_DEFAULT_ABI = FFI_SYSV,
257 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
258 +  FFI_LAST_ABI,
259 +  FFI_DEFAULT_ABI = FFI_SYSV
260  } ffi_abi;
261  #endif
262  
263 Index: libffi/src/sh64/ffitarget.h
264 ===================================================================
265 --- libffi.orig/src/sh64/ffitarget.h
266 +++ libffi/src/sh64/ffitarget.h
267 @@ -36,8 +36,8 @@ typedef signed long            ffi_sarg;
268  typedef enum ffi_abi {
269    FFI_FIRST_ABI = 0,
270    FFI_SYSV,
271 -  FFI_DEFAULT_ABI = FFI_SYSV,
272 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
273 +  FFI_LAST_ABI,
274 +  FFI_DEFAULT_ABI = FFI_SYSV
275  } ffi_abi;
276  
277  #define FFI_EXTRA_CIF_FIELDS long long flags2
278 Index: libffi/src/sparc/ffitarget.h
279 ===================================================================
280 --- libffi.orig/src/sparc/ffitarget.h
281 +++ libffi/src/sparc/ffitarget.h
282 @@ -44,12 +44,12 @@ typedef enum ffi_abi {
283    FFI_V8,
284    FFI_V8PLUS,
285    FFI_V9,
286 +  FFI_LAST_ABI,
287  #ifdef SPARC64
288 -  FFI_DEFAULT_ABI = FFI_V9,
289 +  FFI_DEFAULT_ABI = FFI_V9
290  #else
291 -  FFI_DEFAULT_ABI = FFI_V8,
292 +  FFI_DEFAULT_ABI = FFI_V8
293  #endif
294 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
295  } ffi_abi;
296  #endif
297  
298 Index: libffi/src/x86/ffitarget.h
299 ===================================================================
300 --- libffi.orig/src/x86/ffitarget.h
301 +++ libffi/src/x86/ffitarget.h
302 @@ -64,28 +64,29 @@ typedef enum ffi_abi {
303  #ifdef X86_WIN32
304    FFI_SYSV,
305    FFI_STDCALL,
306 +  FFI_LAST_ABI,
307    /* TODO: Add fastcall support for the sake of completeness */
308 -  FFI_DEFAULT_ABI = FFI_SYSV,
309 +  FFI_DEFAULT_ABI = FFI_SYSV
310  #endif
311  
312  #ifdef X86_WIN64
313    FFI_WIN64,
314 -  FFI_DEFAULT_ABI = FFI_WIN64,
315 +  FFI_LAST_ABI,
316 +  FFI_DEFAULT_ABI = FFI_WIN64
317  #else
318  
319    /* ---- Intel x86 and AMD x86-64 - */
320  #if !defined(X86_WIN32) && (defined(__i386__) || defined(__x86_64__) || defined(__i386) || defined(__amd64))
321    FFI_SYSV,
322    FFI_UNIX64,   /* Unix variants all use the same ABI for x86-64  */
323 +  FFI_LAST_ABI,
324  #if defined(__i386__) || defined(__i386)
325 -  FFI_DEFAULT_ABI = FFI_SYSV,
326 +  FFI_DEFAULT_ABI = FFI_SYSV
327  #else
328 -  FFI_DEFAULT_ABI = FFI_UNIX64,
329 +  FFI_DEFAULT_ABI = FFI_UNIX64
330  #endif
331  #endif
332  #endif /* X86_WIN64 */
333 -
334 -  FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
335  } ffi_abi;
336  #endif
337