clean (some) gdb warning: round 1

* use svnrev.h on linux too
* replace sprintf_s with snprintf (hope it still compile on Windows)
* init integer with 0 instead of NULL
* various int -> u32/uint32/uint on for loop index
* remove a couple of unused variable
* init few variable
* disable unused warning results


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5683 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut
2013-06-28 10:43:50 +00:00
parent ca1edbf2cb
commit 3c7167be50
40 changed files with 97 additions and 178 deletions
+5
View File
@@ -98,10 +98,15 @@ include(BuildParameters)
include(SearchForStuff)
include(SelectPcsx2Plugins)
# Must be done after SearchForStuff
write_svnrev_h()
# add additional project-wide include directories
include_directories(${PROJECT_SOURCE_DIR}/common/include
${PROJECT_SOURCE_DIR}/common/include/Utilities
${PROJECT_SOURCE_DIR}/common/include/x86emitter
# File generated by Cmake
${CMAKE_BINARY_DIR}/common/include
# WORKAROUND Some issue with multiarch on Debian/Ubuntu
/usr/include/i386-linux-gnu
)
+1 -1
View File
@@ -93,7 +93,7 @@ set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "")
#-------------------------------------------------------------------------------
# Set some default compiler flags
#-------------------------------------------------------------------------------
set(DEFAULT_WARNINGS "-Wno-write-strings -Wno-format -Wno-unused-parameter -Wno-unused-value -Wstrict-aliasing -Wno-unused-function -Wno-attributes")
set(DEFAULT_WARNINGS "-Wno-write-strings -Wno-format -Wno-unused-parameter -Wno-unused-value -Wstrict-aliasing -Wno-unused-function -Wno-attributes -Wno-unused-result")
set(DEFAULT_GCC_FLAG "-m32 -msse -msse2 -march=i686 -pthread ${DEFAULT_WARNINGS}")
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -Wno-invalid-offsetof")
+14
View File
@@ -36,3 +36,17 @@ function(detectOperatingSystem)
set(Windows TRUE PARENT_SCOPE)
endif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
endfunction(detectOperatingSystem)
function(write_svnrev_h)
# you must have both svn client executable and a source that contains svn metadata
if(Subversion_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
# execute subversion
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} tmpvar)
# write svnrev.h
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV ${tmpvar_WC_REVISION} \n#define SVN_MODS 0")
else()
# write svnrev.h
file(WRITE ${CMAKE_BINARY_DIR}/common/include/svnrev.h "#define SVN_REV 0 \n#define SVN_MODS 0")
endif()
endfunction()
-14
View File
@@ -12,7 +12,6 @@ set(CommonFlags
# Disable this optimization for the moment
-fno-omit-frame-pointer
# END GCC-4.6
-DLINUX_PRINT_SVN_NUMBER
-pthread
-fvisibility=hidden
-fno-guess-branch-probability
@@ -102,18 +101,6 @@ if(PACKAGE_MODE)
set(Output pcsx2)
endif(PACKAGE_MODE)
# you must have both svn client executable and a source that contains svn metadata
if(Subversion_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
# execute subversion
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} tmpvar)
# write svnrev.h
file(WRITE ${CMAKE_BINARY_DIR}/pcsx2/svnrev.h "#define SVN_REV ${tmpvar_WC_REVISION} \n#define SVN_MODS 0")
else(Subversion_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
# write svnrev.h
file(WRITE ${CMAKE_BINARY_DIR}/pcsx2/svnrev.h "#define SVN_REV 0 \n#define SVN_MODS 0")
endif(Subversion_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.svn")
# Main pcsx2 source
set(pcsx2Sources
Cache.cpp
@@ -649,7 +636,6 @@ endif(MacOSX)
include_directories(.
gui
x86
${CMAKE_BINARY_DIR}/pcsx2
${CMAKE_BINARY_DIR}/pcsx2/gui
)
+1 -1
View File
@@ -748,7 +748,7 @@ void eeMemoryReserve::Reset()
// Dynarec versions of VUs
vu0_micro_mem = vtlb_RegisterHandlerTempl1(vuMicro,0);
vu1_micro_mem = vtlb_RegisterHandlerTempl1(vuMicro,1);
vu1_data_mem = (1||THREAD_VU1) ? vtlb_RegisterHandlerTempl1(vuData,1) : NULL;
vu1_data_mem = (1||THREAD_VU1) ? vtlb_RegisterHandlerTempl1(vuData,1) : 0;
//////////////////////////////////////////////////////////////////////////////////////////
// IOP's "secret" Hardware Register mapping, accessible from the EE (and meant for use
+1 -3
View File
@@ -26,9 +26,7 @@
#include "Utilities/ScopedPtr.h"
#include "Utilities/pxStreams.h"
#if _MSC_VER || defined(LINUX_PRINT_SVN_NUMBER)
# include "svnrev.h"
#endif
#include "svnrev.h"
SysPluginBindings SysPlugins;
-10
View File
@@ -92,16 +92,6 @@ typedef FnType_Void* Fnptr_Void;
// Compiler/OS specific macros and defines
// --------------------------------------------------------------------------------------
// Linux isn't set up for svn version numbers yet.
#if defined(__LINUX__) && !defined(LINUX_PRINT_SVN_NUMBER)
#if !defined(SVN_REV)
# define SVN_REV 0
#endif
#if !defined(SVN_MODS)
# define SVN_MODS 0
#endif
#endif
#if defined(_MSC_VER)
# define strnicmp _strnicmp
+1 -3
View File
@@ -150,9 +150,7 @@ void SysOutOfMemory_EmergencyResponse(uptr blocksize)
}
#if _MSC_VER || defined(LINUX_PRINT_SVN_NUMBER)
# include "svnrev.h"
#endif
#include "svnrev.h"
const Pcsx2Config EmuConfig;
+1 -3
View File
@@ -24,9 +24,7 @@
#include <wx/iconbndl.h>
#if _MSC_VER || defined(LINUX_PRINT_SVN_NUMBER)
# include "svnrev.h"
#endif
#include "svnrev.h"
// ------------------------------------------------------------------------
wxMenu* MainEmuFrame::MakeStatesSubMenu( int baseid, int loadBackupId ) const
+1 -3
View File
@@ -29,9 +29,7 @@ struct Component_FileMcd;
#include "System.h"
#include "AppConfig.h"
#if _MSC_VER || defined(LINUX_PRINT_SVN_NUMBER)
# include "svnrev.h"
#endif
#include "svnrev.h"
#include <wx/ffile.h>
+1 -1
View File
@@ -164,7 +164,7 @@ protected:
public:
BaseBlocks() :
recompiler( NULL )
recompiler(0)
, blocks(0)
{
blocks.reserve(0x4000);
+1 -1
View File
@@ -322,7 +322,7 @@ EXPORT_C_(s32) CDVDgetTOC(void* toc)
if (layer1start != -2 && iso->blocks >= 0x300000)
{
int off = iso->blockofs;
//int off = iso->blockofs;
// dual sided
tocBuff[ 0] = 0x24;
+2 -8
View File
@@ -16,9 +16,7 @@
#include <stdio.h>
#include "CDVD.h"
#ifdef _MSC_VER
# include "svnrev.h"
#endif
#include "svnrev.h"
static char libraryName[256];
@@ -28,12 +26,8 @@ const unsigned char build = 6;
EXPORT_C_(char*) PS2EgetLibName()
{
#ifdef _MSC_VER
sprintf_s( libraryName, "CDVDnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "CDVDnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
#else
return "CDVDnull Driver";
#endif
}
EXPORT_C_(u32) PS2EgetLibType()
+2 -9
View File
@@ -21,9 +21,7 @@
using namespace std;
#include "FW.h"
#ifdef _MSC_VER
# include "svnrev.h"
#endif
#include "svnrev.h"
const u8 version = PS2E_FW_VERSION;
const u8 revision = 0;
@@ -65,12 +63,8 @@ EXPORT_C_(u32) PS2EgetLibType()
EXPORT_C_(char*) PS2EgetLibName()
{
#ifdef _MSC_VER
sprintf_s( libraryName, "FWnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
snprintf( libraryName, 255, "FWnull Driver r%d%s",SVN_REV, SVN_MODS ? "m" : "");
return libraryName;
#else
return "FWnull Driver";
#endif
}
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)
@@ -131,7 +125,6 @@ void PHYWrite()
void PHYRead()
{
u8 reg = (PHYACC >> 24) & 0xf;
u8 data = (PHYACC >> 16) & 0xff;
PHYACC &= ~0x80000000;
+1 -1
View File
@@ -27,7 +27,7 @@ GPUState::GPUState()
{
memset(m_status, 0, sizeof(m_status));
for(int i = 0; i < countof(m_fpGPUStatusCommandHandlers); i++)
for(uint32 i = 0; i < countof(m_fpGPUStatusCommandHandlers); i++)
{
m_fpGPUStatusCommandHandlers[i] = &GPUState::SCH_Null;
}
+3 -3
View File
@@ -69,7 +69,9 @@ static int s_renderer = -1;
static bool s_framelimit = true;
static bool s_vsync = false;
static bool s_exclusive = true;
#ifdef _WINDOWS
static bool s_isgsopen2 = false; // boolean to remove some stuff from the config panel in new PCSX2's/
#endif
EXPORT_C_(uint32) PS2EgetLibType()
{
@@ -439,7 +441,7 @@ EXPORT_C_(int) GSopen(void** dsp, char* title, int mt)
XCloseDisplay(display);
*/
int renderer;
int renderer = 0;
// Legacy GUI expects to acquire vsync from the configuration files.
@@ -1456,8 +1458,6 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer)
fread(regs, 0x2000, 1, fp);
long start = ftell(fp);
GSvsync(1);
struct Packet {uint8 type, param; uint32 size, addr; vector<uint8> buff;};
+1 -1
View File
@@ -531,7 +531,7 @@ CRC::Game CRC::Lookup(uint32 crc)
printf( "GSdx: CrcHacksExclusions: %s\n", exclusions.c_str() );
int crcDups = 0;
for(int i = 0; i < countof(m_games); i++)
for(uint32 i = 0; i < countof(m_games); i++)
{
if( !IsCrcExcluded( exclusions, m_games[i].crc ) ){
if(m_map[m_games[i].crc]){
+2 -2
View File
@@ -226,7 +226,7 @@ void GSDevice::Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVec
{
GSTexture* tex[2] = {NULL, NULL};
for(int i = 0; i < countof(tex); i++)
for(uint32 i = 0; i < countof(tex); i++)
{
if(st[i] != NULL)
{
@@ -236,7 +236,7 @@ void GSDevice::Merge(GSTexture* st[2], GSVector4* sr, GSVector4* dr, const GSVec
DoMerge(tex, sr, m_merge, dr, slbg, mmod, c);
for(int i = 0; i < countof(tex); i++)
for(uint32 i = 0; i < countof(tex); i++)
{
if(tex[i] != st[i])
{
+18 -18
View File
@@ -116,89 +116,89 @@ GSLocalMemory::GSLocalMemory()
}
}
for(int x = 0; x < countof(rowOffset32); x++)
for(uint32 x = 0; x < countof(rowOffset32); x++)
{
rowOffset32[x] = (int)PixelAddress32(x & 0x7ff, 0, 0, 32) - (int)PixelAddress32(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset32Z); x++)
for(uint32 x = 0; x < countof(rowOffset32Z); x++)
{
rowOffset32Z[x] = (int)PixelAddress32Z(x & 0x7ff, 0, 0, 32) - (int)PixelAddress32Z(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset16); x++)
for(uint32 x = 0; x < countof(rowOffset16); x++)
{
rowOffset16[x] = (int)PixelAddress16(x & 0x7ff, 0, 0, 32) - (int)PixelAddress16(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset16S); x++)
for(uint32 x = 0; x < countof(rowOffset16S); x++)
{
rowOffset16S[x] = (int)PixelAddress16S(x & 0x7ff, 0, 0, 32) - (int)PixelAddress16S(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset16Z); x++)
for(uint32 x = 0; x < countof(rowOffset16Z); x++)
{
rowOffset16Z[x] = (int)PixelAddress16Z(x & 0x7ff, 0, 0, 32) - (int)PixelAddress16Z(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset16SZ); x++)
for(uint32 x = 0; x < countof(rowOffset16SZ); x++)
{
rowOffset16SZ[x] = (int)PixelAddress16SZ(x & 0x7ff, 0, 0, 32) - (int)PixelAddress16SZ(0, 0, 0, 32);
}
for(int x = 0; x < countof(rowOffset8[0]); x++)
for(uint32 x = 0; x < countof(rowOffset8[0]); x++)
{
rowOffset8[0][x] = (int)PixelAddress8(x & 0x7ff, 0, 0, 32) - (int)PixelAddress8(0, 0, 0, 32);
rowOffset8[1][x] = (int)PixelAddress8(x & 0x7ff, 2, 0, 32) - (int)PixelAddress8(0, 2, 0, 32);
}
for(int x = 0; x < countof(rowOffset4[0]); x++)
for(uint32 x = 0; x < countof(rowOffset4[0]); x++)
{
rowOffset4[0][x] = (int)PixelAddress4(x & 0x7ff, 0, 0, 32) - (int)PixelAddress4(0, 0, 0, 32);
rowOffset4[1][x] = (int)PixelAddress4(x & 0x7ff, 2, 0, 32) - (int)PixelAddress4(0, 2, 0, 32);
}
for(int x = 0; x < countof(blockOffset32); x++)
for(uint32 x = 0; x < countof(blockOffset32); x++)
{
blockOffset32[x] = (short)((int)BlockNumber32(x << 3, 0, 0, 32) - (int)BlockNumber32(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset32Z); x++)
for(uint32 x = 0; x < countof(blockOffset32Z); x++)
{
blockOffset32Z[x] = (short)((int)BlockNumber32Z(x << 3, 0, 0, 32) - (int)BlockNumber32Z(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset16); x++)
for(uint32 x = 0; x < countof(blockOffset16); x++)
{
blockOffset16[x] = (short)((int)BlockNumber16(x << 3, 0, 0, 32) - (int)BlockNumber16(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset16S); x++)
for(uint32 x = 0; x < countof(blockOffset16S); x++)
{
blockOffset16S[x] = (short)((int)BlockNumber16S(x << 3, 0, 0, 32) - (int)BlockNumber16S(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset16Z); x++)
for(uint32 x = 0; x < countof(blockOffset16Z); x++)
{
blockOffset16Z[x] = (short)((int)BlockNumber16Z(x << 3, 0, 0, 32) - (int)BlockNumber16Z(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset16SZ); x++)
for(uint32 x = 0; x < countof(blockOffset16SZ); x++)
{
blockOffset16SZ[x] = (short)((int)BlockNumber16SZ(x << 3, 0, 0, 32) - (int)BlockNumber16SZ(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset8); x++)
for(uint32 x = 0; x < countof(blockOffset8); x++)
{
blockOffset8[x] = (short)((int)BlockNumber8(x << 3, 0, 0, 32) - (int)BlockNumber8(0, 0, 0, 32));
}
for(int x = 0; x < countof(blockOffset4); x++)
for(uint32 x = 0; x < countof(blockOffset4); x++)
{
blockOffset4[x] = (short)((int)BlockNumber4(x << 3, 0, 0, 32) - (int)BlockNumber4(0, 0, 0, 32));
}
for(int i = 0; i < countof(m_psm); i++)
for(uint32 i = 0; i < countof(m_psm); i++)
{
m_psm[i].pa = &GSLocalMemory::PixelAddress32;
m_psm[i].bn = &GSLocalMemory::BlockNumber32;
@@ -408,7 +408,7 @@ GSLocalMemory::GSLocalMemory()
m_psm[PSM_PSMT8].pal = m_psm[PSM_PSMT8H].pal = 256;
m_psm[PSM_PSMT4].pal = m_psm[PSM_PSMT4HL].pal = m_psm[PSM_PSMT4HH].pal = 16;
for(int i = 0; i < countof(m_psm); i++) m_psm[i].fmt = 3;
for(uint32 i = 0; i < countof(m_psm); i++) m_psm[i].fmt = 3;
m_psm[PSM_PSMCT32].fmt = m_psm[PSM_PSMZ32].fmt = 0;
m_psm[PSM_PSMCT24].fmt = m_psm[PSM_PSMZ24].fmt = 1;
m_psm[PSM_PSMCT16].fmt = m_psm[PSM_PSMZ16].fmt = 2;
+1 -1
View File
@@ -58,7 +58,7 @@ void GSPerfMon::Update()
{
if(m_count > 0)
{
for(int i = 0; i < countof(m_counters); i++)
for(uint32 i = 0; i < countof(m_counters); i++)
{
m_stats[i] = m_counters[i] / m_count;
}

Some files were not shown because too many files have changed in this diff Show More