Merge pull request #122 from asvitkine/cleanz

Fix various compiler warnings with Xcode builds.
This commit is contained in:
kanjitalk755 2022-04-05 15:14:57 +09:00 committed by GitHub
commit fcf2c1d9b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 78 additions and 97 deletions

View File

@ -305,6 +305,7 @@ static void Blit_Copy_Raw(uint8 * dest, const uint8 * source, uint32 length)
#define FB_DEPTH 24
#include "video_blit.h"
#if !(REAL_ADDRESSING || DIRECT_ADDRESSING || USE_SDL_VIDEO)
/* -------------------------------------------------------------------------- */
/* --- 1-bit indexed to 8-bit color mode conversion --- */
/* -------------------------------------------------------------------------- */
@ -325,6 +326,7 @@ static void Blit_Expand_1_To_8_Color(uint8 * dest, const uint8 * p, uint32 lengt
*q++ = CONVERT_BW(c & 1);
}
}
#endif
/* -------------------------------------------------------------------------- */
/* --- 1/2/4-bit indexed to 8-bit mode conversion --- */

View File

@ -47,7 +47,6 @@ FILE * run_tool(const char *if_name, const char *tool_name)
OSStatus auth_status;
FILE *fp = NULL;
char *args[] = {NULL, NULL, NULL};
int ret;
char path_buffer[256];
AuthorizationFlags auth_flags;
AuthorizationRef auth_ref;

View File

@ -150,7 +150,9 @@ static SDL_Texture * sdl_texture = NULL; // Handle to a GPU texture, with whic
static SDL_Rect sdl_update_video_rect = {0,0,0,0}; // Union of all rects to update, when updating sdl_texture
static SDL_mutex * sdl_update_video_mutex = NULL; // Mutex to protect sdl_update_video_rect
static int screen_depth; // Depth of current screen
#ifdef SHEEPSHAVER
static SDL_Cursor *sdl_cursor = NULL; // Copy of Mac cursor
#endif
static SDL_Palette *sdl_palette = NULL; // Color palette to be used as CLUT and gamma table
static bool sdl_palette_changed = false; // Flag: Palette changed, redraw thread must set new colors
static bool toggle_fullscreen = false;
@ -411,6 +413,7 @@ public:
* Utility functions
*/
#ifdef SHEEPSHAVER
// Find palette size for given color depth
static int palette_size(int mode)
{
@ -424,6 +427,7 @@ static int palette_size(int mode)
default: return 0;
}
}
#endif
// Map video_mode depth ID to numerical depth value
static int mac_depth_of_video_depth(int video_depth)
@ -1938,11 +1942,12 @@ int16 video_mode_change(VidLocals *csSave, uint32 ParamPtr)
}
#endif
static bool is_cursor_in_mac_screen() {
int windowX, windowY;
int cursorX, cursorY;
int deltaX, deltaY;
#ifdef SHEEPSHAVER
static bool is_cursor_in_mac_screen()
{
int windowX, windowY;
int cursorX, cursorY;
int deltaX, deltaY;
bool out;
// TODO figure out a check for full screen mode
@ -1969,7 +1974,8 @@ static bool is_cursor_in_mac_screen() {
return false;
}
#endif
void SDL_monitor_desc::switch_to_current_mode(void)
{
// Close and reopen display
@ -2803,7 +2809,7 @@ static int redraw_func(void *arg)
{
uint64 start = GetTicks_usec();
int64 ticks = 0;
uint64 next = GetTicks_usec() + VIDEO_REFRESH_DELAY;
uint64 next = start + VIDEO_REFRESH_DELAY;
while (!redraw_thread_cancel) {
@ -2826,8 +2832,10 @@ static int redraw_func(void *arg)
do_video_refresh();
}
#if DEBUG
uint64 end = GetTicks_usec();
D(bug("%lld refreshes in %lld usec = %f refreshes/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
#endif
return 0;
}
#endif

View File

@ -251,11 +251,12 @@ void *vm_acquire_mac(size_t size)
return vm_acquire(size, VM_MAP_DEFAULT | VM_MAP_32BIT);
}
#ifndef PAGEZERO_HACK
static int vm_acquire_mac_fixed(void *addr, size_t size)
{
return vm_acquire_fixed(addr, size, VM_MAP_DEFAULT | VM_MAP_32BIT);
}
#endif
/*
* SIGSEGV handler
@ -1277,7 +1278,7 @@ static void *tick_func(void *arg)
{
uint64 start = GetTicks_usec();
int64 ticks = 0;
uint64 next = GetTicks_usec();
uint64 next = start;
while (!tick_thread_cancel) {
one_tick();
next += 16625;
@ -1288,8 +1289,10 @@ static void *tick_func(void *arg)
next = GetTicks_usec();
ticks++;
}
#if DEBUG
uint64 end = GetTicks_usec();
D(bug("%lld ticks in %lld usec = %f ticks/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
#endif
return NULL;
}
#endif

View File

@ -353,7 +353,6 @@ void ADBInterrupt(void)
int my = mouse_y;
if (relative_mouse)
mouse_x = mouse_y = 0;
bool mb[3] = {mouse_button[0], mouse_button[1], mouse_button[2]};
B2_unlock_mutex(mouse_lock);
uint32 key_base = adb_base + 4;

View File

@ -203,8 +203,10 @@ static void find_hfs_partition(cdrom_drive_info &info)
// Partition map block found, Apple HFS partition?
if (strcmp((char *)(map + 48), "Apple_HFS") == 0) {
info.start_byte = (loff_t)((map[8] << 24) | (map[9] << 16) | (map[10] << 8) | map[11]) << 9;
#if DEBUG
uint32 num_blocks = (map[12] << 24) | (map[13] << 16) | (map[14] << 8) | map[15];
D(bug(" HFS partition found at %d, %d blocks\n", info.start_byte, num_blocks));
#endif
break;
}
}

View File

@ -201,12 +201,12 @@ end_error:
#define ICMP_MAXDATALEN (IP_MSS-28)
void
icmp_error(msrc, type, code, minsize, message)
struct mbuf *msrc;
u_char type;
u_char code;
int minsize;
char *message;
icmp_error(
struct mbuf *msrc,
u_char type,
u_char code,
int minsize,
char *message)
{
unsigned hlen, shlen, s_ip_len;
register struct ip *ip;

View File

@ -51,6 +51,8 @@
#include <slirp.h>
#include "ip_icmp.h"
static struct ip *ip_reass(register struct ip *ip, register struct ipq *fp);
int ip_defttl;
struct ipstat ipstat;
struct ipq ipq;

View File

@ -332,8 +332,6 @@ void if_output _P((struct socket *, struct mbuf *));
/* ip_input.c */
void ip_init _P((void));
void ip_input _P((struct mbuf *));
static struct ip *
ip_reass(register struct ip *ip, register struct ipq *);
void ip_freef _P((struct ipq *));
void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
void ip_deq _P((register struct ipasfrag *));

View File

@ -644,8 +644,8 @@ tcp_emu(so, m)
DEBUG_ARG("so = %lx", (long)so);
DEBUG_ARG("m = %lx", (long)m);
int x, i;
switch(so->so_emu) {
int x, i;
case EMU_IDENT:
/*

View File

@ -47,7 +47,11 @@
#define USE_MATCH 0
/* kludge for Brian, so he can compile under MSVC++ */
#define USE_NORMAL_CALLING_CONVENTION 1 && defined(_MSC_VER)
#if defined(_MSC_VER)
#define USE_NORMAL_CALLING_CONVENTION 1
#else
#define USE_NORMAL_CALLING_CONVENTION 0
#endif
#ifndef WIN32
#include <unistd.h>
@ -723,10 +727,6 @@ static __inline__ void alloc_blockinfos(void)
static uae_u8* target;
static void emit_init(void)
{
}
static __inline__ void emit_byte(uae_u8 x)
{
*target++=x;
@ -6478,11 +6478,6 @@ void flush_icache_range(uae_u8 *start_p, uae_u32 length)
flush_icache(-1);
}
static void catastrophe(void)
{
abort();
}
int failure;
#define TARGET_M68K 0

View File

@ -163,47 +163,6 @@ finish_braces (void)
close_brace ();
}
static void
pop_braces (int to)
{
while (n_braces > to)
close_brace ();
}
static int
bit_size (int size)
{
switch (size)
{
case sz_byte:
return 8;
case sz_word:
return 16;
case sz_long:
return 32;
default:
abort ();
}
return 0;
}
static const char *
bit_mask (int size)
{
switch (size)
{
case sz_byte:
return "0xff";
case sz_word:
return "0xffff";
case sz_long:
return "0xffffffff";
default:
abort ();
}
return 0;
}
static __inline__ void gen_update_next_handler(void)
{
return; /* Can anything clever be done here? */

View File

@ -1249,12 +1249,11 @@ static void rts68000()
void REGPARAM2 op_illg (uae_u32 opcode)
{
uaecptr pc = m68k_getpc ();
if ((opcode & 0xF000) == 0xA000) {
#if 0
if (opcode == 0xa0ff)
{
uaecptr pc = m68k_getpc();
uae_u32 call = ReadHWMemInt32(pc + 2);
switch (call)
{
@ -1274,7 +1273,7 @@ void REGPARAM2 op_illg (uae_u32 opcode)
return;
}
D(bug("Illegal instruction: %04x at %08x", opcode, pc));
D(bug("Illegal instruction: %04x at %08x", opcode, m68k_getpc()));
#if defined(USE_JIT) && defined(JIT_DEBUG)
compiler_dumpstate();
#endif

View File

@ -254,8 +254,10 @@ uintptr SheepMem::data; // Top of SheepShaver data (stack like storage)
// Prototypes
#if !defined(__APPLE__) || !defined(__x86_64__)
static bool kernel_data_init(void);
static bool shm_map_address(int kernel_area, uint32 addr);
#endif
static void Quit(void);
static void *emul_func(void *arg);
static void *nvram_func(void *arg);
@ -1224,7 +1226,7 @@ static void Quit(void)
exit(0);
}
#if !defined(__APPLE__) || !defined(__x86_64__)
/*
* Initialize Kernel Data segments
*/
@ -1255,7 +1257,6 @@ static bool kernel_data_init(void)
return false;
}
/*
* Maps the memory identified by kernel_area at the specified addr
*/
@ -1265,6 +1266,7 @@ static bool shm_map_address(int kernel_area, uint32 addr)
void *kernel_addr = Mac2HostAddr(addr);
return shmat(kernel_area, kernel_addr, 0) == kernel_addr;
}
#endif // !defined(__APPLE__) || !defined(__x86_64__)
/*
@ -1425,7 +1427,7 @@ static void *tick_func(void *arg)
int tick_counter = 0;
uint64 start = GetTicks_usec();
int64 ticks = 0;
uint64 next = GetTicks_usec();
uint64 next = start;
while (!tick_thread_cancel) {
@ -1495,7 +1497,7 @@ static void *tick_func(void *arg)
}
}
uint64 end = GetTicks_usec();
D(uint64 end = GetTicks_usec());
D(bug("%lld ticks in %lld usec = %f ticks/sec\n", ticks, end - start, ticks * 1000000.0 / (end - start)));
return NULL;
}

View File

@ -180,12 +180,14 @@ mblk_t *allocb(size_t arg1, int arg2)
{
return (mblk_t *)Mac2HostAddr((uint32)CallMacOS2(allocb_ptr, allocb_tvect, arg1, arg2));
}
#if 0
typedef void (*freeb_ptr)(mblk_t *);
static uint32 freeb_tvect = 0;
static inline void freeb(mblk_t *arg1)
{
CallMacOS1(freeb_ptr, freeb_tvect, arg1);
}
#endif
typedef int16 (*freemsg_ptr)(mblk_t *);
static uint32 freemsg_tvect = 0;
static inline int16 freemsg(mblk_t *arg1)
@ -323,10 +325,12 @@ static uint8 InitStreamModuleImpl(void *theID)
D(bug("allocb TVECT at %08lx\n", allocb_tvect));
if (allocb_tvect == 0)
return false;
#if 0
freeb_tvect = FindLibSymbol("\013OTKernelLib", "\005freeb");
D(bug("freeb TVECT at %08lx\n", freeb_tvect));
if (freeb_tvect == 0)
return false;
#endif
freemsg_tvect = FindLibSymbol("\013OTKernelLib", "\007freemsg");
D(bug("freemsg TVECT at %08lx\n", freemsg_tvect));
if (freemsg_tvect == 0)

View File

@ -100,6 +100,24 @@ basic_dyngen::gen_align(int align)
return code_ptr();
#if defined(__i386__) || defined(__x86_64__)
#if defined(__x86_64__)
static const uint8 prefixes[4] = { 0x66, 0x66, 0x66, 0x66 };
/* The recommended way to pad 64bit code is to use NOPs preceded by
maximally four 0x66 prefixes. Balance the size of nops. */
int i;
int nnops = (nbytes + 3) / 4;
int len = nbytes / nnops;
int remains = nbytes - nnops * len;
for (i = 0; i < remains; i++) {
emit_block(prefixes, len);
emit_8(0x90); // NOP
}
for (; i < nnops; i++) {
emit_block(prefixes, len - 1);
emit_8(0x90); // NOP
}
#else
/* Source: GNU Binutils 2.12.90.0.15 */
/* Various efficient no-op patterns for aligning code labels.
Note: Don't try to assemble the instructions in the comments.
@ -151,24 +169,6 @@ basic_dyngen::gen_align(int align)
f32_9, f32_10, f32_11, f32_12, f32_13, f32_14, f32_15
};
#if defined(__x86_64__)
static const uint8 prefixes[4] = { 0x66, 0x66, 0x66, 0x66 };
/* The recommended way to pad 64bit code is to use NOPs preceded by
maximally four 0x66 prefixes. Balance the size of nops. */
int i;
int nnops = (nbytes + 3) / 4;
int len = nbytes / nnops;
int remains = nbytes - nnops * len;
for (i = 0; i < remains; i++) {
emit_block(prefixes, len);
emit_8(0x90); // NOP
}
for (; i < nnops; i++) {
emit_block(prefixes, len - 1);
emit_8(0x90); // NOP
}
#else
int nloops = nbytes / 16;
while (nloops-- > 0)
emit_block(f32_16, sizeof(f32_16));

View File

@ -44,6 +44,7 @@
// Define to enable const branches optimization
#define FOLLOW_CONST_JUMPS 1
#if PPC_ENABLE_JIT
// FIXME: define ROM areas
static inline bool is_read_only_memory(uintptr addr)
{
@ -53,7 +54,9 @@ static inline bool is_read_only_memory(uintptr addr)
#endif
return false;
}
#endif
#if DYNGEN_DIRECT_BLOCK_CHAINING
// Returns TRUE if we can directly generate a jump to the target block
// XXX mixing front-end and back-end conditions is not a very good idea...
static inline bool direct_chaining_possible(uint32 bpc, uint32 tpc)
@ -63,7 +66,7 @@ static inline bool direct_chaining_possible(uint32 bpc, uint32 tpc)
#endif
return ((bpc ^ tpc) >> 12) == 0 || is_read_only_memory(tpc);
}
#endif
/**
* Basic block disassemblers

View File

@ -54,12 +54,14 @@ static inline int16 FindSymbol(uint32 arg1, uintptr arg2, uintptr arg3, uintptr
{
return (int16)CallMacOS4(fs_ptr, fs_tvect, arg1, (char *)arg2, (void **)arg3, (uint32 **)arg4);
}
#if 0
typedef int16 (*cc_ptr)(uint32 *);
static uint32 cc_tvect = 0;
static inline int16 CloseConnection(uint32 *arg1)
{
return (int16)CallMacOS1(cc_ptr, cc_tvect, arg1);
}
#endif
typedef uint32 (*nps_ptr)(uint32);
static uint32 nps_tvect = 0;
static inline uint32 NewPtrSys(uint32 arg1)
@ -83,7 +85,9 @@ void MacOSUtilReset(void)
cu_tvect = 0;
gsl_tvect = 0;
fs_tvect = 0;
#if 0
cc_tvect = 0;
#endif
}
@ -337,12 +341,14 @@ void InitCallUniversalProc()
QuitEmulator();
}
#if 0
cc_tvect = FindLibSymbol("\014InterfaceLib", "\017CloseConnection");
D(bug("CloseConnection TVECT at %08lx\n", cc_tvect));
if (cc_tvect == 0) {
printf("FATAL: Can't find CloseConnection()\n");
QuitEmulator();
}
#endif
nps_tvect = FindLibSymbol("\014InterfaceLib", "\011NewPtrSys");
D(bug("NewPtrSys TVECT at %08lx\n", nps_tvect));