This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 1/4] s390: Kill trailing whitespace


From: Richard Henderson <rth@redhat.com>

---
 src/s390/ffi.c  | 130 ++++++++++++++++++++++++++++----------------------------
 src/s390/sysv.S |  30 ++++++-------
 2 files changed, 80 insertions(+), 80 deletions(-)

diff --git a/src/s390/ffi.c b/src/s390/ffi.c
index 477b85e..b0c3092 100644
--- a/src/s390/ffi.c
+++ b/src/s390/ffi.c
@@ -1,9 +1,9 @@
 /* -----------------------------------------------------------------------
    ffi.c - Copyright (c) 2000, 2007 Software AG
            Copyright (c) 2008 Red Hat, Inc
- 
+
    S390 Foreign Function Interface
- 
+
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    ``Software''), to deal in the Software without restriction, including
@@ -11,10 +11,10 @@
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:
- 
+
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
- 
+
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
@@ -27,24 +27,24 @@
 /*                          Includes                                  */
 /*                          --------                                  */
 /*====================================================================*/
- 
+
 #include <ffi.h>
 #include <ffi_common.h>
- 
+
 #include <stdlib.h>
 #include <stdio.h>
- 
+
 /*====================== End of Includes =============================*/
- 
+
 /*====================================================================*/
 /*                           Defines                                  */
 /*                           -------                                  */
 /*====================================================================*/
 
-/* Maximum number of GPRs available for argument passing.  */ 
+/* Maximum number of GPRs available for argument passing.  */
 #define MAX_GPRARGS 5
 
-/* Maximum number of FPRs available for argument passing.  */ 
+/* Maximum number of FPRs available for argument passing.  */
 #ifdef __s390x__
 #define MAX_FPRARGS 4
 #else
@@ -63,12 +63,12 @@
 #define FFI390_RET_INT64	5
 
 /*===================== End of Defines ===============================*/
- 
+
 /*====================================================================*/
 /*                          Externals                                 */
 /*                          ---------                                 */
 /*====================================================================*/
- 
+
 extern void ffi_call_SYSV(unsigned,
 			  extended_cif *,
 			  void (*)(unsigned char *, extended_cif *),
@@ -78,9 +78,9 @@ extern void ffi_call_SYSV(unsigned,
 
 extern void ffi_closure_SYSV(void);
 extern void ffi_go_closure_SYSV(void);
- 
+
 /*====================== End of Externals ============================*/
- 
+
 /*====================================================================*/
 /*                                                                    */
 /* Name     - ffi_check_struct_type.                                  */
@@ -89,7 +89,7 @@ extern void ffi_go_closure_SYSV(void);
 /*            general purpose or floating point register.             */
 /*                                                                    */
 /*====================================================================*/
- 
+
 static int
 ffi_check_struct_type (ffi_type *arg)
 {
@@ -97,7 +97,7 @@ ffi_check_struct_type (ffi_type *arg)
 
   /* If the struct has just one element, look at that element
      to find out whether to consider the struct as floating point.  */
-  while (arg->type == FFI_TYPE_STRUCT 
+  while (arg->type == FFI_TYPE_STRUCT
          && arg->elements[0] && !arg->elements[1])
     arg = arg->elements[0];
 
@@ -130,9 +130,9 @@ ffi_check_struct_type (ffi_type *arg)
   /* Other structs are passed via a pointer to the data.  */
   return FFI_TYPE_POINTER;
 }
- 
+
 /*======================== End of Routine ============================*/
- 
+
 /*====================================================================*/
 /*                                                                    */
 /* Name     - ffi_prep_args.                                          */
@@ -143,7 +143,7 @@ ffi_check_struct_type (ffi_type *arg)
 /* has been allocated for the function's arguments.                   */
 /*                                                                    */
 /*====================================================================*/
- 
+
 static void
 ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 {
@@ -178,7 +178,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
   ffi_type **ptr;
   void **p_argv = ecif->avalue;
   int i;
- 
+
   /* If we returning a structure then we set the first parameter register
      to the address of where we are returning this structure.  */
 
@@ -186,7 +186,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
     p_gpr[n_gpr++] = (unsigned long) ecif->rvalue;
 
   /* Now for the arguments.  */
- 
+
   for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs;
        i > 0;
        i--, ptr++, p_argv++)
@@ -218,7 +218,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	}
 
       /* Now handle all primitive int/pointer/float data types.  */
-      switch (type) 
+      switch (type)
 	{
 	  case FFI_TYPE_DOUBLE:
 	    if (n_fpr < MAX_FPRARGS)
@@ -231,7 +231,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	      p_ov[n_ov++] = ((unsigned long *) arg)[1];
 #endif
 	    break;
-	
+
 	  case FFI_TYPE_FLOAT:
 	    if (n_fpr < MAX_FPRARGS)
 	      p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32;
@@ -245,7 +245,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	    else
 	      p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg;
 	    break;
- 
+
 	  case FFI_TYPE_UINT64:
 	  case FFI_TYPE_SINT64:
 #ifdef __s390x__
@@ -264,14 +264,14 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	      p_ov[n_ov++] = ((unsigned long *) arg)[1];
 #endif
 	    break;
- 
+
 	  case FFI_TYPE_UINT32:
 	    if (n_gpr < MAX_GPRARGS)
 	      p_gpr[n_gpr++] = *(unsigned int *) arg;
 	    else
 	      p_ov[n_ov++] = *(unsigned int *) arg;
 	    break;
- 
+
 	  case FFI_TYPE_INT:
 	  case FFI_TYPE_SINT32:
 	    if (n_gpr < MAX_GPRARGS)
@@ -279,14 +279,14 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	    else
 	      p_ov[n_ov++] = *(signed int *) arg;
 	    break;
- 
+
 	  case FFI_TYPE_UINT16:
 	    if (n_gpr < MAX_GPRARGS)
 	      p_gpr[n_gpr++] = *(unsigned short *) arg;
 	    else
 	      p_ov[n_ov++] = *(unsigned short *) arg;
 	    break;
- 
+
 	  case FFI_TYPE_SINT16:
 	    if (n_gpr < MAX_GPRARGS)
 	      p_gpr[n_gpr++] = *(signed short *) arg;
@@ -300,14 +300,14 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 	    else
 	      p_ov[n_ov++] = *(unsigned char *) arg;
 	    break;
- 
+
 	  case FFI_TYPE_SINT8:
 	    if (n_gpr < MAX_GPRARGS)
 	      p_gpr[n_gpr++] = *(signed char *) arg;
 	    else
 	      p_ov[n_ov++] = *(signed char *) arg;
 	    break;
- 
+
 	  default:
 	    FFI_ASSERT (0);
 	    break;
@@ -316,7 +316,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 }
 
 /*======================== End of Routine ============================*/
- 
+
 /*====================================================================*/
 /*                                                                    */
 /* Name     - ffi_prep_cif_machdep.                                   */
@@ -324,7 +324,7 @@ ffi_prep_args (unsigned char *stack, extended_cif *ecif)
 /* Function - Perform machine dependent CIF processing.               */
 /*                                                                    */
 /*====================================================================*/
- 
+
 ffi_status
 ffi_prep_cif_machdep(ffi_cif *cif)
 {
@@ -336,7 +336,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
   ffi_type **ptr;
   int i;
 
-  /* Determine return value handling.  */ 
+  /* Determine return value handling.  */
 
   switch (cif->rtype->type)
     {
@@ -350,7 +350,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
       case FFI_TYPE_COMPLEX:
 	cif->flags = FFI390_RET_STRUCT;
 	n_gpr++;  /* We need one GPR to pass the pointer.  */
-	break; 
+	break;
 
       /* Floating point values are returned in fpr 0.  */
       case FFI_TYPE_FLOAT:
@@ -389,14 +389,14 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 	cif->flags = FFI390_RET_INT32;
 #endif
 	break;
- 
+
       default:
         FFI_ASSERT (0);
         break;
     }
 
   /* Now for the arguments.  */
- 
+
   for (ptr = cif->arg_types, i = cif->nargs;
        i > 0;
        i--, ptr++)
@@ -424,7 +424,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 	}
 
       /* Now handle all primitive int/float data types.  */
-      switch (type) 
+      switch (type)
 	{
 	  /* The first MAX_FPRARGS floating point arguments
 	     go in FPRs, the rest overflow to the stack.  */
@@ -435,7 +435,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 	    else
 	      n_ov += sizeof (double) / sizeof (long);
 	    break;
-	
+
 	  case FFI_TYPE_FLOAT:
 	    if (n_fpr < MAX_FPRARGS)
 	      n_fpr++;
@@ -445,9 +445,9 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 
 	  /* On 31-bit machines, 64-bit integers are passed in GPR pairs,
 	     if one is still available, or else on the stack.  If only one
-	     register is free, skip the register (it won't be used for any 
+	     register is free, skip the register (it won't be used for any
 	     subsequent argument either).  */
-	      
+
 #ifndef __s390x__
 	  case FFI_TYPE_UINT64:
 	  case FFI_TYPE_SINT64:
@@ -463,7 +463,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 	  /* Everything else is passed in GPRs (until MAX_GPRARGS
 	     have been used) or overflows to the stack.  */
 
-	  default: 
+	  default:
 	    if (n_gpr < MAX_GPRARGS)
 	      n_gpr++;
 	    else
@@ -476,12 +476,12 @@ ffi_prep_cif_machdep(ffi_cif *cif)
      and temporary structure copies.  */
 
   cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size;
- 
+
   return FFI_OK;
 }
- 
+
 /*======================== End of Routine ============================*/
- 
+
 /*====================================================================*/
 /*                                                                    */
 /* Name     - ffi_call.                                               */
@@ -489,7 +489,7 @@ ffi_prep_cif_machdep(ffi_cif *cif)
 /* Function - Call the FFI routine.                                   */
 /*                                                                    */
 /*====================================================================*/
- 
+
 static void
 ffi_call_int(ffi_cif *cif,
 	     void (*fn)(void),
@@ -499,7 +499,7 @@ ffi_call_int(ffi_cif *cif,
 {
   int ret_type = cif->flags;
   extended_cif ecif;
- 
+
   ecif.cif    = cif;
   ecif.avalue = avalue;
   ecif.rvalue = rvalue;
@@ -511,7 +511,7 @@ ffi_call_int(ffi_cif *cif,
 	ecif.rvalue = alloca (cif->rtype->size);
       else
 	ret_type = FFI390_RET_VOID;
-    } 
+    }
 
   switch (cif->abi)
     {
@@ -519,7 +519,7 @@ ffi_call_int(ffi_cif *cif,
         ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args,
 		       ret_type, ecif.rvalue, fn, closure);
         break;
- 
+
       default:
         FFI_ASSERT (0);
         break;
@@ -538,7 +538,7 @@ ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
 {
   ffi_call_int(cif, fn, rvalue, avalue, closure);
 }
- 
+
 /*======================== End of Routine ============================*/
 
 /*====================================================================*/
@@ -575,8 +575,8 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 
   p_arg = avalue = alloca (cif->nargs * sizeof (void *));
 
-  /* If we returning a structure, pass the structure address 
-     directly to the target function.  Otherwise, have the target 
+  /* If we returning a structure, pass the structure address
+     directly to the target function.  Otherwise, have the target
      function store the return value to the GPR save area.  */
 
   if (cif->flags == FFI390_RET_STRUCT)
@@ -603,7 +603,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 	  else
 	    type = ffi_check_struct_type (*ptr);
 
-	  /* If we pass the struct via pointer, remember to 
+	  /* If we pass the struct via pointer, remember to
 	     retrieve the pointer later.  */
 	  if (type == FFI_TYPE_POINTER)
 	    deref_struct_pointer = 1;
@@ -618,23 +618,23 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 #endif
 
       /* Now handle all primitive int/float data types.  */
-      switch (type) 
+      switch (type)
 	{
 	  case FFI_TYPE_DOUBLE:
 	    if (n_fpr < MAX_FPRARGS)
 	      *p_arg = &p_fpr[n_fpr++];
 	    else
-	      *p_arg = &p_ov[n_ov], 
+	      *p_arg = &p_ov[n_ov],
 	      n_ov += sizeof (double) / sizeof (long);
 	    break;
-	
+
 	  case FFI_TYPE_FLOAT:
 	    if (n_fpr < MAX_FPRARGS)
 	      *p_arg = &p_fpr[n_fpr++];
 	    else
 	      *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
 	    break;
- 
+
 	  case FFI_TYPE_UINT64:
 	  case FFI_TYPE_SINT64:
 #ifdef __s390x__
@@ -651,7 +651,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 	      *p_arg = &p_ov[n_ov], n_ov += 2;
 #endif
 	    break;
- 
+
 	  case FFI_TYPE_INT:
 	  case FFI_TYPE_UINT32:
 	  case FFI_TYPE_SINT32:
@@ -660,7 +660,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 	    else
 	      *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4;
 	    break;
- 
+
 	  case FFI_TYPE_UINT16:
 	  case FFI_TYPE_SINT16:
 	    if (n_gpr < MAX_GPRARGS)
@@ -676,7 +676,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 	    else
 	      *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1;
 	    break;
- 
+
 	  default:
 	    FFI_ASSERT (0);
 	    break;
@@ -744,7 +744,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
         break;
     }
 }
- 
+
 /*======================== End of Routine ============================*/
 
 /*====================================================================*/
@@ -754,7 +754,7 @@ ffi_closure_helper_SYSV (ffi_cif *cif,
 /* Function - Prepare a FFI closure.                                  */
 /*                                                                    */
 /*====================================================================*/
- 
+
 ffi_status
 ffi_prep_closure_loc (ffi_closure *closure,
 		      ffi_cif *cif,
@@ -780,17 +780,17 @@ ffi_prep_closure_loc (ffi_closure *closure,
   *(short *)&closure->tramp [8] = 0x07f1;   /* br %r1 */
   *(long  *)&closure->tramp[16] = (long)codeloc;
   *(long  *)&closure->tramp[24] = (long)&ffi_closure_SYSV;
-#endif 
- 
+#endif
+
   closure->cif = cif;
   closure->user_data = user_data;
   closure->fun = fun;
- 
+
   return FFI_OK;
 }
 
 /*======================== End of Routine ============================*/
- 
+
 /* Build a Go language closure.  */
 
 ffi_status
diff --git a/src/s390/sysv.S b/src/s390/sysv.S
index 14672ac..b01a7eb 100644
--- a/src/s390/sysv.S
+++ b/src/s390/sysv.S
@@ -1,9 +1,9 @@
 /* -----------------------------------------------------------------------
    sysv.S - Copyright (c) 2000 Software AG
             Copyright (c) 2008 Red Hat, Inc.
- 
+
    S390 Foreign Function Interface
- 
+
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    ``Software''), to deal in the Software without restriction, including
@@ -11,10 +11,10 @@
    distribute, sublicense, and/or sell copies of the Software, and to
    permit persons to whom the Software is furnished to do so, subject to
    the following conditions:
- 
+
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
- 
+
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -30,7 +30,7 @@
 #include <ffi.h>
 
 #ifndef __s390x__
- 
+
 .text
 
 	# r2:	cif->bytes
@@ -38,7 +38,7 @@
 	# r4:	ffi_prep_args
 	# r5:	ret_type
 	# r6:	ecif.rvalue
-	# ov:	fn 
+	# ov:	fn
 	# ov+8:	closure
 
 	# This assumes we are using gas.
@@ -125,7 +125,7 @@ ffi_call_SYSV:
 	.cfi_restore_state
 	# See comment on the nopr above.
 	nopr
- 
+
 .LretDouble:
 	l	%r4,48+56(%r11)
 	std	%f0,0(%r8)			# Return double
@@ -167,7 +167,7 @@ ffi_call_SYSV:
 	.cfi_restore_state
 	# See comment on the nopr above.
 	nopr
- 
+
 .LretInt64:
 	l	%r4,48+56(%r11)
 	stm	%r2,%r3,0(%r8)			# Return long long
@@ -186,7 +186,7 @@ ffi_call_SYSV:
 	.cfi_def_cfa r15, 96
 	br	%r4
 	.cfi_endproc
- 
+
 .Ltable:
 	.byte	.LretNone-.Lbase		# FFI390_RET_VOID
 	.byte	.LretNone-.Lbase		# FFI390_RET_STRUCT
@@ -269,15 +269,15 @@ ffi_go_closure_SYSV:
 	.cfi_endproc
 
 #else
- 
+
 .text
- 
+
 	# r2:	cif->bytes
 	# r3:	&ecif
 	# r4:	ffi_prep_args
 	# r5:	ret_type
 	# r6:	ecif.rvalue
-	# ov:	fn 
+	# ov:	fn
 	# ov+8:	closure
 
 	# This assumes we are using gas.
@@ -365,7 +365,7 @@ ffi_call_SYSV:
 	.cfi_restore_state
 	# See comment on the nopr above.
 	nopr
- 
+
 .LretDouble:
 	lg	%r4,80+112(%r11)
 	std	%f0,0(%r8)			# Return double
@@ -404,7 +404,7 @@ ffi_call_SYSV:
 	.cfi_def_cfa r15, 160
 	br	%r4
 	.cfi_endproc
- 
+
 .Ltable:
 	.byte	.LretNone-.Lbase		# FFI390_RET_VOID
 	.byte	.LretNone-.Lbase		# FFI390_RET_STRUCT
@@ -461,7 +461,7 @@ ffi_closure_SYSV:
 .ffi_closure_SYSV_end:
 	.size	 ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV
 
-	
+
 	.globl	ffi_go_closure_SYSV
 	FFI_HIDDEN(ffi_go_closure_SYSV)
 	.type	ffi_go_closure_SYSV,%function
-- 
2.1.0


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]