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 PS2EgetLibVersion2(u32 type);
char *CALLBACK PS2EgetLibName(void);
const char *CALLBACK PS2EgetLibName(void);
#ifdef __cplusplus
}

View File

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

View File

@ -425,8 +425,9 @@ __inline s32 FNC_OVERFLOW4(s64 x) {
}
#define _LIMX(negv, posv, flagb) { \
if (x < (negv)) { x = (negv); gteFLAG |= (1<<(flagb)); } else \
if (x > (posv)) { x = (posv); gteFLAG |= (1<<(flagb)); } return (x); \
if (x < (negv)) { x = (negv); gteFLAG |= (1<<(flagb)); } \
else if (x > (posv)) { x = (posv); gteFLAG |= (1<<(flagb)); } \
return (x); \
}
__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); }
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) {
@ -460,7 +463,9 @@ __inline double limG2(double x) {
if (x > 1023.0) { x = 1023.0; gteFLAG |= (1 << 13); }
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); }
@ -487,12 +492,12 @@ __inline s32 FlimE(s32 x) { _LIMX(0, 65535, 12); }
__inline s32 FlimG1(s64 x) {
if (x > 2147483647) { gteFLAG |= (1 << 16); }
else
if (x < (s64)0xffffffff80000000) { gteFLAG |= (1 << 15); }
else if (x < (s64)0xffffffff80000000) { gteFLAG |= (1 << 15); }
if (x > 1023) { x = 1023; gteFLAG |= (1 << 14); }
else
if (x < -1024) { x = -1024; gteFLAG |= (1 << 14); } return (x);
else if (x < -1024) { x = -1024; gteFLAG |= (1 << 14); }
return (x);
}
__inline s32 FlimG2(s64 x) {
@ -502,7 +507,9 @@ __inline s32 FlimG2(s64 x) {
if (x > 1023) { x = 1023; gteFLAG |= (1 << 13); }
else
if (x < -1024) { x = -1024; gteFLAG |= (1 << 13); } return (x);
if (x < -1024) { x = -1024; gteFLAG |= (1 << 13); }
return (x);
}
#define MAC2IR() { \

View File

@ -499,5 +499,5 @@ std::string iopMemReadString(u32 mem, int maxlen)
while ((c = iopMemRead8(mem++)) && maxlen--)
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
char cleanName[sizeof( entry->entry.data.name )];
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 );
if ( m_performFileWrites ) {

View File

@ -426,8 +426,8 @@ void eeRecompileCodeConst0(R5900FNPTR constcode, R5900FNPTR_INFO constscode, R59
// rt = rs op imm16
void eeRecompileCodeConst1(R5900FNPTR constcode, R5900FNPTR_INFO noconstcode)
{
if ( ! _Rt_ )
return;
if ( ! _Rt_ )
return;
// 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 build = 6;
EXPORT_C_(char *)
EXPORT_C_(const char *)
PS2EgetLibName()
{
snprintf(libraryName, 255, "CDVDnull Driver %lld%s", SVN_REV, SVN_MODS ? "m" : "");

View File

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

View File

@ -112,6 +112,7 @@ set(GSdxSources
GSWndOGL.cpp
GSWndEGL.cpp
GSdx.cpp
GSdxResources.cpp
stdafx.cpp
)
@ -144,7 +145,6 @@ set(GSdxHeaders
GSDrawingEnvironment.h
GSDump.h
GSFunctionMap.h
GSLinuxLogo.h
GSLocalMemory.h
GSPerfMon.h
GSRasterizer.h
@ -176,6 +176,7 @@ set(GSdxHeaders
GSWndOGL.h
GSWndEGL.h
GSdx.h
GSdxResources.h
res/glsl_source.h
stdafx.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)
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)
add_pcsx2_lib(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
else()

View File

@ -23,7 +23,7 @@
#include <gtk/gtk.h>
#include "GS.h"
#include "GSdx.h"
#include "GSLinuxLogo.h"
#include "GSdxResources.h"
#include "GSSetting.h"
static GtkWidget* s_hack_frame;
@ -500,8 +500,11 @@ bool RunLinuxDialog()
GtkWidget* osd_box = gtk_vbox_new(false, 5);
// Grab a logo, to make things look nice.
GdkPixbuf* logo_pixmap = gdk_pixbuf_from_pixdata(&gsdx_ogl_logo, false, NULL);
GtkWidget* logo_image = gtk_image_new_from_pixbuf(logo_pixmap);
GResource * resources = GSdx_res_get_resource();
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);
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 build = 1; // increase that with each version
static char libraryName[256];
Config conf;
u32 GSKeyEvent = 0;
bool GSShift = false, GSAlt = false;
@ -62,7 +61,11 @@ PS2EgetLibType()
return PS2E_LT_GS;
}
EXPORT_C_(char *)
#ifdef _MSC_VER
static char libraryName[256];
#endif
EXPORT_C_(const char *)
PS2EgetLibName()
{
#ifdef _MSC_VER

View File

@ -81,8 +81,8 @@ namespace GSLog
{
extern bool Open();
extern void Close();
extern void Log(char *fmt, ...);
extern void Message(char *fmt, ...);
extern void Log(const char *fmt, ...);
extern void Message(const char *fmt, ...);
extern void Print(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;
@ -75,7 +75,7 @@ void Log(char *fmt, ...)
va_end(list);
}
void Message(char *fmt, ...)
void Message(const char *fmt, ...)
{
va_list list;
char msg[512];

View File

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

View File

@ -23,7 +23,7 @@ using namespace std;
const u8 version = PS2E_PAD_VERSION;
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
#define snprintf sprintf_s
@ -43,7 +43,7 @@ PS2EgetLibType()
return PS2E_LT_PAD;
}
EXPORT_C_(char *)
EXPORT_C_(const char *)
PS2EgetLibName()
{
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
#ifdef PCSX2_DEBUG
char *libraryName = "SPU2null (Debug)";
const char *libraryName = "SPU2null (Debug)";
#else
char *libraryName = "SPU2null ";
const char *libraryName = "SPU2null ";
#endif
string s_strIniPath = "inis/";
string s_strLogPath = "logs/";
@ -89,7 +89,7 @@ PS2EgetLibType()
return PS2E_LT_SPU2;
}
EXPORT_C_(char *)
EXPORT_C_(const char *)
PS2EgetLibName()
{
return libraryName;
@ -101,7 +101,7 @@ PS2EgetLibVersion2(u32 type)
return (version << 16) | (revision << 8) | build | (minor << 24);
}
void __Log(char *fmt, ...)
void __Log(const char *fmt, ...)
{
va_list list;
@ -855,7 +855,7 @@ SPU2write(u32 mem, u16 value)
u32 r = mem & 0xffff;
// 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;
if (r >= 0x400)
ch = ((r - 0x400) >> 4) + 24;
@ -1059,7 +1059,7 @@ SPU2read(u32 mem)
u16 ret;
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;
if (r >= 0x400)

View File

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

View File

@ -60,7 +60,7 @@ PS2EgetLibType()
return PS2E_LT_USB;
}
EXPORT_C_(char *)
EXPORT_C_(const char *)
PS2EgetLibName()
{
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;
}
char* CALLBACK PS2EgetLibName()
const char* CALLBACK PS2EgetLibName()
{
InitLibraryName();
return libraryName;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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