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]

libffi warning fixes


Hi Anthony,

A few warning fixes from our tree. These apply to git head after the addition of the msvcc.sh fix I sent a few weeks back (I think you applied it, but it's not in git yet).

If these are OK, could you please apply?

Thanks,
Dan.
diff --git a/msvcc.sh b/msvcc.sh
--- a/msvcc.sh
+++ b/msvcc.sh
@@ -37,17 +37,17 @@
 #
 # ***** END LICENSE BLOCK *****
 
 #
 # GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC
 # format and translated into something sensible for cl or ml.
 #
 
-args="-nologo -W3"
+args="-nologo"
 md=-MD
 cl="cl"
 ml="ml"
 output=
 
 while [ $# -gt 0 ]
 do
   case $1
@@ -103,17 +103,18 @@ do
       includes="$includes $1"
       shift 1
     ;;
     -W|-Wextra)
       # TODO map extra warnings
       shift 1
     ;;
     -Wall)
-      args="$args -Wall"
+      # -Wall on MSVC is overzealous. Use -W3 instead.
+      args="$args -W3"
       shift 1
     ;;
     -Werror)
       args="$args -WX"
       shift 1
     ;;
     -W*)
       # TODO map specific warnings
diff --git a/src/powerpc/ffi_darwin.c b/src/powerpc/ffi_darwin.c
--- a/src/powerpc/ffi_darwin.c
+++ b/src/powerpc/ffi_darwin.c
@@ -339,17 +339,17 @@ aix_adjust_aggregate_sizes (ffi_type *s)
   /* Do not add additional tail padding.  */
 }
 
 /* Perform machine dependent cif processing.  */
 ffi_status
 ffi_prep_cif_machdep (ffi_cif *cif)
 {
   /* All this is for the DARWIN ABI.  */
-  int i;
+  unsigned i;
   ffi_type **ptr;
   unsigned bytes;
   int fparg_count = 0, intarg_count = 0;
   unsigned flags = 0;
   unsigned size_al = 0;
 
   /* All the machine-independent calculation of cif->bytes will be wrong.
      All the calculation of structure sizes will also be wrong.
@@ -537,21 +537,21 @@ ffi_call (ffi_cif *cif, void (*fn)(void)
     }
   else
     ecif.rvalue = rvalue;
 
   switch (cif->abi)
     {
     case FFI_AIX:
       ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
-		   ffi_prep_args);
+		   FFI_FN(ffi_prep_args));
       break;
     case FFI_DARWIN:
       ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn,
-		      ffi_prep_args);
+		      FFI_FN(ffi_prep_args));
       break;
     default:
       FFI_ASSERT(0);
       break;
     }
 }
 
 static void flush_icache(char *);
@@ -794,32 +794,32 @@ ffi_closure_helper_DARWIN (ffi_closure *
 	  break;
 
 	case FFI_TYPE_STRUCT:
 #ifdef POWERPC64
 	  size_al = arg_types[i]->size;
 	  if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
 	    size_al = ALIGN (arg_types[i]->size, 8);
 	  if (size_al < 3 && cif->abi == FFI_DARWIN)
-	    avalue[i] = (void *) pgr + 8 - size_al;
+	    avalue[i] = (char *) pgr + 8 - size_al;
 	  else
-	    avalue[i] = (void *) pgr;
+	    avalue[i] = pgr;
 	  pgr += (size_al + 7) / 8;
 #else
 	  /* Structures that match the basic modes (QI 1 byte, HI 2 bytes,
 	     SI 4 bytes) are aligned as if they were those modes.  */
 	  size_al = arg_types[i]->size;
 	  /* If the first member of the struct is a double, then align
 	     the struct to double-word.  */
 	  if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE)
 	    size_al = ALIGN(arg_types[i]->size, 8);
 	  if (size_al < 3 && cif->abi == FFI_DARWIN)
-	    avalue[i] = (void*) pgr + 4 - size_al;
+	    avalue[i] = (char*) pgr + 4 - size_al;
 	  else
-	    avalue[i] = (void*) pgr;
+	    avalue[i] = pgr;
 	  pgr += (size_al + 3) / 4;
 #endif
 	  break;
 
 	case FFI_TYPE_SINT64:
 	case FFI_TYPE_UINT64:
 #ifdef POWERPC64
 	case FFI_TYPE_POINTER:
diff --git a/src/x86/ffi.c b/src/x86/ffi.c
--- a/src/x86/ffi.c
+++ b/src/x86/ffi.c
@@ -204,17 +204,17 @@ ffi_status ffi_prep_cif_machdep(ffi_cif 
       else if (cif->rtype->size == 8)
         {
           cif->flags = FFI_TYPE_SINT64; /* same as int64 type */
         }
       else
 #endif
         {
           cif->flags = FFI_TYPE_STRUCT;
-          // allocate space for return value pointer
+          /* allocate space for return value pointer */
           cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG);
         }
       break;
 
     default:
 #ifdef X86_WIN64
       cif->flags = FFI_TYPE_SINT64;
       break;
@@ -229,17 +229,17 @@ ffi_status ffi_prep_cif_machdep(ffi_cif 
   for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++)
     {
       if (((*ptr)->alignment - 1) & cif->bytes)
         cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment);
       cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG);
     }
 
 #ifdef X86_WIN64
-  // ensure space for storing four registers
+  /* ensure space for storing four registers */
   cif->bytes += 4 * sizeof(ffi_arg);
 #endif
 
 #ifdef X86_DARWIN
   cif->bytes = (cif->bytes + 15) & ~0xF;
 #endif
 
   return FFI_OK;
@@ -287,18 +287,18 @@ void ffi_call(ffi_cif *cif, void (*fn)(v
     ecif.rvalue = rvalue;
     
   
   switch (cif->abi) 
     {
 #ifdef X86_WIN64
     case FFI_WIN64:
       {
-        // Make copies of all struct arguments
-        // NOTE: not sure if responsibility should be here or in caller
+        /* Make copies of all struct arguments
+           NOTE: not sure if responsibility should be here or in caller */
         unsigned int i;
         for (i=0; i < cif->nargs;i++) {
           size_t size = cif->arg_types[i]->size;
           if ((cif->arg_types[i]->type == FFI_TYPE_STRUCT
                && (size != 1 && size != 2 && size != 4 && size != 8))
 #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
               || cif->arg_types[i]->type == FFI_TYPE_LONGDOUBLE
 #endif
diff --git a/src/x86/ffitarget.h b/src/x86/ffitarget.h
--- a/src/x86/ffitarget.h
+++ b/src/x86/ffitarget.h
@@ -33,17 +33,17 @@
 
 #if defined (X86_64) && defined (__i386__)
 #undef X86_64
 #define X86
 #endif
 
 #ifdef X86_WIN64
 #define FFI_SIZEOF_ARG 8
-#define USE_BUILTIN_FFS 0 // not yet implemented in mingw-64 
+#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */
 #endif
 
 /* ---- Generic type definitions ----------------------------------------- */
 
 #ifndef LIBFFI_ASM
 #ifdef X86_WIN64
 #ifdef _MSC_VER
 typedef unsigned __int64       ffi_arg;

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