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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/src/x86/ffi64.c b/src/x86/ffi64.c
index f52749e..93dcc35 100644
--- a/src/x86/ffi64.c
+++ b/src/x86/ffi64.c
@@ -219,7 +219,7 @@ classify_argument (ffi_type *type, enum x86_64_reg_class classes[],
const size_t UNITS_PER_WORD = 8;
size_t words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
ffi_type **ptr;
- int i;
+ unsigned int i;
enum x86_64_reg_class subclasses[MAX_CLASSES];
/* 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)
{
size_t n;
- int i, ngpr, nsse;
+ unsigned int i;
+ int ngpr, nsse;
n = classify_argument (type, classes, 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. */
char *a = (char *) avalue[i];
- int j;
+ unsigned int j;
for (j = 0; j < n; j++, a += 8, size -= 8)
{
@@ -808,7 +809,7 @@ ffi_closure_unix64_inner(ffi_cif *cif,
else
{
char *a = alloca (16);
- int j;
+ unsigned int j;
avalue[i] = a;
for (j = 0; j < n; j++, a += 8)