Commit 5ea0f801 authored by Raymond Hettinger's avatar Raymond Hettinger

Make the GCC-4.8 compiler happy by moving declarations to the top of the function.

parent 520ad579
...@@ -38,12 +38,13 @@ initialize_aggregate( ...@@ -38,12 +38,13 @@ initialize_aggregate(
/*@out@*/ ffi_type* arg) /*@out@*/ ffi_type* arg)
{ {
/*@-usedef@*/ /*@-usedef@*/
ffi_type** ptr;
if (arg == NULL || arg->elements == NULL || if (arg == NULL || arg->elements == NULL ||
arg->size != 0 || arg->alignment != 0) arg->size != 0 || arg->alignment != 0)
return FFI_BAD_TYPEDEF; return FFI_BAD_TYPEDEF;
ffi_type** ptr = &(arg->elements[0]); ptr = &(arg->elements[0]);
while ((*ptr) != NULL) while ((*ptr) != NULL)
{ {
...@@ -135,16 +136,16 @@ ffi_prep_cif( ...@@ -135,16 +136,16 @@ ffi_prep_cif(
/*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype, /*@dependent@*/ /*@out@*/ /*@partial@*/ ffi_type* rtype,
/*@dependent@*/ ffi_type** atypes) /*@dependent@*/ ffi_type** atypes)
{ {
unsigned int bytes = 0;
unsigned int i;
ffi_type** ptr;
if (cif == NULL) if (cif == NULL)
return FFI_BAD_TYPEDEF; return FFI_BAD_TYPEDEF;
if (abi <= FFI_FIRST_ABI || abi > FFI_DEFAULT_ABI) if (abi <= FFI_FIRST_ABI || abi > FFI_DEFAULT_ABI)
return FFI_BAD_ABI; return FFI_BAD_ABI;
unsigned int bytes = 0;
unsigned int i;
ffi_type** ptr;
cif->abi = abi; cif->abi = abi;
cif->arg_types = atypes; cif->arg_types = atypes;
cif->nargs = nargs; cif->nargs = nargs;
......
...@@ -225,14 +225,16 @@ classify_argument( ...@@ -225,14 +225,16 @@ classify_argument(
/* Merge the fields of structure. */ /* Merge the fields of structure. */
for (ptr = type->elements; *ptr != NULL; ptr++) for (ptr = type->elements; *ptr != NULL; ptr++)
{ {
int num, pos;
byte_offset = ALIGN(byte_offset, (*ptr)->alignment); byte_offset = ALIGN(byte_offset, (*ptr)->alignment);
int num = classify_argument(*ptr, subclasses, byte_offset % 8); num = classify_argument(*ptr, subclasses, byte_offset % 8);
if (num == 0) if (num == 0)
return 0; return 0;
int pos = byte_offset / 8; pos = byte_offset / 8;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
...@@ -589,11 +591,12 @@ ffi_prep_closure( ...@@ -589,11 +591,12 @@ ffi_prep_closure(
void (*fun)(ffi_cif*, void*, void**, void*), void (*fun)(ffi_cif*, void*, void**, void*),
void* user_data) void* user_data)
{ {
volatile unsigned short* tramp;
if (cif->abi != FFI_UNIX64) if (cif->abi != FFI_UNIX64)
return FFI_BAD_ABI; return FFI_BAD_ABI;
volatile unsigned short* tramp = tramp = (volatile unsigned short*)&closure->tramp[0];
(volatile unsigned short*)&closure->tramp[0];
tramp[0] = 0xbb49; /* mov <code>, %r11 */ tramp[0] = 0xbb49; /* mov <code>, %r11 */
*(void* volatile*)&tramp[1] = ffi_closure_unix64; *(void* volatile*)&tramp[1] = ffi_closure_unix64;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment