Re: [AD] asmdef.c

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Evert, do you remember why you changed the type of the `value' field in
> src/i386/asmdef.c from int to uintptr_t?

Because a pointer to an unsigned integer is not generally the same size as
an integer (being a pointer). Ironically, I made the change to make asmdef
more AMD64 friendly but somehow failed to spot that warning. Not that the
AMD64 port uses much assembler source...

>  The problem is that in the
> line:
>
>     fprintf(f, "#define %s %d\n", p->name, p->value);
>
> now causes this warning on x86_64:
>
>     ./src/i386/asmdef.c:279: warning: int format, different type arg
> (arg 4)
>
> If we change the %d to a %ld then the warning will show up on 32-bit
> machines.

I can't check the code right now, but if it's actually a pointer, shouldn't
we use the %p format?

> Attached is a patch to revert the uintptr_t to a plain int.

Do you think we can use %p instead? Otherwise, I'd rather have a compile
time check to see wether we should use %d or %ld.

Evert




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/