From: Sami Liedes Date: Sat, 5 Feb 2011 13:56:33 +0000 (+0200) Subject: Silence gcc warnings by using PRIu64 in CRASH() printf(). X-Git-Tag: v1.0a7~16 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=dea35993f4e8257294eb1e8b27a8416b7a401beb;p=sx%2Fsimavr.git Silence gcc warnings by using PRIu64 in CRASH() printf(). Actually we define a PRI_avr_cycle_count preprocessor macro in sim_avr.h in the style of PRI* in inttypes.h. Signed-off-by: Sami Liedes --- diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index a5947b9..3bb7eae 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -23,6 +23,7 @@ #define __SIM_AVR_H__ #include +#include #ifdef __cplusplus extern "C" { @@ -33,6 +34,9 @@ extern "C" { typedef uint64_t avr_cycle_count_t; typedef uint16_t avr_io_addr_t; +// printf() conversion specifier for avr_cycle_count_t +#define PRI_avr_cycle_count PRIu64 + struct avr_t; typedef uint8_t (*avr_io_read_t)(struct avr_t * avr, avr_io_addr_t addr, void * param); typedef void (*avr_io_write_t)(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, void * param); diff --git a/simavr/sim/sim_core.h b/simavr/sim/sim_core.h index dc9e12f..4642bb4 100644 --- a/simavr/sim/sim_core.h +++ b/simavr/sim/sim_core.h @@ -75,7 +75,7 @@ void avr_dump_state(avr_t * avr); #define CRASH() {\ DUMP_REG();\ - printf("*** CYCLE %lld PC %04x\n", avr->cycle, avr->pc);\ + printf("*** CYCLE %" PRI_avr_cycle_count "PC %04x\n", avr->cycle, avr->pc);\ for (int i = OLD_PC_SIZE-1; i > 0; i--) {\ int pci = (avr->old_pci + i) & 0xf;\ printf("\e[31m*** %04x: %-25s RESET -%d; sp %04x\e[0m\n",\