From 073c27df8ec054696c65f73cd2543594b6027ae5 Mon Sep 17 00:00:00 2001 From: shanshe Date: Tue, 13 Apr 2021 09:24:32 +0200 Subject: [PATCH] Silence some compile warnings --- config_file/config_file.c | 2 +- config_file/config_file.h | 6 +++--- emulator.c | 3 ++- input/input.c | 2 +- m68kconf.h | 2 +- m68kdasm.c | 6 +++--- memory_mapped.c | 2 +- platforms/amiga/Gayle.c | 1 + platforms/amiga/amiga-platform.c | 2 +- platforms/amiga/gayle-ide/ide.c | 13 ++++++++++--- platforms/amiga/net/pi-net.c | 3 ++- platforms/amiga/rtg/rtg-gfx.c | 2 +- platforms/amiga/rtg/rtg.c | 10 +++++----- 13 files changed, 32 insertions(+), 22 deletions(-) diff --git a/config_file/config_file.c b/config_file/config_file.c index 1c8ef09..2436ffd 100644 --- a/config_file/config_file.c +++ b/config_file/config_file.c @@ -287,7 +287,7 @@ struct emulator_config *load_config_file(char *filename) { break; case CONFITEM_MAP: { unsigned int maptype = 0, mapsize = 0, mapaddr = 0; - int mirraddr = -1; + unsigned int mirraddr = ((unsigned int)-1); char mapfile[128], mapid[128]; memset(mapfile, 0x00, 128); memset(mapid, 0x00, 128); diff --git a/config_file/config_file.h b/config_file/config_file.h index 37cb0ce..b9fe438 100644 --- a/config_file/config_file.h +++ b/config_file/config_file.h @@ -55,12 +55,12 @@ struct emulator_config { unsigned int cpu_type; unsigned char map_type[MAX_NUM_MAPPED_ITEMS]; - long map_offset[MAX_NUM_MAPPED_ITEMS]; - long map_high[MAX_NUM_MAPPED_ITEMS]; + unsigned long map_offset[MAX_NUM_MAPPED_ITEMS]; + unsigned long map_high[MAX_NUM_MAPPED_ITEMS]; unsigned int map_size[MAX_NUM_MAPPED_ITEMS]; unsigned int rom_size[MAX_NUM_MAPPED_ITEMS]; unsigned char *map_data[MAX_NUM_MAPPED_ITEMS]; - int map_mirror[MAX_NUM_MAPPED_ITEMS]; + unsigned int map_mirror[MAX_NUM_MAPPED_ITEMS]; char *map_id[MAX_NUM_MAPPED_ITEMS]; struct platform_config *platform; diff --git a/emulator.c b/emulator.c index 167e014..1cf79f3 100644 --- a/emulator.c +++ b/emulator.c @@ -230,7 +230,7 @@ cpu_loop: } goto cpu_loop; -stop_cpu_emulation: +//stop_cpu_emulation: printf("[CPU] End of CPU thread\n"); } @@ -332,6 +332,7 @@ key_loop: key_end: printf("[KBD] Keyboard thread ending\n"); + return (void*)NULL; } void stop_cpu_emulation(uint8_t disasm_cur) { diff --git a/input/input.c b/input/input.c index bb5a725..bc59607 100644 --- a/input/input.c +++ b/input/input.c @@ -11,7 +11,7 @@ #define NONE 0x80 -static int lshift = 0, rshift = 0, lctrl = 0, rctrl = 0, lalt = 0, altgr = 0; +static int lshift = 0, rshift = 0,/* lctrl = 0, rctrl = 0,*/ lalt = 0, altgr = 0; extern int mouse_fd; extern int keyboard_fd; diff --git a/m68kconf.h b/m68kconf.h index 0e35575..4122af0 100644 --- a/m68kconf.h +++ b/m68kconf.h @@ -220,6 +220,6 @@ /* ======================================================================== */ /* ============================== END OF FILE ============================= */ -/* =======================================x================================= */ +/* ======================================================================== */ #endif /* M68KCONF__HEADER */ diff --git a/m68kdasm.c b/m68kdasm.c index fbbde31..68d025a 100644 --- a/m68kdasm.c +++ b/m68kdasm.c @@ -404,7 +404,7 @@ static char* make_signed_hex_str_32(uint val) /* make string of immediate value */ static char* get_imm_str_s(uint size) { - static char str[15]; + static char str[25]; if(size == 0) sprintf(str, "#%s", make_signed_hex_str_8(read_imm_8())); else if(size == 1) @@ -416,7 +416,7 @@ static char* get_imm_str_s(uint size) static char* get_imm_str_u(uint size) { - static char str[15]; + static char str[25]; if(size == 0) sprintf(str, "#$%x", read_imm_8() & 0xff); else if(size == 1) @@ -3773,7 +3773,7 @@ unsigned int m68k_disassemble(char* str_buff, unsigned int pc, unsigned int cpu_ char* m68ki_disassemble_quick(unsigned int pc, unsigned int cpu_type) { - static char buff[100]; + static char buff[1000]; buff[0] = 0; m68k_disassemble(buff, pc, cpu_type); return buff; diff --git a/memory_mapped.c b/memory_mapped.c index 3764631..95b2cc8 100644 --- a/memory_mapped.c +++ b/memory_mapped.c @@ -24,7 +24,7 @@ inline int handle_mapped_read(struct emulator_config *cfg, unsigned int addr, un if (cfg->map_type[i] == MAPTYPE_NONE) continue; else if (ovl && cfg->map_type[i] == MAPTYPE_ROM) { - if (cfg->map_mirror[i] != -1 && CHKRANGE(addr, cfg->map_mirror[i], cfg->map_size[i])) { + if (cfg->map_mirror[i] != ((unsigned int)-1) && CHKRANGE(addr, cfg->map_mirror[i], cfg->map_size[i])) { read_addr = cfg->map_data[i] + ((addr - cfg->map_mirror[i]) % cfg->rom_size[i]); goto read_value; } diff --git a/platforms/amiga/Gayle.c b/platforms/amiga/Gayle.c index 55da51a..b7c3011 100644 --- a/platforms/amiga/Gayle.c +++ b/platforms/amiga/Gayle.c @@ -165,6 +165,7 @@ void writeGayleB(unsigned int address, unsigned int value) { goto idewrite8; case GIRQ_4000_OFFSET: gayle_a4k_irq = value; + /* Fallthrough */ case GIRQ_OFFSET: gayle_irq = (gayle_irq & value) | (value & (GAYLE_IRQ_RESET | GAYLE_IRQ_BERR)); return; diff --git a/platforms/amiga/amiga-platform.c b/platforms/amiga/amiga-platform.c index 1ea192f..a5c8c09 100644 --- a/platforms/amiga/amiga-platform.c +++ b/platforms/amiga/amiga-platform.c @@ -476,7 +476,7 @@ void create_platform_amiga(struct platform_config *cfg, char *subsys) { if (subsys) { cfg->subsys = malloc(strlen(subsys) + 1); strcpy(cfg->subsys, subsys); - for (int i = 0; i < strlen(cfg->subsys); i++) { + for (unsigned int i = 0; i < strlen(cfg->subsys); i++) { cfg->subsys[i] = tolower(cfg->subsys[i]); } } diff --git a/platforms/amiga/gayle-ide/ide.c b/platforms/amiga/gayle-ide/ide.c index 9263201..8a70931 100644 --- a/platforms/amiga/gayle-ide/ide.c +++ b/platforms/amiga/gayle-ide/ide.c @@ -77,7 +77,7 @@ const uint8_t ide_magic[9] = { '1','D','E','D','1','5','C','0',0x00 }; - +/* static char *charmap(uint8_t v) { static char cbuf[3]; @@ -108,7 +108,7 @@ static void hexdump(uint8_t *bp) fprintf(stderr, "\n"); } } - +*/ /* FIXME: use proper endian convertors! */ static uint16_t le16(uint16_t v) { @@ -524,6 +524,7 @@ static uint16_t ide_data_in(struct ide_drive *d, int len) static void ide_data_out(struct ide_drive *d, uint16_t v, int len) { + (void)len; if (d->state != IDE_DATA_OUT) { ide_fault(d, "bad data write"); d->taskfile.data = v; @@ -624,6 +625,8 @@ uint8_t ide_read8(struct ide_controller *c, uint8_t r) return c->lba4 | ((c->selected) ? 0x10 : 0x00); case ide_status_r: d->intrq = 0; /* Acked */ + /* Fallthrough */ + /* no break */ case ide_altst_r: return t->status; default: @@ -649,7 +652,7 @@ void ide_write8(struct ide_controller *c, uint8_t r, uint8_t v) } } - uint8_t ve; +// uint8_t ve; switch(r) { case ide_data: @@ -876,7 +879,11 @@ static void make_ascii(uint16_t *p, const char *t, int len) { int i; char *d = (char *)p; +// strncpy(d, t, len); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wstringop-truncation" strncpy(d, t, len); +#pragma GCC diagnostic pop for (i = 0; i < len; i += 2) { char c = *d; diff --git a/platforms/amiga/net/pi-net.c b/platforms/amiga/net/pi-net.c index f19bae1..8eec08c 100644 --- a/platforms/amiga/net/pi-net.c +++ b/platforms/amiga/net/pi-net.c @@ -18,13 +18,14 @@ static const char *op_type_names[4] = { void pinet_init(char *dev) { // Initialize them nets. + (void)dev; } uint8_t PI_MAC[6] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; uint8_t PI_IP[4] = { 192, 168, 1, 9 }; void handle_pinet_write(uint32_t addr, uint32_t val, uint8_t type) { - int32_t r; +// int32_t r; switch (addr & 0xFFFF) { case PINET_CMD_READ: diff --git a/platforms/amiga/rtg/rtg-gfx.c b/platforms/amiga/rtg/rtg-gfx.c index 8cd177f..959ab16 100644 --- a/platforms/amiga/rtg/rtg-gfx.c +++ b/platforms/amiga/rtg/rtg-gfx.c @@ -281,7 +281,7 @@ void rtg_blittemplate(uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint32_t s if (i != -1) { sptr = &cfg->map_data[i][src_addr - cfg->map_offset[i]]; if (realtime_graphics_debug) { - printf("Grabbing data from maping %d - offset %.8X\nData:\n", i, src_addr - cfg->map_offset[i]); + printf("Grabbing data from maping %d - offset %.8lX\nData:\n", i, src_addr - cfg->map_offset[i]); for (int i = 0; i < h; i++) { for (int j = 0; j < t_pitch; j++) { printf("%.2X", sptr[j + (i * t_pitch)]); diff --git a/platforms/amiga/rtg/rtg.c b/platforms/amiga/rtg/rtg.c index a4be069..78cc9fa 100644 --- a/platforms/amiga/rtg/rtg.c +++ b/platforms/amiga/rtg/rtg.c @@ -28,11 +28,11 @@ uint32_t framebuffer_addr = 0; uint32_t framebuffer_addr_adj = 0; static void handle_rtg_command(uint32_t cmd); -static struct timespec f1, f2; +//static struct timespec f1, f2; uint8_t realtime_graphics_debug = 0; extern int cpu_emulation_running; - +/* static const char *op_type_names[OP_TYPE_NUM] = { "BYTE", "WORD", @@ -46,7 +46,7 @@ static const char *rtg_format_names[RTGFMT_NUM] = { "32BPP RGB (RGBA)", "15BPP RGB (555)", }; - +*/ int init_rtg_data() { rtg_mem = calloc(1, 40 * SIZE_MEGA); if (!rtg_mem) { @@ -57,8 +57,8 @@ int init_rtg_data() { return 1; } -extern uint8_t busy, rtg_on; -void rtg_update_screen(); +//extern uint8_t busy, rtg_on; +//void rtg_update_screen(); unsigned int rtg_read(uint32_t address, uint8_t mode) { //printf("%s read from RTG: %.8X\n", op_type_names[mode], address); -- 2.39.2