Re: [AD] asmdef.c

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


Evert Glebbeek wrote:

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?

But it's not a pointer.  It's only an offset into various structures.

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

Do you think we can use %p instead?


Yes, but only if we do "printf("%p", (void*)p->value)". We also have to special case p->value==0, otherwise it is printed as "nil".

Otherwise, I'd rather have a compile
time check to see wether we should use %d or %ld.

IMHO that's too complex for this.

Peter




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