Commit 1d661de0943330b20a0b8dc938d17c0e742a2b89
authorSami Liedes <sliedes@cc.hut.fi>
Wed, 23 Feb 2011 00:03:13 +0000 (02:03 +0200)
committerMichel Pollet <buserror@gmail.com>
Wed, 23 Feb 2011 00:48:45 +0000 (00:48 +0000)
The addition of -Werror to the compilation flags broke building on
64-bit hosts because casts between pointers and integers of different
sizes cause warnings on gcc -Wall. Fix this by always casting the
pointers to intptr_t first.

Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
simavr/sim/sim_io.c

index f3df7a5f797be761020209181bff5b6d1afb7c62..2fa455be6dc214a14009c93ece3747f47982e155 100644 (file)
@@ -24,6 +24,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
+#include <stdint.h>
 #include "sim_io.h"
 
 int
@@ -81,7 +82,7 @@ _avr_io_mux_write(
                uint8_t v,
                void * param)
 {
-       int io = (int)param;
+       int io = (intptr_t)param;
        for (int i = 0; i < avr->io_shared_io[io].used; i++) {
                avr_io_write_t c = avr->io_shared_io[io].io[i].c;
                if (c)
@@ -118,10 +119,10 @@ avr_register_io_write(
                                avr->io_shared_io[no].used = 1;
                                avr->io_shared_io[no].io[0].param = avr->io[a].w.param;
                                avr->io_shared_io[no].io[0].c = avr->io[a].w.c;
-                               avr->io[a].w.param = (void*)no;
+                               avr->io[a].w.param = (void*)(intptr_t)no;
                                avr->io[a].w.c = _avr_io_mux_write;
                        }
-                       int no = (int)avr->io[a].w.param;
+                       int no = (intptr_t)avr->io[a].w.param;
                        int d = avr->io_shared_io[no].used++;
                        if (avr->io_shared_io[no].used > 4) {
                                fprintf(stderr,