Commit 93cfb655200f34ab1b2b7d8955291c457b91ee9f

Anthony Green 2022-10-10T14:32:35

Correction for older compilers

diff --git a/src/aarch64/ffi.c b/src/aarch64/ffi.c
index be87051..dc6338b 100644
--- a/src/aarch64/ffi.c
+++ b/src/aarch64/ffi.c
@@ -295,7 +295,7 @@ allocate_to_stack (struct arg_state *state, void *stack,
   if (alignment < 8)
     alignment = 8;
 #endif
-    
+
   nsaa = FFI_ALIGN (nsaa, alignment);
   state->nsaa = nsaa + size;
 
@@ -323,40 +323,55 @@ extend_integer_type (void *source, int type)
   switch (type)
     {
     case FFI_TYPE_UINT8:
-      UINT8 u8;
-      memcpy (&u8, source, sizeof (u8));
-      return u8;
+      {
+        UINT8 u8;
+        memcpy (&u8, source, sizeof (u8));
+        return u8;
+      }
     case FFI_TYPE_SINT8:
-      SINT8 s8;
-      memcpy (&s8, source, sizeof (s8));
-      return s8;
+      {
+        SINT8 s8;
+        memcpy (&s8, source, sizeof (s8));
+        return s8;
+      }
     case FFI_TYPE_UINT16:
-      UINT16 u16;
-      memcpy (&u16, source, sizeof (u16));
-      return u16;
+      {
+        UINT16 u16;
+        memcpy (&u16, source, sizeof (u16));
+        return u16;
+      }
     case FFI_TYPE_SINT16:
-      SINT8 s16;
-      memcpy (&s16, source, sizeof (s16));
-      return s16;
+      {
+        SINT8 s16;
+        memcpy (&s16, source, sizeof (s16));
+        return s16;
+      }
     case FFI_TYPE_UINT32:
-      UINT8 u32;
-      memcpy (&u32, source, sizeof (u32));
-      return u32;
+      {
+        UINT8 u32;
+        memcpy (&u32, source, sizeof (u32));
+        return u32;
+      }
     case FFI_TYPE_INT:
     case FFI_TYPE_SINT32:
-      SINT8 s32;
-      memcpy (&s32, source, sizeof (s32));
-      return s32;
+      {
+        SINT8 s32;
+        memcpy (&s32, source, sizeof (s32));
+        return s32;
+      }
     case FFI_TYPE_UINT64:
     case FFI_TYPE_SINT64:
-      UINT64 u64;
-      memcpy (&u64, source, sizeof (u64));
-      return u64;
-      break;
+      {
+        UINT64 u64;
+        memcpy (&u64, source, sizeof (u64));
+        return u64;
+      }
     case FFI_TYPE_POINTER:
-      uintptr_t uptr;
-      memcpy (&uptr, source, sizeof (uptr));
-      return uptr;
+      {
+        uintptr_t uptr;
+        memcpy (&uptr, source, sizeof (uptr));
+        return uptr;
+      }
     default:
       abort();
     }
@@ -841,7 +856,7 @@ ffi_prep_closure_loc (ffi_closure *closure,
     return FFI_BAD_ABI;
 
   void (*start)(void);
-  
+
   if (cif->flags & AARCH64_FLAG_ARG_V)
     start = ffi_closure_SYSV_V;
   else
@@ -879,7 +894,7 @@ ffi_prep_closure_loc (ffi_closure *closure,
 
   /* Initialize the dynamic trampoline. */
   memcpy (tramp, trampoline, sizeof(trampoline));
-  
+
   *(UINT64 *)(tramp + 16) = (uintptr_t)start;
 
   ffi_clear_cache(tramp, tramp + FFI_TRAMPOLINE_SIZE);
@@ -1007,7 +1022,7 @@ ffi_closure_SYSV_inner (ffi_cif *cif,
                     {
                       void *reg = &context->x[state.ngrn];
                       state.ngrn += (unsigned int)n;
-    
+
                       /* Eeek! We need a pointer to the structure, however the
                        homogeneous float elements are being passed in individual
                        registers, therefore for float and double the structure