From dea35993f4e8257294eb1e8b27a8416b7a401beb Mon Sep 17 00:00:00 2001 From: Sami Liedes <sliedes@cc.hut.fi> Date: Sat, 5 Feb 2011 15:56:33 +0200 Subject: [PATCH] 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 <sliedes@cc.hut.fi> --- simavr/sim/sim_avr.h | 4 ++++ simavr/sim/sim_core.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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 <stdint.h> +#include <inttypes.h> #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",\ -- 2.39.5