Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for GCC 11 #433

Merged
merged 15 commits into from
Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ else
endif

EE_CFLAGS += -fsingle-precision-constant -DOPL_VERSION=\"$(OPL_VERSION)\"

# There are a few places where the config key/value are truncated, so disable these warnings
EE_CFLAGS += -Wno-format-truncation -Wno-stringop-truncation
EE_OBJS += $(FRONTEND_OBJS) $(GFX_OBJS) $(MISC_OBJS) $(EECORE_OBJS) $(IOP_OBJS)
EE_OBJS := $(EE_OBJS:%=$(EE_OBJS_DIR)%)

Expand Down
4 changes: 2 additions & 2 deletions modules/debug/ioptrap/ioptrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

IRX_ID("ioptrap_driver", 1, 1);

struct irx_export_table _exp_ioptrap;
extern struct irx_export_table _exp_ioptrap;


static const char *exception_type_name[] = {
Expand Down Expand Up @@ -77,7 +77,7 @@ exception_type_t dbg_setjmp()
typedef struct _smod_mod_info
{
struct _smod_mod_info *next;
u8 *name;
char *name;
u16 version;
u16 newflags; /* For modload shipped with games. */
u16 id;
Expand Down
38 changes: 10 additions & 28 deletions modules/debug/ps2link/cmdHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ pkoExecIop(char *buf, int len)
pko_pkt_execiop_req *cmd;
int retval;
int arglen;
char *path;
char *args;
unsigned int argc;
int id;
Expand All @@ -72,7 +71,6 @@ pkoExecIop(char *buf, int len)

printf("IOP cmd: %ld args\n", ntohl(cmd->argc));

path = &cmd->argv[0];
args = &cmd->argv[strlen(cmd->argv) + 1];
argc = ntohl(cmd->argc);

Expand Down Expand Up @@ -161,33 +159,25 @@ pkoSendSifCmd(unsigned int cmd, void *src, unsigned int len)
static void
pkoExecEE(char *buf, int len)
{
int ret;

ret = pkoSendSifCmd(PKO_RPC_EXECEE, buf, len);
pkoSendSifCmd(PKO_RPC_EXECEE, buf, len);
};
//////////////////////////////////////////////////////////////////////////
static void
pkoGSExec(char *buf, int len)
{
int ret;

ret = pkoSendSifCmd(PKO_RPC_GSEXEC, buf, len);
pkoSendSifCmd(PKO_RPC_GSEXEC, buf, len);
};
//////////////////////////////////////////////////////////////////////////
static void
pkoNetDump(char *buf, int len)
{
int ret;

ret = pkoSendSifCmd(PKO_RPC_NETDUMP, buf, len);
pkoSendSifCmd(PKO_RPC_NETDUMP, buf, len);
};
//////////////////////////////////////////////////////////////////////////
static void
pkoScrDump(char *buf, int len)
{
int ret;

ret = pkoSendSifCmd(PKO_RPC_SCRDUMP, buf, len);
pkoSendSifCmd(PKO_RPC_SCRDUMP, buf, len);
};

//////////////////////////////////////////////////////////////////////////
Expand All @@ -201,8 +191,6 @@ pkoPowerOff()
static void
pkoReset(char *buf, int len)
{
int ret;

dbgprintf("IOP cmd: RESET\n");

if (len != sizeof(pko_pkt_reset_req)) {
Expand All @@ -215,43 +203,37 @@ pkoReset(char *buf, int len)
printf("unmounted\n");
DelDrv("tty");

ret = pkoSendSifCmd(PKO_RPC_RESET, buf, len);
pkoSendSifCmd(PKO_RPC_RESET, buf, len);
};

static void
pkoStopVU(char *buf, int len)
{
int ret;

ret = pkoSendSifCmd(PKO_RPC_STOPVU, buf, len);
pkoSendSifCmd(PKO_RPC_STOPVU, buf, len);
};

static void
pkoStartVU(char *buf, int len)
{
int ret;
ret = pkoSendSifCmd(PKO_RPC_STARTVU, buf, len);
pkoSendSifCmd(PKO_RPC_STARTVU, buf, len);
};

static void
pkoDumpMem(char *buf, int len)
{
int ret;
ret = pkoSendSifCmd(PKO_RPC_DUMPMEM, buf, len);
pkoSendSifCmd(PKO_RPC_DUMPMEM, buf, len);
};

static void
pkoDumpReg(char *buf, int len)
{
int ret;
ret = pkoSendSifCmd(PKO_RPC_DUMPREG, buf, len);
pkoSendSifCmd(PKO_RPC_DUMPREG, buf, len);
};

static void
pkoWriteMem(char *buf, int len)
{
int ret;
ret = pkoSendSifCmd(PKO_RPC_WRITEMEM, buf, len);
pkoSendSifCmd(PKO_RPC_WRITEMEM, buf, len);
};

//////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion modules/debug/ps2link/excepHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extern int excepscrdump;
typedef struct _smod_mod_info
{
struct _smod_mod_info *next;
u8 *name;
char *name;
u16 version;
u16 newflags; /* For modload shipped with games. */
u16 id;
Expand Down
2 changes: 1 addition & 1 deletion modules/debug/udptty-ingame/udptty.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#define MODNAME "udptty"
IRX_ID(MODNAME, 2, 1);

struct irx_export_table _exp_udptty;
extern struct irx_export_table _exp_udptty;

#define DEVNAME "tty"

Expand Down
8 changes: 4 additions & 4 deletions modules/ds34bt/iop/ds34bt.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ static void HCI_event_task(int result)
}
DPRINTF("\n");
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 5, 6) == 0) {
// store the handle for the ACL connection
ds34pad[i].hci_handle = hci_buf[3] | ((hci_buf[4] & 0x0F) << 8);
break;
Expand Down Expand Up @@ -666,14 +666,14 @@ static void HCI_event_task(int result)
DPRINTF("\t Status = 0x%02X \n", hci_buf[2]);
if (!hci_buf[2]) {
for (i = 0; i < MAX_PADS; i++) {
if (strncmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
if (memcmp(ds34pad[i].bdaddr, hci_buf + 3, 6) == 0) {
break;
}
}
if (i >= MAX_PADS) {
break;
}
if (strncmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
if (memcmp(hci_buf + 9, "Wireless Controller", 19) == 0) {
ds34pad[i].type = DS4;
ds34pad[i].isfake = 0;
DPRINTF("\t Type: Dualshock 4 \n");
Expand Down Expand Up @@ -1654,7 +1654,7 @@ void *rpc_sf(int cmd, void *data, int size)
ds34bt_set_led((u8 *)(data + 1), *(u8 *)data);
break;
case DS34BT_GET_DATA:
ds34bt_get_data((u8 *)data, 18, *(u8 *)data);
ds34bt_get_data((char *)data, 18, *(u8 *)data);
break;
case DS34BT_RESET:
ds34bt_reset();
Expand Down
1 change: 1 addition & 0 deletions modules/ds34bt/iop/imports.lst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ stdio_IMPORTS_end

sysclib_IMPORTS_start
I_strncmp
I_memcmp
AKuHAK marked this conversation as resolved.
Show resolved Hide resolved
sysclib_IMPORTS_end

thsemap_IMPORTS_start
Expand Down
2 changes: 1 addition & 1 deletion modules/ds34usb/iop/ds34usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ void *rpc_sf(int cmd, void *data, int size)
ds34usb_set_led((u8 *)(data + 1), *(u8 *)data);
break;
case DS34USB_GET_DATA:
ds34usb_get_data((u8 *)data, 18, *(u8 *)data);
ds34usb_get_data((char *)data, 18, *(u8 *)data);
break;
case DS34USB_RESET:
ds34usb_reset();
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/cdvdfsv/cdvdfsv.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static u8 shutdown_rpcbuf[16];

static int rpc0_thread_id, rpc1_thread_id, rpc2_thread_id, rpc_sd_thread_id;

struct irx_export_table _exp_cdvdfsv;
extern struct irx_export_table _exp_cdvdfsv;

//-------------------------------------------------------------------------
int _start(int argc, char *argv[])
Expand Down
5 changes: 2 additions & 3 deletions modules/iopcore/cdvdman/cdvdman.c
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,6 @@ static int cdvdman_findfile(cd_file_t *pcdfile, const char *name, int layer)
static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_size)
{
int i;
u8 dummy;
u8 *p;
u8 rdbuf[64];

Expand All @@ -1687,7 +1686,7 @@ static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_s

if (!(CDVDreg_SDATAIN & 0x40)) {
do {
dummy = CDVDreg_SDATAOUT;
(void)CDVDreg_SDATAOUT;
} while (!(CDVDreg_SDATAIN & 0x40));
}

Expand All @@ -1699,7 +1698,7 @@ static int cdvdman_writeSCmd(u8 cmd, void *in, u32 in_size, void *out, u32 out_s
}

CDVDreg_SCOMMAND = cmd;
dummy = CDVDreg_SCOMMAND;
(void)CDVDreg_SCOMMAND;

while (CDVDreg_SDATAIN & 0x80) {
;
Expand Down
5 changes: 2 additions & 3 deletions modules/iopcore/cdvdman/hdpro_atad.c
Original file line number Diff line number Diff line change
Expand Up @@ -468,10 +468,9 @@ int ata_io_start(void *buf, u32 blkcount, u16 feature, u16 nsector, u16 sector,
suspend_intr();
HDPROreg_IO8 = 0x21;
CDVDreg_STATUS = 0;
unsigned int dummy = HDPROreg_IO8;
(void)HDPROreg_IO8;
CDVDreg_STATUS = 0;
resume_intr();
dummy = 0;

/* Finally! We send off the ATA command with arguments. */
hdpro_io_write(ATAreg_CONTROL_WR, (using_timeout == 0) << 1);
Expand Down Expand Up @@ -712,7 +711,7 @@ int ata_device_sector_io(int device, void *buf, u32 lba, u32 nsectors, int dir)
continue;

nbytes = len * 512;
buf = (void *)((u8 *)buf + len * 512);
buf = (void *)((u8 *)buf + nbytes);
lba += len;
nsectors -= len;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/cdvdman/ioplib_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static struct FakeModule modulefake_list[] = {
{NULL, NULL, 0, 0}};

//--------------------------------------------------------------
int getModInfo(u8 *modname, modinfo_t *info)
int getModInfo(char *modname, modinfo_t *info)
{
iop_library_t *libptr;
register int i;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/cdvdman/ioplib_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ typedef struct
void **exports;
} modinfo_t;

int getModInfo(u8 *modname, modinfo_t *info);
int getModInfo(char *modname, modinfo_t *info);
void hookMODLOAD(void);

#endif /* IOPLIB_UTIL_H */
14 changes: 7 additions & 7 deletions modules/iopcore/cdvdman/smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static int asciiToUtf16(char *out, const char *in)
{
int len;
const char *pIn;
u8 *pOut;
char *pOut;

for (pIn = in, pOut = out, len = 0; *pIn != '\0'; pIn++, pOut += 2, len += 2) {
pOut[0] = *pIn;
Expand Down Expand Up @@ -381,26 +381,26 @@ int smb_SessionSetupAndX(u32 capabilities)
}

// Add User name
offset += setStringField(&SSR->ByteField[offset], server_specs.Username);
offset += setStringField((char *)&SSR->ByteField[offset], server_specs.Username);

// PrimaryDomain, acquired from Negotiate Protocol Response data
offset += setStringField(&SSR->ByteField[offset], server_specs.PrimaryDomainServerName);
offset += setStringField((char *)&SSR->ByteField[offset], server_specs.PrimaryDomainServerName);

// NativeOS
if (useUnicode && ((offset & 1) != 0)) {
//If Unicode is used, the field must begin on a 16-bit aligned address.
SSR->ByteField[offset] = '\0';
offset++;
}
offset += setStringField(&SSR->ByteField[offset], "PlayStation 2");
offset += setStringField((char *)&SSR->ByteField[offset], "PlayStation 2");

// NativeLanMan
if (useUnicode && ((offset & 1) != 0)) {
//If Unicode is used, the field must begin on a 16-bit aligned address.
SSR->ByteField[offset] = '\0';
offset++;
}
offset += setStringField(&SSR->ByteField[offset], "SMBMAN");
offset += setStringField((char *)&SSR->ByteField[offset], "SMBMAN");

SSR->ByteCount = offset;

Expand Down Expand Up @@ -466,7 +466,7 @@ int smb_TreeConnectAndX(char *ShareName)
}

// Add share name
offset += setStringField(&TCR->ByteField[offset], ShareName);
offset += setStringField((char *)&TCR->ByteField[offset], ShareName);

mips_memcpy(&TCR->ByteField[offset], "?????\0", 6); // Service, any type of device
offset += 6;
Expand Down Expand Up @@ -522,7 +522,7 @@ int smb_OpenAndX(char *filename, u16 *FID, int Write)
}

// Add filename
offset += setStringField(&OR->ByteField[offset], filename);
offset += setStringField((char *)&OR->ByteField[offset], filename);
OR->ByteCount = offset;

nb_SetSessionMessage(sizeof(OpenAndXRequest_t) + offset + 1);
Expand Down
12 changes: 6 additions & 6 deletions modules/iopcore/common/cdvd_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ struct cdvdman_settings_hdd
struct cdvdman_settings_smb
{
struct cdvdman_settings_common common;
s8 filename[80];
char filename[88];
union
{
struct
{
//Please keep the string lengths in-sync with the limits within the UI.
s8 smb_ip[16];
char smb_ip[16];
u16 smb_port;
s8 smb_share[32];
s8 smb_prefix[32];
s8 smb_user[32];
s8 smb_password[32];
char smb_share[32];
char smb_prefix[32];
char smb_user[32];
char smb_password[32];
};
u16 FIDs[ISO_MAX_PARTS];
};
Expand Down
4 changes: 2 additions & 2 deletions modules/iopcore/common/oplsmb.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ typedef struct
{
u32 MaxBufferSize;
u32 SessionKey;
u8 PrimaryDomainServerName[32];
char PrimaryDomainServerName[32];
u8 EncryptionKey[8];
u32 Capabilities;
u16 MaxMpxCount;
u8 SecurityMode; // 0 = share level, 1 = user level
u8 PasswordType; // 0 = PlainText passwords, 1 = use challenge/response
char Username[36];
u8 Password[48]; // either PlainText, either hashed
char Password[48]; // either PlainText, either hashed
int PasswordLen;
int HashedFlag;
void *IOPaddr;
Expand Down
2 changes: 1 addition & 1 deletion modules/iopcore/imgdrv/imgdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ iop_device_ops_t my_device_ops =
dummy_fs,//chstat*/
};

const u8 name[] = "img";
const char name[] = "img";
iop_device_t my_device = {
name,
IOP_DT_FS,
Expand Down
Loading