Merge pull request #1770 from np511/gcc-cleanup

Cleanup GCC warnings - still needs some work
This commit is contained in:
Gregory Hainaut 2017-01-30 15:28:33 +01:00 committed by GitHub
commit bccc3ef253
29 changed files with 72 additions and 1667 deletions

View File

@ -126,7 +126,7 @@ extern "C" {
u32 CALLBACK PS2EgetLibType(void); u32 CALLBACK PS2EgetLibType(void);
u32 CALLBACK PS2EgetLibVersion2(u32 type); u32 CALLBACK PS2EgetLibVersion2(u32 type);
char *CALLBACK PS2EgetLibName(void); const char *CALLBACK PS2EgetLibName(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -486,7 +486,6 @@ static u16 QWCinGIFMFIFO(u32 DrainADDR)
gifstate |= GIF_STATE_EMPTY; gifstate |= GIF_STATE_EMPTY;
GIF_LOG("%x Available of the %x requested", ret, gifch.qwc); GIF_LOG("%x Available of the %x requested", ret, gifch.qwc);
pxAssert(ret >= 0);
return ret; return ret;
} }

View File

@ -425,8 +425,9 @@ __inline s32 FNC_OVERFLOW4(s64 x) {
} }
#define _LIMX(negv, posv, flagb) { \ #define _LIMX(negv, posv, flagb) { \
if (x < (negv)) { x = (negv); gteFLAG |= (1<<(flagb)); } else \ if (x < (negv)) { x = (negv); gteFLAG |= (1<<(flagb)); } \
if (x > (posv)) { x = (posv); gteFLAG |= (1<<(flagb)); } return (x); \ else if (x > (posv)) { x = (posv); gteFLAG |= (1<<(flagb)); } \
return (x); \
} }
__inline double limA1S(double x) { _LIMX(-32768.0, 32767.0, 24); } __inline double limA1S(double x) { _LIMX(-32768.0, 32767.0, 24); }
@ -450,7 +451,9 @@ __inline double limG1(double x) {
if (x > 1023.0) { x = 1023.0; gteFLAG |= (1 << 14); } if (x > 1023.0) { x = 1023.0; gteFLAG |= (1 << 14); }
else else
if (x < -1024.0) { x = -1024.0; gteFLAG |= (1 << 14); } return (x); if (x < -1024.0) { x = -1024.0; gteFLAG |= (1 << 14); }
return (x);
} }
__inline double limG2(double x) { __inline double limG2(double x) {
@ -460,7 +463,9 @@ __inline double limG2(double x) {
if (x > 1023.0) { x = 1023.0; gteFLAG |= (1 << 13); } if (x > 1023.0) { x = 1023.0; gteFLAG |= (1 << 13); }
else else
if (x < -1024.0) { x = -1024.0; gteFLAG |= (1 << 13); } return (x); if (x < -1024.0) { x = -1024.0; gteFLAG |= (1 << 13); }
return (x);
} }
__inline s32 F12limA1S(s64 x) { _LIMX(-32768 << 12, 32767 << 12, 24); } __inline s32 F12limA1S(s64 x) { _LIMX(-32768 << 12, 32767 << 12, 24); }
@ -487,12 +492,12 @@ __inline s32 FlimE(s32 x) { _LIMX(0, 65535, 12); }
__inline s32 FlimG1(s64 x) { __inline s32 FlimG1(s64 x) {
if (x > 2147483647) { gteFLAG |= (1 << 16); } if (x > 2147483647) { gteFLAG |= (1 << 16); }
else else if (x < (s64)0xffffffff80000000) { gteFLAG |= (1 << 15); }
if (x < (s64)0xffffffff80000000) { gteFLAG |= (1 << 15); }
if (x > 1023) { x = 1023; gteFLAG |= (1 << 14); } if (x > 1023) { x = 1023; gteFLAG |= (1 << 14); }
else else if (x < -1024) { x = -1024; gteFLAG |= (1 << 14); }
if (x < -1024) { x = -1024; gteFLAG |= (1 << 14); } return (x);
return (x);
} }
__inline s32 FlimG2(s64 x) { __inline s32 FlimG2(s64 x) {
@ -502,7 +507,9 @@ __inline s32 FlimG2(s64 x) {
if (x > 1023) { x = 1023; gteFLAG |= (1 << 13); } if (x > 1023) { x = 1023; gteFLAG |= (1 << 13); }
else else
if (x < -1024) { x = -1024; gteFLAG |= (1 << 13); } return (x); if (x < -1024) { x = -1024; gteFLAG |= (1 << 13); }
return (x);
} }
#define MAC2IR() { \ #define MAC2IR() { \

View File

@ -499,5 +499,5 @@ std::string iopMemReadString(u32 mem, int maxlen)
while ((c = iopMemRead8(mem++)) && maxlen--) while ((c = iopMemRead8(mem++)) && maxlen--)
ret.push_back(c); ret.push_back(c);
return ret; return ret;
} }

View File

@ -1024,7 +1024,7 @@ void FolderMemoryCard::FlushFileEntries( const u32 dirCluster, const u32 remaini
// empty files need to be explicitly created, as there will be no data cluster referencing it later // empty files need to be explicitly created, as there will be no data cluster referencing it later
char cleanName[sizeof( entry->entry.data.name )]; char cleanName[sizeof( entry->entry.data.name )];
memcpy( cleanName, (const char*)entry->entry.data.name, sizeof( cleanName ) ); memcpy( cleanName, (const char*)entry->entry.data.name, sizeof( cleanName ) );
bool filenameCleaned = FileAccessHelper::CleanMemcardFilename( cleanName ); FileAccessHelper::CleanMemcardFilename( cleanName );
const wxString filePath = dirPath + L"/" + wxString::FromAscii( (const char*)cleanName ); const wxString filePath = dirPath + L"/" + wxString::FromAscii( (const char*)cleanName );
if ( m_performFileWrites ) { if ( m_performFileWrites ) {

View File

@ -426,8 +426,8 @@ void eeRecompileCodeConst0(R5900FNPTR constcode, R5900FNPTR_INFO constscode, R59
// rt = rs op imm16 // rt = rs op imm16
void eeRecompileCodeConst1(R5900FNPTR constcode, R5900FNPTR_INFO noconstcode) void eeRecompileCodeConst1(R5900FNPTR constcode, R5900FNPTR_INFO noconstcode)
{ {
if ( ! _Rt_ ) if ( ! _Rt_ )
return; return;
// for now, don't support xmm // for now, don't support xmm

View File

@ -27,7 +27,7 @@ const unsigned char version = PS2E_CDVD_VERSION;
const unsigned char revision = 0; const unsigned char revision = 0;
const unsigned char build = 6; const unsigned char build = 6;
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
snprintf(libraryName, 255, "CDVDnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : ""); snprintf(libraryName, 255, "CDVDnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

@ -66,7 +66,7 @@ PS2EgetLibType()
return PS2E_LT_FW; return PS2E_LT_FW;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
snprintf(libraryName, 255, "FWnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : ""); snprintf(libraryName, 255, "FWnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

@ -112,6 +112,7 @@ set(GSdxSources
GSWndOGL.cpp GSWndOGL.cpp
GSWndEGL.cpp GSWndEGL.cpp
GSdx.cpp GSdx.cpp
GSdxResources.cpp
stdafx.cpp stdafx.cpp
) )
@ -144,7 +145,6 @@ set(GSdxHeaders
GSDrawingEnvironment.h GSDrawingEnvironment.h
GSDump.h GSDump.h
GSFunctionMap.h GSFunctionMap.h
GSLinuxLogo.h
GSLocalMemory.h GSLocalMemory.h
GSPerfMon.h GSPerfMon.h
GSRasterizer.h GSRasterizer.h
@ -176,6 +176,7 @@ set(GSdxHeaders
GSWndOGL.h GSWndOGL.h
GSWndEGL.h GSWndEGL.h
GSdx.h GSdx.h
GSdxResources.h
res/glsl_source.h res/glsl_source.h
stdafx.h stdafx.h
xbyak/xbyak.h xbyak/xbyak.h
@ -214,6 +215,10 @@ if (REBUILD_SHADER)
add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl) add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl)
endif() endif()
# Note: trying to combine --generate-source and --generate-header doesn't work. It outputs whichever one comes last into the file named by the first
execute_process(COMMAND glib-compile-resources --sourcedir res --generate-header --c-name GSdx_res res/gsdx-res.xml --target=GSdxResources.h WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND glib-compile-resources --sourcedir res --generate-source --c-name GSdx_res res/gsdx-res.xml --target=GSdxResources.cpp WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if(BUILTIN_GS) if(BUILTIN_GS)
add_pcsx2_lib(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}") add_pcsx2_lib(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
else() else()

View File

@ -23,7 +23,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "GS.h" #include "GS.h"
#include "GSdx.h" #include "GSdx.h"
#include "GSLinuxLogo.h" #include "GSdxResources.h"
#include "GSSetting.h" #include "GSSetting.h"
static GtkWidget* s_hack_frame; static GtkWidget* s_hack_frame;
@ -500,8 +500,11 @@ bool RunLinuxDialog()
GtkWidget* osd_box = gtk_vbox_new(false, 5); GtkWidget* osd_box = gtk_vbox_new(false, 5);
// Grab a logo, to make things look nice. // Grab a logo, to make things look nice.
GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL); GResource * resources = GSdx_res_get_resource();
GtkWidget* logo_image = gtk_image_new_from_pixbuf(logo_pixmap); GInputStream * ogl_stream=g_resource_open_stream(resources,"/GSdx/res/logo-ogl.bmp",G_RESOURCE_LOOKUP_FLAGS_NONE,NULL);
GdkPixbuf * ogl_logo = gdk_pixbuf_new_from_stream(ogl_stream,NULL,NULL);
g_object_unref(ogl_stream);
GtkWidget* logo_image = gtk_image_new_from_pixbuf(ogl_logo);
gtk_box_pack_start(GTK_BOX(main_box), logo_image, true, true, 0); gtk_box_pack_start(GTK_BOX(main_box), logo_image, true, true, 0);
GtkWidget* main_table = CreateTableInBox(main_box , NULL , 2 , 2); GtkWidget* main_table = CreateTableInBox(main_box , NULL , 2 , 2);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/GSdx/res/">
<file preprocess="to-pixdata">logo-ogl.bmp</file>
</gresource>
</gresources>

View File

@ -35,7 +35,6 @@ const unsigned char version = PS2E_GS_VERSION;
const unsigned char revision = 0; const unsigned char revision = 0;
const unsigned char build = 1; // increase that with each version const unsigned char build = 1; // increase that with each version
static char libraryName[256];
Config conf; Config conf;
u32 GSKeyEvent = 0; u32 GSKeyEvent = 0;
bool GSShift = false, GSAlt = false; bool GSShift = false, GSAlt = false;
@ -62,7 +61,11 @@ PS2EgetLibType()
return PS2E_LT_GS; return PS2E_LT_GS;
} }
EXPORT_C_(char *) #ifdef _MSC_VER
static char libraryName[256];
#endif
EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
#ifdef _MSC_VER #ifdef _MSC_VER

View File

@ -81,8 +81,8 @@ namespace GSLog
{ {
extern bool Open(); extern bool Open();
extern void Close(); extern void Close();
extern void Log(char *fmt, ...); extern void Log(const char *fmt, ...);
extern void Message(char *fmt, ...); extern void Message(const char *fmt, ...);
extern void Print(const char *fmt, ...); extern void Print(const char *fmt, ...);
extern void WriteLn(const char *fmt, ...); extern void WriteLn(const char *fmt, ...);
}; };

View File

@ -63,7 +63,7 @@ void Close()
} }
} }
void Log(char *fmt, ...) void Log(const char *fmt, ...)
{ {
va_list list; va_list list;
@ -75,7 +75,7 @@ void Log(char *fmt, ...)
va_end(list); va_end(list);
} }
void Message(char *fmt, ...) void Message(const char *fmt, ...)
{ {
va_list list; va_list list;
char msg[512]; char msg[512];

View File

@ -35,7 +35,6 @@ int GSOpenWindow(void *pDsp, const char *Title)
int GSOpenWindow2(void *pDsp, u32 flags) int GSOpenWindow2(void *pDsp, u32 flags)
{ {
GtkWidget *widget;
if (pDsp != NULL) if (pDsp != NULL)
win = *(GtkScrolledWindow **)pDsp; win = *(GtkScrolledWindow **)pDsp;
else else

View File

@ -23,7 +23,7 @@ using namespace std;
const u8 version = PS2E_PAD_VERSION; const u8 version = PS2E_PAD_VERSION;
const u8 revision = 0; const u8 revision = 0;
const u8 build = 1; // increase that with each version const u8 build = 1; // increase that with each version
#ifdef _MSC_VER #ifdef _MSC_VER
#define snprintf sprintf_s #define snprintf sprintf_s
@ -43,7 +43,7 @@ PS2EgetLibType()
return PS2E_LT_PAD; return PS2E_LT_PAD;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
snprintf(libraryName, 255, "Padnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : ""); snprintf(libraryName, 255, "Padnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

@ -36,9 +36,9 @@ const u32 minor = 0; // increase that with each version
#define RELEASE_MS 437L #define RELEASE_MS 437L
#ifdef PCSX2_DEBUG #ifdef PCSX2_DEBUG
char *libraryName = "SPU2null (Debug)"; const char *libraryName = "SPU2null (Debug)";
#else #else
char *libraryName = "SPU2null "; const char *libraryName = "SPU2null ";
#endif #endif
string s_strIniPath = "inis/"; string s_strIniPath = "inis/";
string s_strLogPath = "logs/"; string s_strLogPath = "logs/";
@ -89,7 +89,7 @@ PS2EgetLibType()
return PS2E_LT_SPU2; return PS2E_LT_SPU2;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
return libraryName; return libraryName;
@ -101,7 +101,7 @@ PS2EgetLibVersion2(u32 type)
return (version << 16) | (revision << 8) | build | (minor << 24); return (version << 16) | (revision << 8) | build | (minor << 24);
} }
void __Log(char *fmt, ...) void __Log(const char *fmt, ...)
{ {
va_list list; va_list list;
@ -855,7 +855,7 @@ SPU2write(u32 mem, u16 value)
u32 r = mem & 0xffff; u32 r = mem & 0xffff;
// channel info // channel info
if ((r >= 0x0000 && r < 0x0180) || (r >= 0x0400 && r < 0x0580)) { // some channel info? if (r < 0x0180 || (r >= 0x0400 && r < 0x0580)) { // some channel info?
int ch = 0; int ch = 0;
if (r >= 0x400) if (r >= 0x400)
ch = ((r - 0x400) >> 4) + 24; ch = ((r - 0x400) >> 4) + 24;
@ -1059,7 +1059,7 @@ SPU2read(u32 mem)
u16 ret; u16 ret;
u32 r = mem & 0xffff; u32 r = mem & 0xffff;
if ((r >= 0x0000 && r <= 0x0180) || (r >= 0x0400 && r <= 0x0580)) { // some channel info? if (r <= 0x0180 || (r >= 0x0400 && r <= 0x0580)) { // some channel info?
s32 ch = 0; s32 ch = 0;
if (r >= 0x400) if (r >= 0x400)

View File

@ -48,7 +48,7 @@ extern const u8 version;
extern const u8 revision; extern const u8 revision;
extern const u8 build; extern const u8 build;
extern const u32 minor; extern const u32 minor;
extern char *libraryName; extern const char *libraryName;
typedef struct typedef struct
{ {
@ -57,7 +57,7 @@ typedef struct
extern Config conf; extern Config conf;
void __Log(char *fmt, ...); void __Log(const char *fmt, ...);
void SaveConfig(); void SaveConfig();
void LoadConfig(); void LoadConfig();
void SysMessage(char *fmt, ...); void SysMessage(char *fmt, ...);

View File

@ -60,7 +60,7 @@ PS2EgetLibType()
return PS2E_LT_USB; return PS2E_LT_USB;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
snprintf(libraryName, 255, "USBnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : ""); snprintf(libraryName, 255, "USBnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

@ -113,7 +113,7 @@ u32 CALLBACK PS2EgetLibType() {
return PS2E_LT_USB; return PS2E_LT_USB;
} }
char* CALLBACK PS2EgetLibName() const char* CALLBACK PS2EgetLibName()
{ {
InitLibraryName(); InitLibraryName();
return libraryName; return libraryName;

View File

@ -60,7 +60,7 @@ const unsigned char version = PS2E_CDVD_VERSION;
const unsigned char revision = 0; const unsigned char revision = 0;
const unsigned char build = 11; const unsigned char build = 11;
EXPORT char *CALLBACK PS2EgetLibName() EXPORT const char *CALLBACK PS2EgetLibName()
{ {
return LibName; return LibName;
} }

View File

@ -72,7 +72,7 @@ u32 CALLBACK PS2EgetLibType() {
return PS2E_LT_DEV9; return PS2E_LT_DEV9;
} }
char* CALLBACK PS2EgetLibName() { const char* CALLBACK PS2EgetLibName() {
return libraryName; return libraryName;
} }

View File

@ -77,7 +77,7 @@ PS2EgetLibType()
return PS2E_LT_DEV9; return PS2E_LT_DEV9;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
snprintf(libraryName, 255, "DEV9null Driver %lld%s", SVN_REV, SVN_MODS ? "m" : ""); snprintf(libraryName, 255, "DEV9null Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

@ -91,7 +91,7 @@ PS2EgetLibType()
return PS2E_LT_PAD; return PS2E_LT_PAD;
} }
EXPORT_C_(char *) EXPORT_C_(const char *)
PS2EgetLibName() PS2EgetLibName()
{ {
InitLibraryName(); InitLibraryName();

View File

@ -105,7 +105,7 @@ u32 CALLBACK PS2EgetLibType() {
return PS2E_LT_GS; return PS2E_LT_GS;
} }
char* CALLBACK PS2EgetLibName() { const char* CALLBACK PS2EgetLibName() {
return libraryName; return libraryName;
} }

View File

@ -97,7 +97,7 @@ u32 CALLBACK PS2EgetLibType() {
return PS2E_LT_GS; return PS2E_LT_GS;
} }
char* CALLBACK PS2EgetLibName() { const char* CALLBACK PS2EgetLibName() {
return libraryName; return libraryName;
} }

View File

@ -162,7 +162,7 @@ u32 CALLBACK PS2EgetLibType()
return PS2E_LT_SPU2; return PS2E_LT_SPU2;
} }
char* CALLBACK PS2EgetLibName() const char* CALLBACK PS2EgetLibName()
{ {
InitLibraryName(); InitLibraryName();
return libraryName; return libraryName;

View File

@ -97,9 +97,9 @@ EXPORT_C_(u32) PS2EgetLibType()
return PS2E_LT_GS; return PS2E_LT_GS;
} }
EXPORT_C_(char*) PS2EgetLibName() EXPORT_C_(const char*) PS2EgetLibName()
{ {
return (char*) libraryName; return libraryName;
} }
EXPORT_C_(u32) PS2EgetLibVersion2(u32 type) EXPORT_C_(u32) PS2EgetLibVersion2(u32 type)