Fix -Wsign-compare warnings in x86/ffi64.c

This was originally reported on the Python tracker:

  httpa://bugs.python.org/issue23958

The original patch was written by Steve R. Hastings.

I've updated it to current master of libffi.
This commit is contained in:
Berker Peksag
2016-03-05 09:58:38 +02:00
parent a44a5b863a
commit 4a677a425c

View File

@@ -219,7 +219,7 @@ classify_argument (ffi_type *type, enum x86_64_reg_class classes[],
const size_t UNITS_PER_WORD = 8; const size_t UNITS_PER_WORD = 8;
size_t words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; size_t words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
ffi_type **ptr; ffi_type **ptr;
int i; unsigned int i;
enum x86_64_reg_class subclasses[MAX_CLASSES]; enum x86_64_reg_class subclasses[MAX_CLASSES];
/* If the struct is larger than 32 bytes, pass it on the stack. */ /* If the struct is larger than 32 bytes, pass it on the stack. */
@@ -350,7 +350,8 @@ examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES],
_Bool in_return, int *pngpr, int *pnsse) _Bool in_return, int *pngpr, int *pnsse)
{ {
size_t n; size_t n;
int i, ngpr, nsse; unsigned int i;
int ngpr, nsse;
n = classify_argument (type, classes, 0); n = classify_argument (type, classes, 0);
if (n == 0) if (n == 0)
@@ -611,7 +612,7 @@ ffi_call_int (ffi_cif *cif, void (*fn)(void), void *rvalue,
{ {
/* The argument is passed entirely in registers. */ /* The argument is passed entirely in registers. */
char *a = (char *) avalue[i]; char *a = (char *) avalue[i];
int j; unsigned int j;
for (j = 0; j < n; j++, a += 8, size -= 8) for (j = 0; j < n; j++, a += 8, size -= 8)
{ {
@@ -808,7 +809,7 @@ ffi_closure_unix64_inner(ffi_cif *cif,
else else
{ {
char *a = alloca (16); char *a = alloca (16);
int j; unsigned int j;
avalue[i] = a; avalue[i] = a;
for (j = 0; j < n; j++, a += 8) for (j = 0; j < n; j++, a += 8)