Re: [hatari-devel] WinUAE compiler warnings

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi,

On sunnuntai 15 tammikuu 2012, Eero Tamminen wrote:
> Btw. while likely(?) unrelated, the some of these compiler warnings
> for the WinUAE core look serious:

Attached (untested except that it builds) patch fixes the compiler
warnings except for the const char issue in memory.c and format
string issues.


	- Eero
diff -r 893fc641cba4 src/cpu/cpummu.c
--- a/src/cpu/cpummu.c	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/cpummu.c	Mon Jan 16 01:06:17 2012 +0200
@@ -251,7 +251,7 @@
 #endif
 
 /* {{{ mmu_dump_atc */
-void mmu_dump_atc(void)
+static void mmu_dump_atc(void)
 {
 	int i, j;
 	for (i = 0; i < 2; i++) {
@@ -271,10 +271,10 @@
 void mmu_dump_tables(void)
 {
 	fprintf(stderr, "URP: %08x   SRP: %08x  MMUSR: %x  TC: %x\n", regs.urp, regs.srp, regs.mmusr, regs.tcr);
-	mmu_dump_ttr(L"DTT0", regs.dtt0);
-	mmu_dump_ttr(L"DTT1", regs.dtt1);
-	mmu_dump_ttr(L"ITT0", regs.itt0);
-	mmu_dump_ttr(L"ITT1", regs.itt1);
+	mmu_dump_ttr("DTT0", regs.dtt0);
+	mmu_dump_ttr("DTT1", regs.dtt1);
+	mmu_dump_ttr("ITT0", regs.itt0);
+	mmu_dump_ttr("ITT1", regs.itt1);
 	mmu_dump_atc();
 #if DEBUG
 	mmu_dump_table("SRP", regs.srp);
diff -r 893fc641cba4 src/cpu/custom.c
--- a/src/cpu/custom.c	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/custom.c	Mon Jan 16 01:06:17 2012 +0200
@@ -24,25 +24,17 @@
 
 #define WRITE_LOG_BUF_SIZE 4096
 
-extern struct regstruct mmu_backup_regs;
+extern struct regstruct mmu_backup_regs;	/* declated in newcpu.c */
 static uae_u32 mmu_struct, mmu_callback, mmu_regs;
 static uae_u32 mmu_fault_bank_addr, mmu_fault_addr;
 static int mmu_fault_size, mmu_fault_rw;
 static int mmu_slots;
 static struct regstruct mmur;
 static int userdtsc = 0;
-int qpcdivisor = 0;
-volatile frame_time_t vsyncmintime;
+static int qpcdivisor = 0;
+volatile frame_time_t vsyncmintime; /* declared in events.h, used in events_*.h */
 
-void do_cycles_ce (long cycles);
-
-unsigned long int event_cycles, nextevent, is_lastline, currcycle;
-uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode);
-void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v);
-void wait_cpu_cycle_write_ce020 (uaecptr addr, int mode, uae_u32 v);
-uae_u32 wait_cpu_cycle_read_ce020 (uaecptr addr, int mode);
-frame_time_t read_processor_time_qpf (void);
-frame_time_t read_processor_time_rdtsc (void);
+unsigned long int nextevent, is_lastline, currcycle; /* declared in events.h */
 
 
 typedef struct _LARGE_INTEGER
@@ -59,9 +51,9 @@
 } LARGE_INTEGER, *PLARGE_INTEGER;
 
 uae_u16 dmacon;
-uae_u8 cycle_line[256];
+static uae_u8 cycle_line[256];
 
-struct ev eventtab[ev_max];
+struct ev eventtab[ev_max]; /* declared in events.h, used in events_*.h */
 
 void do_cycles_ce (long cycles)
 {
@@ -231,6 +223,7 @@
 int is_cycle_ce (void)
 {
 	int hpos = current_hpos ();
+	/* TODO: nothing sets cycle_line contents! */
 	return cycle_line[hpos];
 }
 
@@ -371,6 +364,39 @@
 }
 
 /* Code taken from win32.cpp*/
+static frame_time_t read_processor_time_qpf (void)
+{
+#if 0 /* Laurent : may be coded later */
+	LARGE_INTEGER counter;
+	QueryPerformanceCounter (&counter);
+	if (qpcdivisor == 0)
+		return (frame_time_t)(counter.LowPart);
+	return (frame_time_t)(counter.QuadPart >> qpcdivisor);
+#else
+	return 0;
+#endif
+}
+
+/* Code taken from win32.cpp*/
+static frame_time_t read_processor_time_rdtsc (void)
+{
+	frame_time_t foo = 0;
+#if defined(X86_MSVC_ASSEMBLY)
+	frame_time_t bar;
+	__asm
+	{
+		rdtsc
+			mov foo, eax
+			mov bar, edx
+	}
+	/* very high speed CPU's RDTSC might overflow without this.. */
+	foo >>= 6;
+	foo |= bar << 26;
+#endif
+	return foo;
+}
+
+/* Code taken from win32.cpp*/
 frame_time_t read_processor_time (void)
 {
 #if 0
@@ -389,37 +415,6 @@
 }
 
 /* Code taken from win32.cpp*/
-frame_time_t read_processor_time_qpf (void)
-{
-/* Laurent : may be coded later
-	LARGE_INTEGER counter;
-	QueryPerformanceCounter (&counter);
-	if (qpcdivisor == 0)
-		return (frame_time_t)(counter.LowPart);
-	return (frame_time_t)(counter.QuadPart >> qpcdivisor);
-*/
-}
-
-/* Code taken from win32.cpp*/
-frame_time_t read_processor_time_rdtsc (void)
-{
-	frame_time_t foo = 0;
-#if defined(X86_MSVC_ASSEMBLY)
-	frame_time_t bar;
-	__asm
-	{
-		rdtsc
-			mov foo, eax
-			mov bar, edx
-	}
-	/* very high speed CPU's RDTSC might overflow without this.. */
-	foo >>= 6;
-	foo |= bar << 26;
-#endif
-	return foo;
-}
-
-/* Code taken from win32.cpp*/
 void sleep_millis (int ms)
 {
 /* Laurent : may be coded later (DSL-Delay ?)
diff -r 893fc641cba4 src/cpu/custom.h
--- a/src/cpu/custom.h	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/custom.h	Mon Jan 16 01:06:17 2012 +0200
@@ -224,4 +224,10 @@
 extern void sleep_millis (int ms);
 extern void mmu_do_hit (void);
 
+/* referred by prefetch.h */
+extern uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode);
+extern void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v);
+extern uae_u32 wait_cpu_cycle_read_ce020 (uaecptr addr, int mode);
+extern void wait_cpu_cycle_write_ce020 (uaecptr addr, int mode, uae_u32 v);
+
 #endif /* WINUAE_CUSTOM_H */
diff -r 893fc641cba4 src/cpu/md-fpp.h
--- a/src/cpu/md-fpp.h	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/md-fpp.h	Mon Jan 16 01:06:17 2012 +0200
@@ -20,6 +20,8 @@
 #define	FPCR_PRECISION_DOUBLE	0x00000080
 #define FPCR_PRECISION_EXTENDED	0x00000000
 
+extern uae_u32 get_fpsr (void);
+
 #if USE_LONG_DOUBLE
 STATIC_INLINE long double to_exten(uae_u32 wrd1, uae_u32 wrd2, uae_u32 wrd3)
 {
@@ -152,10 +154,14 @@
 #define HAVE_from_double
 STATIC_INLINE void from_double(double src, uae_u32 * wrd1, uae_u32 * wrd2)
 {
-    register uae_u32 *longarray = (uae_u32 *)&src;
+    union {
+    double d;
+    uae_u32 u[2];
+    } val;
 
-    *wrd1 = longarray[1]; // little endian
-    *wrd2 = longarray[0];
+    val.d = src;
+    *wrd1 = val.u[1]; // little endian
+    *wrd2 = val.u[0];
 }
 #endif
 
diff -r 893fc641cba4 src/cpu/memory.c
--- a/src/cpu/memory.c	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/memory.c	Mon Jan 16 01:06:17 2012 +0200
@@ -87,7 +87,6 @@
 
 
 /* Some prototypes: */
-extern void SDL_Quit(void);
 static int STmem_check (uaecptr addr, uae_u32 size) REGPARAM;
 static uae_u8 *STmem_xlate (uaecptr addr) REGPARAM;
 
diff -r 893fc641cba4 src/cpu/memory.h
--- a/src/cpu/memory.h	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/memory.h	Mon Jan 16 01:06:17 2012 +0200
@@ -46,11 +46,6 @@
 
 extern char *address_space, *good_address_map;
 
-extern uae_u32 wait_cpu_cycle_read (uaecptr addr, int mode);
-extern void wait_cpu_cycle_write (uaecptr addr, int mode, uae_u32 v);
-extern uae_u32 wait_cpu_cycle_read_ce020 (uaecptr addr, int mode);
-extern void wait_cpu_cycle_write_ce020 (uaecptr addr, int mode, uae_u32 v);
-
 enum { ABFLAG_UNK = 0, ABFLAG_RAM = 1, ABFLAG_ROM = 2, ABFLAG_ROMIN = 4, ABFLAG_IO = 8, ABFLAG_NONE = 16, ABFLAG_SAFE = 32 };
 typedef struct {
 	/* These ones should be self-explanatory... */
diff -r 893fc641cba4 src/cpu/newcpu.c
--- a/src/cpu/newcpu.c	Sun Jan 15 15:13:14 2012 +0100
+++ b/src/cpu/newcpu.c	Mon Jan 16 01:06:17 2012 +0200
@@ -48,6 +48,7 @@
 #include "newcpu.h"
 #include "main.h"
 #include "m68000.h"
+#include "md-fpp.h"
 #include "cpummu.h"
 #include "cpu_prefetch.h"
 #include "main.h"
@@ -114,8 +115,6 @@
 
 struct mmufixup mmufixup[2];
 
-extern uae_u32 get_fpsr (void);
-
 #define COUNT_INSTRS 0
 #define MC68060_PCR   0x04300000
 #define MC68EC060_PCR 0x04310000


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/