From 1f5465ad771653b55c1824b84a173ad3ce6d8cb8 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Tue, 5 Apr 2022 15:15:26 -0400 Subject: [PATCH] Resolve more compiler warnings in Xcode projects. --- BasiliskII/src/MacOSX/extfs_macosx.cpp | 4 +- BasiliskII/src/Unix/main_unix.cpp | 2 +- BasiliskII/src/bincue.cpp | 4 +- BasiliskII/src/emul_op.cpp | 2 +- .../src/uae_cpu/compiler/compemu_support.cpp | 49 ++----------------- BasiliskII/src/uae_cpu/compiler/gencomp.c | 43 ---------------- BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp | 24 ++++----- BasiliskII/src/uae_cpu/newcpu.cpp | 4 ++ BasiliskII/src/uae_cpu_2021/newcpu.cpp | 11 ++++- 9 files changed, 36 insertions(+), 107 deletions(-) diff --git a/BasiliskII/src/MacOSX/extfs_macosx.cpp b/BasiliskII/src/MacOSX/extfs_macosx.cpp index 0521c07f..2d316df1 100644 --- a/BasiliskII/src/MacOSX/extfs_macosx.cpp +++ b/BasiliskII/src/MacOSX/extfs_macosx.cpp @@ -420,9 +420,9 @@ void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir) // No native Finder info, translate file name extension to MacOS type/creator if (!is_dir) { - int path_len = strlen(path); + size_t path_len = strlen(path); for (int i=0; e2t_translation[i].ext; i++) { - int ext_len = strlen(e2t_translation[i].ext); + size_t ext_len = strlen(e2t_translation[i].ext); if (path_len < ext_len) continue; if (!strcmp(path + path_len - ext_len, e2t_translation[i].ext)) { diff --git a/BasiliskII/src/Unix/main_unix.cpp b/BasiliskII/src/Unix/main_unix.cpp index 3e1bb4ff..d295b7f6 100755 --- a/BasiliskII/src/Unix/main_unix.cpp +++ b/BasiliskII/src/Unix/main_unix.cpp @@ -251,7 +251,7 @@ void *vm_acquire_mac(size_t size) return vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT); } -#ifndef PAGEZERO_HACK +#if REAL_ADDRESSING static int vm_acquire_mac_fixed(void *addr, size_t size) { return vm_acquire_fixed(addr, size, VM_MAP_DEFAULT | VM_MAP_32BIT); diff --git a/BasiliskII/src/bincue.cpp b/BasiliskII/src/bincue.cpp index a500811f..d11d0b2a 100644 --- a/BasiliskII/src/bincue.cpp +++ b/BasiliskII/src/bincue.cpp @@ -113,7 +113,7 @@ typedef struct { int header_size; // Number of bytes used in header } CueSheet; -typedef struct { +typedef struct CDPlayer { CueSheet *cs; // cue sheet to play from int audiofh; // file handle for audio data unsigned int audioposition; // current position from audiostart (bytes) @@ -921,7 +921,6 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player) player->audioposition += remaining_silence; } - int ret = 0; int available = ((player->audioend - player->audiostart) * player->cs->raw_sector_size) - player->audioposition; if (available > (stream_len - offset)) @@ -937,6 +936,7 @@ static uint8 *fill_buffer(int stream_len, CDPlayer* player) available = 0; } + ssize_t ret = 0; if ((ret = read(player->audiofh, &buf[offset], available)) >= 0) { player->audioposition += ret; offset += ret; diff --git a/BasiliskII/src/emul_op.cpp b/BasiliskII/src/emul_op.cpp index e18b40bc..98d079af 100644 --- a/BasiliskII/src/emul_op.cpp +++ b/BasiliskII/src/emul_op.cpp @@ -120,7 +120,7 @@ void EmulOp(uint16 opcode, M68kRegisters *r) bool is_read = (r->d[1] & 0x80) != 0; if ((r->d[1] & 0x78) == 0x38) { // XPRAM - uint8 reg = (r->d[1] << 5) & 0xe0 | (r->d[1] >> 10) & 0x1f; + uint8 reg = ((r->d[1] << 5) & 0xe0) | ((r->d[1] >> 10) & 0x1f); if (is_read) { r->d[2] = XPRAM[reg]; bool localtalk = !(XPRAM[0xe0] || XPRAM[0xe1]); // LocalTalk enabled? diff --git a/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp b/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp index a5c5c459..8df56956 100644 --- a/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp +++ b/BasiliskII/src/uae_cpu/compiler/compemu_support.cpp @@ -370,12 +370,6 @@ static __inline__ void remove_from_list(blockinfo* bi) bi->next->prev_p=bi->prev_p; } -static __inline__ void remove_from_lists(blockinfo* bi) -{ - remove_from_list(bi); - remove_from_cl_list(bi); -} - static __inline__ void add_to_cl_list(blockinfo* bi) { uae_u32 cl=cacheline(bi->pc_p); @@ -744,12 +738,6 @@ static __inline__ void emit_long(uae_u32 x) target+=4; } -static __inline__ void emit_quad(uae_u64 x) -{ - *((uae_u64*)target)=x; - target+=8; -} - static __inline__ void emit_block(const uae_u8 *block, uae_u32 blocklen) { memcpy((uae_u8 *)target,block,blocklen); @@ -887,16 +875,6 @@ static inline void ru_set_write(regusage *ru, int reg) ru_set(&ru->wmask, reg); } -static inline bool ru_read_p(const regusage *ru, int reg) -{ - return ru_get(&ru->rmask, reg); -} - -static inline bool ru_write_p(const regusage *ru, int reg) -{ - return ru_get(&ru->wmask, reg); -} - static void ru_fill_ea(regusage *ru, int reg, amodes mode, wordsizes size, int write_mode) { @@ -1099,6 +1077,7 @@ static uae_s8 nstate[N_REGS]; #define L_NEEDED -2 #define L_UNNEEDED -3 +#if USE_MATCH static __inline__ void big_to_small_state(bigstate * b, smallstate * s) { int i; @@ -1131,6 +1110,7 @@ static __inline__ int callers_need_recompile(bigstate * b, smallstate * s) * callers */ return 0; } +#endif static __inline__ void log_startblock(void) { @@ -1167,11 +1147,6 @@ static __inline__ void do_load_reg(int n, int r) raw_mov_l_rm(n, (uintptr) live.state[r].mem); } -static __inline__ void check_load_reg(int n, int r) -{ - raw_mov_l_rm(n, (uintptr) live.state[r].mem); -} - static __inline__ void log_vwrite(int r) { vwritten[r] = 1; @@ -1518,11 +1493,6 @@ static int alloc_reg_hinted(int r, int size, int willclobber, int hint) return bestreg; } -static int alloc_reg(int r, int size, int willclobber) -{ - return alloc_reg_hinted(r,size,willclobber,-1); -} - static void unlock2(int r) { Dif (!live.nat[r].locked) @@ -5437,14 +5407,6 @@ void register_branch(uae_u32 not_taken, uae_u32 taken, uae_u8 cond) branch_cc=cond; } - -static uae_u32 get_handler_address(uae_u32 addr) -{ - uae_u32 cl=cacheline(addr); - blockinfo* bi=get_blockinfo_addr_new((void*)(uintptr)addr,0); - return (uintptr)&(bi->direct_handler_to_use); -} - static uae_u32 get_handler(uae_u32 addr) { uae_u32 cl=cacheline(addr); @@ -5452,11 +5414,6 @@ static uae_u32 get_handler(uae_u32 addr) return (uintptr)bi->direct_handler_to_use; } -static void load_handler(int reg, uae_u32 addr) -{ - mov_l_rm(reg,get_handler_address(addr)); -} - /* This version assumes that it is writing *real* memory, and *will* fail * if that assumption is wrong! No branches, no second chances, just * straight go-for-it attitude */ @@ -6536,6 +6493,7 @@ void disasm_block(int target, uint8 * start, size_t length) #endif } +#if JIT_DEBUG static void disasm_native_block(uint8 *start, size_t length) { disasm_block(TARGET_NATIVE, start, length); @@ -6545,6 +6503,7 @@ static void disasm_m68k_block(uint8 *start, size_t length) { disasm_block(TARGET_M68K, start, length); } +#endif #ifdef HAVE_GET_WORD_UNSWAPPED # define DO_GET_OPCODE(a) (do_get_mem_word_unswapped((uae_u16 *)(a))) diff --git a/BasiliskII/src/uae_cpu/compiler/gencomp.c b/BasiliskII/src/uae_cpu/compiler/gencomp.c index ca86edf9..cdab734a 100644 --- a/BasiliskII/src/uae_cpu/compiler/gencomp.c +++ b/BasiliskII/src/uae_cpu/compiler/gencomp.c @@ -1095,49 +1095,6 @@ genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst) } } -static void -force_range_for_rox (const char *var, wordsizes size) -{ - /* Could do a modulo operation here... which one is faster? */ - switch (size) - { - case sz_long: - comprintf ("\tif (%s >= 33) %s -= 33;\n", var, var); - break; - case sz_word: - comprintf ("\tif (%s >= 34) %s -= 34;\n", var, var); - comprintf ("\tif (%s >= 17) %s -= 17;\n", var, var); - break; - case sz_byte: - comprintf ("\tif (%s >= 36) %s -= 36;\n", var, var); - comprintf ("\tif (%s >= 18) %s -= 18;\n", var, var); - comprintf ("\tif (%s >= 9) %s -= 9;\n", var, var); - break; - } -} - -static const char * -cmask (wordsizes size) -{ - switch (size) - { - case sz_byte: - return "0x80"; - case sz_word: - return "0x8000"; - case sz_long: - return "0x80000000"; - default: - abort (); - } -} - -static int -source_is_imm1_8 (struct instr *i) -{ - return i->stype == 3; -} - static int /* returns zero for success, non-zero for failure */ gen_opcode (unsigned long int opcode) { diff --git a/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp b/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp index f5a1aeb4..fc882b07 100644 --- a/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp +++ b/BasiliskII/src/uae_cpu/fpu/fpu_ieee.cpp @@ -1768,13 +1768,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) FPU registers[reg] = (double)(FPU registers[reg] * src); } else if (fl_dest.nan || fl_source.nan || - fl_dest.zero && fl_source.infinity || - fl_dest.infinity && fl_source.zero ) { + (fl_dest.zero && fl_source.infinity) || + (fl_dest.infinity && fl_source.zero)) { make_nan( FPU registers[reg] ); } else if (fl_dest.zero || fl_source.zero ) { - if (fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_zero_negative(FPU registers[reg]); } else { @@ -1782,8 +1782,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) } } else { - if( fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_inf_negative(FPU registers[reg]); } else { @@ -1971,13 +1971,13 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) FPU registers[reg] *= src; } else if (fl_dest.nan || fl_source.nan || - fl_dest.zero && fl_source.infinity || - fl_dest.infinity && fl_source.zero ) { + (fl_dest.zero && fl_source.infinity) || + (fl_dest.infinity && fl_source.zero)) { make_nan( FPU registers[reg] ); } else if (fl_dest.zero || fl_source.zero ) { - if (fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_zero_negative(FPU registers[reg]); } else { @@ -1985,8 +1985,8 @@ void FFPU fpuop_arithmetic(uae_u32 opcode, uae_u32 extra) } } else { - if( fl_dest.negative && !fl_source.negative || - !fl_dest.negative && fl_source.negative) { + if ((fl_dest.negative && !fl_source.negative) || + (!fl_dest.negative && fl_source.negative)) { make_inf_negative(FPU registers[reg]); } else { diff --git a/BasiliskII/src/uae_cpu/newcpu.cpp b/BasiliskII/src/uae_cpu/newcpu.cpp index d13a6078..ee13d1db 100644 --- a/BasiliskII/src/uae_cpu/newcpu.cpp +++ b/BasiliskII/src/uae_cpu/newcpu.cpp @@ -919,6 +919,7 @@ int m68k_movec2 (int regno, uae_u32 *regp) return 1; } +#if !defined(uae_s64) static __inline__ int div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem) { @@ -943,6 +944,7 @@ div_unsigned(uae_u32 src_hi, uae_u32 src_lo, uae_u32 div, uae_u32 *quot, uae_u32 *rem = src_hi; return 0; } +#endif void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc) { @@ -1065,6 +1067,7 @@ void m68k_divl (uae_u32 opcode, uae_u32 src, uae_u16 extra, uaecptr oldpc) #endif } +#if !defined(uae_s64) static __inline__ void mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo) { @@ -1083,6 +1086,7 @@ mul_unsigned(uae_u32 src1, uae_u32 src2, uae_u32 *dst_hi, uae_u32 *dst_lo) *dst_lo = lo; *dst_hi = r3; } +#endif void m68k_mull (uae_u32 opcode, uae_u32 src, uae_u16 extra) { diff --git a/BasiliskII/src/uae_cpu_2021/newcpu.cpp b/BasiliskII/src/uae_cpu_2021/newcpu.cpp index b8ffc968..e8c38ada 100644 --- a/BasiliskII/src/uae_cpu_2021/newcpu.cpp +++ b/BasiliskII/src/uae_cpu_2021/newcpu.cpp @@ -662,6 +662,7 @@ static void Interrupt(int nr) SPCFLAGS_SET( SPCFLAG_INT ); } +#if 0 static void SCCInterrupt(int nr) { // fprintf(stderr, "CPU: in SCCInterrupt\n"); @@ -677,6 +678,7 @@ static void MFPInterrupt(int nr) regs.intmask = 6; } +#endif int m68k_move2c (int regno, uae_u32 *regp) { @@ -1055,6 +1057,7 @@ void m68k_emulop_return(void) quit_program = 1; } +#if 0 static void save_regs(struct M68kRegisters &r) { int i; @@ -1076,7 +1079,9 @@ static void save_regs(struct M68kRegisters &r) else r.isp = r.a[7]; } +#endif +#if 0 static void restore_regs(struct M68kRegisters &r) { int i; @@ -1091,6 +1096,7 @@ static void restore_regs(struct M68kRegisters &r) regs.sr = r.sr; MakeFromSR(); } +#endif void m68k_emulop(uae_u32 opcode) { @@ -1148,6 +1154,7 @@ void m68k_natfeat_call(void) } #endif +#if 0 static int m68k_call(uae_u32 pc) { VOLATILE int exc = 0; @@ -1185,6 +1192,7 @@ static uae_u32 m68k_alloca(int size) regs.isp = sp; return sp; } +#endif #if 0 uae_u32 linea68000(volatile uae_u16 opcode) @@ -1234,7 +1242,7 @@ uae_u32 linea68000(volatile uae_u16 opcode) } #endif - +#if 0 static void rts68000() { uae_u32 SP = m68k_getpc() + 6; @@ -1246,6 +1254,7 @@ static void rts68000() m68k_areg(regs, 7) = SP; siglongjmp(*p, 1); } +#endif void REGPARAM2 op_illg (uae_u32 opcode) {