From 0b6fc80b200e1a8b906e46563ee6f1bbbf456ad7 Mon Sep 17 00:00:00 2001 From: Dimitris Panokostas Date: Wed, 5 Apr 2017 00:26:08 +0200 Subject: [PATCH] Fixed compiler warnings (and suppressed write-strings related ones) --- Makefile | 2 +- VisualGDB/Amiberry/Amiberry.vcxproj | 32 +++++----- src/cfgfile.cpp | 2 +- src/include/zarchive.h | 29 +++++---- src/jit/compemu_support.cpp | 28 --------- src/osdep/amiberry_gfx.h | 1 + src/osdep/picasso96.cpp | 2 +- src/osdep/sigsegv_handler.cpp | 92 +++-------------------------- src/zfile_archive.cpp | 45 +++++++------- 9 files changed, 68 insertions(+), 165 deletions(-) diff --git a/Makefile b/Makefile index 31857f5e..748b344d 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ LDFLAGS += -lpthread -lm -lz -lpng -lrt -lxml2 -lFLAC -lmpg123 -ldl -lprofiler - LDFLAGS += -lSDL2 -lSDL2_image -lSDL2_ttf -lguisan -L/opt/vc/lib -Lsrc/guisan/lib ifndef DEBUG -MORE_CFLAGS += -Ofast -pipe +MORE_CFLAGS += -Ofast -pipe -Wno-write-strings else MORE_CFLAGS += -g -DDEBUG -Wl,--export-dynamic diff --git a/VisualGDB/Amiberry/Amiberry.vcxproj b/VisualGDB/Amiberry/Amiberry.vcxproj index 05a76900..b4c28b7c 100644 --- a/VisualGDB/Amiberry/Amiberry.vcxproj +++ b/VisualGDB/Amiberry/Amiberry.vcxproj @@ -48,29 +48,29 @@ GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) DEBUG=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe %(AdditionalOptions) + -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) - -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) + ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) + -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) + -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) true true - -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) + -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) + ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) @@ -80,15 +80,15 @@ GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6T2;USE_ARMNEON;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) + -march=armv7-a -mfpu=neon-vfpv4 -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) true true - -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) + -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) + ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) @@ -99,15 +99,15 @@ GNUPP14 - C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\local\include\SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;=/opt/vc/include;=/opt/vc/include/interface/vmcs_host/linux;=/opt/vc/include/interface/vcos/pthreads;=/usr/local/include;=/usr/local/include/SDL2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) + C:\SysGCC\raspberry\lib\gcc\arm-linux-gnueabihf\4.9\include;C:\SysGCC\raspberry\arm-linux-gnueabihf\include\c++\4.9;C:\SysGCC\raspberry\arm-linux-gnueabihf\include;../../src;../../src/include;../../src/osdep;../../src/threaddep;../../src/guisan/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include;=/opt/vc/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vmcs_host\linux;=/opt/vc/include/interface/vmcs_host/linux;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\opt\vc\include\interface\vcos\pthreads;=/opt/vc/include/interface/vcos/pthreads;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include;=/usr/include;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\SDL2;=/usr/include/SDL2;C:\SysGCC\raspberry\arm-linux-gnueabihf\sysroot\usr\include\libxml2;=/usr/include/libxml2;%(ClCompile.AdditionalIncludeDirectories) NDEBUG=1;RELEASE=1;_REENTRANT;CAPSLOCK_DEBIAN_WORKAROUND;ARMV6_ASSEMBLY;AMIBERRY;USE_SDL;CPU_arm;ROM_PATH_PREFIX=\"./\";DATA_PREFIX=\"./data/\";SAVE_PREFIX=\"./saves/\";GCCCONSTFUNC="__attribute__((const))";%(ClCompile.PreprocessorDefinitions) - -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe -fweb %(AdditionalOptions) + -march=armv6zk -mfpu=vfp -mfloat-abi=hard -pipe -Wno-write-strings %(AdditionalOptions) true true - -Wl,-gc-sections,-rpath,/usr/local/lib;%(Link.AdditionalLinkerInputs) - ../../src/guisan/lib;=/opt/vc/lib;=/usr/local/lib;%(Link.LibrarySearchDirectories) + -Wl,-gc-sections;%(Link.AdditionalLinkerInputs) + ../../src/guisan/lib;=/opt/vc/lib;=/usr/lib/arm-linux-gnueabihf;%(Link.LibrarySearchDirectories) SDL2;SDL2_image;SDL2_ttf;pthread;m;z;png;rt;xml2;FLAC;mpg123;dl;guisan;profiler;tcmalloc;%(Link.AdditionalLibraryNames) diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index fa8f2ad5..e4aa0f06 100644 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -753,7 +753,7 @@ static void write_filesys_config(struct uae_prefs *p, struct zfile *f) { int i; TCHAR tmp[MAX_DPATH], tmp2[MAX_DPATH], tmp3[MAX_DPATH]; - TCHAR *hdcontrollers[] = { _T("uae"), + char const *hdcontrollers[] = { _T("uae"), _T("ide0"), _T("ide1"), _T("ide2"), _T("ide3"), _T("scsi0"), _T("scsi1"), _T("scsi2"), _T("scsi3"), _T("scsi4"), _T("scsi5"), _T("scsi6"), _T("scsram"), _T("scide") }; /* scsram = smart card sram = pcmcia sram card */ diff --git a/src/include/zarchive.h b/src/include/zarchive.h index 6eab72b8..98396a45 100644 --- a/src/include/zarchive.h +++ b/src/include/zarchive.h @@ -1,3 +1,4 @@ +#pragma once typedef uae_s64 (*ZFILEREAD)(void*, uae_u64, uae_u64, struct zfile*); typedef uae_s64 (*ZFILEWRITE)(const void*, uae_u64, uae_u64, struct zfile*); @@ -84,19 +85,21 @@ struct zarchive_info struct mytimeval tv; }; -#define ArchiveFormat7Zip '7z ' -#define ArchiveFormatRAR 'rar ' -#define ArchiveFormatZIP 'zip ' -#define ArchiveFormatLHA 'lha ' -#define ArchiveFormatLZX 'lzx ' -#define ArchiveFormatPLAIN '----' -#define ArchiveFormatDIR 'DIR ' -#define ArchiveFormatAA 'aa ' // method only -#define ArchiveFormatADF 'DOS ' -#define ArchiveFormatRDB 'RDSK' -#define ArchiveFormatMBR 'MBR ' -#define ArchiveFormatFAT 'FAT ' -#define ArchiveFormatTAR 'tar ' +#define MCC(a,b,c,d) (((a)<<24) | ((b)<<16) | ((c)<<8) | (d)) + +#define ArchiveFormat7Zip MCC('7', 'z', ' ', ' ') +#define ArchiveFormatRAR MCC('r', 'a', 'r', ' ') +#define ArchiveFormatZIP MCC('z', 'i', 'p', ' ') +#define ArchiveFormatLHA MCC('l', 'h', 'a', ' ') +#define ArchiveFormatLZX MCC('l', 'z', 'x', ' ') +#define ArchiveFormatPLAIN MCC('-', '-', '-', '-') +#define ArchiveFormatDIR MCC('D', 'I', 'R', ' ') +#define ArchiveFormatAA MCC('a', 'a', ' ', ' ') // method only +#define ArchiveFormatADF MCC('D', 'O', 'S', ' ') +#define ArchiveFormatRDB MCC('R', 'D', 'S', 'K') +#define ArchiveFormatMBR MCC('M', 'B', 'R', ' ') +#define ArchiveFormatFAT MCC('F', 'A', 'T', ' ') +#define ArchiveFormatTAR MCC('t', 'a', 'r', ' ') #define PEEK_BYTES 1024 #define FILE_PEEK 1 diff --git a/src/jit/compemu_support.cpp b/src/jit/compemu_support.cpp index e9fcb0c3..8ec67254 100644 --- a/src/jit/compemu_support.cpp +++ b/src/jit/compemu_support.cpp @@ -45,16 +45,8 @@ #include "comptbl.h" #include "compemu.h" #include "SDL.h" - -#define DEBUG 0 #include "debug.h" -#if DEBUG -#define PROFILE_COMPILE_TIME 1 -#define PROFILE_UNTRANSLATED_INSNS 1 -#define bug printf -#endif - #ifdef JIT_DEBUG #undef abort #define abort() do { \ @@ -65,26 +57,6 @@ } while (0) #endif -#ifdef PROFILE_COMPILE_TIME -#include -static uae_u32 compile_count = 0; -static clock_t compile_time = 0; -static clock_t emul_start_time = 0; -static clock_t emul_end_time = 0; -#endif - -#ifdef PROFILE_UNTRANSLATED_INSNS -static int untranslated_top_ten = 30; -static uae_u32 raw_cputbl_count[65536] = { 0, }; -static uae_u16 opcode_nums[65536]; - - -static int untranslated_compfn(const void *e1, const void *e2) -{ - return raw_cputbl_count[*(const uae_u16 *)e1] < raw_cputbl_count[*(const uae_u16 *)e2]; -} -#endif - #define NATMEM_OFFSETX (uae_u32)natmem_offset // %%% BRIAN KING WAS HERE %%% diff --git a/src/osdep/amiberry_gfx.h b/src/osdep/amiberry_gfx.h index 089e7aa1..6a0d5a7e 100644 --- a/src/osdep/amiberry_gfx.h +++ b/src/osdep/amiberry_gfx.h @@ -1,4 +1,5 @@ #pragma once +#include extern SDL_Window* sdlWindow; extern SDL_Renderer* renderer; extern SDL_Texture* texture; diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp index 222fd88b..4c874bec 100644 --- a/src/osdep/picasso96.cpp +++ b/src/osdep/picasso96.cpp @@ -3499,7 +3499,7 @@ static uaecptr uaegfx_card_install(TrapContext* ctx, uae_u32 extrasize) uaecptr exec = get_long(4); if (uaegfx_old || !gfxmem_bank.start) - return NULL; + return 0; uaegfx_resid = ds(_T("UAE Graphics Card 3.3")); uaegfx_vblankname = ds(_T("UAE Graphics Card VBLANK")); diff --git a/src/osdep/sigsegv_handler.cpp b/src/osdep/sigsegv_handler.cpp index 1bce6c7d..594b1a8e 100644 --- a/src/osdep/sigsegv_handler.cpp +++ b/src/osdep/sigsegv_handler.cpp @@ -39,7 +39,6 @@ #include #include "SDL.h" -#define DEBUG 0 #include "debug.h" @@ -78,8 +77,8 @@ static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) { unsigned int *pc = (unsigned int *)pregs[ARM_REG_PC]; - panicbug("IP: %p [%08x] %p\n", pc, pc[0], addr); - if (pc == 0) + panicbug("IP: %p [%08x] %u\n", pc, pc[0], addr); + if (pc == nullptr) return false; if (in_handler > 0) @@ -149,26 +148,6 @@ static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) transfer_type = TYPE_STORE; int rd = (opcode >> 12) & 0xf; -#if DEBUG - static const char * reg_names[] = - { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc" - }; - panicbug("%s %s register %s\n", - transfer_size == SIZE_BYTE ? "byte" : - transfer_size == SIZE_WORD ? "word" : - transfer_size == SIZE_INT ? "long" : "unknown", - transfer_type == TYPE_LOAD ? "load to" : "store from", - reg_names[rd]); - panicbug("\n"); -// for (int i = 0; i < 16; i++) { -// panicbug("%s : %p", reg_names[i], pregs[i]); -// } -#endif - -// if ((addr < 0x00f00000) || (addr > 0x00ffffff)) -// goto buserr; if (transfer_type == TYPE_LOAD) { @@ -176,12 +155,12 @@ static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) { case SIZE_BYTE: { - pregs[rd] = style == SIGNED ? (uae_s8)get_byte(addr) : (uae_u8)get_byte(addr); + pregs[rd] = style == SIGNED ? uae_s8(get_byte(addr)) : uae_u8(get_byte(addr)); break; } case SIZE_WORD: { - pregs[rd] = do_byteswap_16(style == SIGNED ? (uae_s16)get_word(addr) : (uae_u16)get_word(addr)); + pregs[rd] = do_byteswap_16(style == SIGNED ? uae_s16(get_word(addr)) : uae_u16(get_word(addr))); break; } case SIZE_INT: @@ -214,18 +193,11 @@ static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) } pregs[ARM_REG_PC] += 4; - panicbug("processed: %p \n", pregs[ARM_REG_PC]); + panicbug("processed: %lu \n", pregs[ARM_REG_PC]); in_handler--; return true; - -buserr: - panicbug("Amiga bus error\n"); - in_handler--; - -// BUS_ERROR(addr); - return false; } @@ -250,8 +222,8 @@ void signal_segv(int signum, siginfo_t* info, void*ptr) mcontext_t *context = &(ucontext->uc_mcontext); unsigned long *regs = &context->arm_r0; - uintptr addr = (uintptr)info->si_addr; - addr = (uae_u32) addr - (uae_u32) natmem_offset; + uintptr addr = uintptr(info->si_addr); + addr = uae_u32(addr) - uae_u32(natmem_offset); if (handle_arm_instruction(regs, addr)) return; @@ -289,57 +261,11 @@ void signal_segv(int signum, siginfo_t* info, void*ptr) printf("Err Code = 0x%08x\n", ucontext->uc_mcontext.error_code); printf("Old Mask = 0x%08x\n", ucontext->uc_mcontext.oldmask); -// dump_compiler((uae_u32*)ucontext->uc_mcontext.arm_pc); - void *getaddr = (void *)ucontext->uc_mcontext.arm_lr; if(dladdr(getaddr, &dlinfo)) - printf("LR - 0x%08X: <%s> (%s)\n", getaddr, dlinfo.dli_sname, dlinfo.dli_fname); + printf("LR - 0x%08p: <%s> (%s)\n", getaddr, dlinfo.dli_sname, dlinfo.dli_fname); else - printf("LR - 0x%08X: symbol not found\n", getaddr); - -// printf("Stack trace:\n"); - - /* - #define MAX_BACKTRACE 10 - - void *array[MAX_BACKTRACE]; - int size = backtrace(array, MAX_BACKTRACE); - for(int i=0; i (%s)\n", array[i], symname, - (unsigned long)array[i] - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); - } - } - */ - - /* - ip = (void*)ucontext->uc_mcontext.arm_r10; - bp = (void**)ucontext->uc_mcontext.arm_r10; - while(bp && ip) { - if (!dladdr(ip, &dlinfo)) { - printf("IP out of range\n"); - break; - } - const char *symname = dlinfo.dli_sname; - printf("% 2d: %p <%s + 0x%08x> (%s)\n", ++f, ip, symname, - (unsigned long)ip - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); - if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main")) - break; - ip = bp[1]; - bp = (void**)bp[0]; - } - - printf("Stack trace (non-dedicated):\n"); - char **strings; - void *bt[20]; - int sz = backtrace(bt, 20); - strings = backtrace_symbols(bt, sz); - for(i = 0; i < sz; ++i) - printf("%s\n", strings[i]); - printf("End of stack trace.\n"); - */ + printf("LR - 0x%08p: symbol not found\n", getaddr); SDL_Quit(); exit(1); diff --git a/src/zfile_archive.cpp b/src/zfile_archive.cpp index d511a1ed..1c8740e7 100644 --- a/src/zfile_archive.cpp +++ b/src/zfile_archive.cpp @@ -9,10 +9,10 @@ #include "sysconfig.h" #include "sysdeps.h" -#ifdef _WIN32 -#include -#include "win32.h" -#endif +//#ifdef _WIN32 +//#include +//#include "win32.h" +//#endif #include "options.h" #include "zfile.h" @@ -30,18 +30,19 @@ static time_t fromdostime(uae_u32 dd) { - struct tm tm; - time_t t; - memset(&tm, 0, sizeof tm); - tm.tm_hour = (dd >> 11) & 0x1f; - tm.tm_min = (dd >> 5) & 0x3f; - tm.tm_sec = ((dd >> 0) & 0x1f) * 2; - tm.tm_year = ((dd >> 25) & 0x7f) + 80; - tm.tm_mon = ((dd >> 21) & 0x0f) - 1; - tm.tm_mday = (dd >> 16) & 0x1f; - t = mktime(&tm); - t -= _timezone; - return t; + struct tm tm; + time_t t; + + memset(&tm, 0, sizeof tm); + tm.tm_hour = (dd >> 11) & 0x1f; + tm.tm_min = (dd >> 5) & 0x3f; + tm.tm_sec = ((dd >> 0) & 0x1f) * 2; + tm.tm_year = ((dd >> 25) & 0x7f) + 80; + tm.tm_mon = ((dd >> 21) & 0x0f) - 1; + tm.tm_mday = (dd >> 16) & 0x1f; + t = mktime(&tm); + t -= _timezone; + return t; } static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsigned int id) @@ -1366,7 +1367,7 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) goto fail; adf->dostype = gl (adf, 0); - if ((adf->dostype & 0xffffff00) == 'DOS\0') { + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { int bs = adf->blocksize; int res; @@ -1418,7 +1419,7 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) name[0] = 0; recurseadf (&zv->root, adf->rootblock, name); - } else if ((adf->dostype & 0xffffff00) == 'SFS\0') { + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { uae_u16 version, sfs2; @@ -1431,14 +1432,14 @@ struct zvolume *archive_directory_adf (struct znode *parent, struct zfile *z) adf->rootblock = gl (adf, 104); if (!adf_read_block (adf, adf->rootblock)) break; - if (gl (adf, 0) != 'OBJC') + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) break; if (sfs_checksum (adf->block, adf->blocksize, sfs2)) break; adf->rootblock = gl (adf, 40); if (!adf_read_block (adf, adf->rootblock)) break; - if (gl (adf, 0) != 'OBJC') + if (gl (adf, 0) != MCC('O', 'B', 'J', 'C')) break; if (sfs_checksum (adf->block, adf->blocksize, sfs2)) break; @@ -1549,7 +1550,7 @@ static struct zfile *archive_access_adf (struct znode *zn) if (!z) return NULL; - if ((adf->dostype & 0xffffff00) == 'DOS\0') { + if ((adf->dostype & 0xffffff00) == MCC('D', 'O', 'S', '\0')) { ffs = adf->dostype & 1; root = zn->offset; @@ -1575,7 +1576,7 @@ static struct zfile *archive_access_adf (struct znode *zn) break; root = gl (adf, bs - 2 * 4); } - } else if ((adf->dostype & 0xffffff00) == 'SFS\0') { + } else if ((adf->dostype & 0xffffff00) == MCC('S', 'F', 'S', '\0')) { struct sfsblock *sfsblocks; int sfsblockcnt, sfsmaxblockcnt, i;