Merge pull request #201 from fjtrujy/WerrorCFlags

This commit is contained in:
Ben
2024-05-18 08:43:24 +10:00
committed by GitHub
8 changed files with 23 additions and 19 deletions

View File

@@ -72,7 +72,7 @@ AC_SUBST(PSPSDK_INCLUDEDIR)
AC_SUBST(PSPSDK_LIBDIR)
# CFLAGS and CXXFLAGS used to build pspsdk libraries.
PSPSDK_CFLAGS="$CFLAGS -mno-gpopt -Wall -D_PSP_FW_VERSION=600"
PSPSDK_CFLAGS="$CFLAGS -mno-gpopt -Wall -Werror -D_PSP_FW_VERSION=600"
PSPSDK_CXXFLAGS="$PSPSDK_CFLAGS -fno-exceptions -fno-rtti"
if test "$with_pthread" = no ; then
PSPSDK_CFLAGS="$PSPSDK_CFLAGS -DPSP_WITHOUT_PTHREAD"

View File

@@ -30,13 +30,6 @@ void pspAudioSetVolume(int channel, int left, int right)
AudioStatus[channel].volumeleft = left;
}
void pspAudioChannelThreadCallback(int channel, void *buf, unsigned int reqn)
{
pspAudioCallback_t callback;
callback=AudioStatus[channel].callback;
}
void pspAudioSetChannelCallback(int channel, pspAudioCallback_t callback, void *pdata)
{
volatile psp_audio_channelinfo *pci = &AudioStatus[channel];

View File

@@ -41,7 +41,6 @@ void pspAudioEndPre();
void pspAudioEnd();
void pspAudioSetVolume(int channel, int left, int right);
void pspAudioChannelThreadCallback(int channel, void *buf, unsigned int reqn);
void pspAudioSetChannelCallback(int channel, pspAudioCallback_t callback, void *pdata);
int pspAudioOutBlocking(unsigned int channel, unsigned int vol1, unsigned int vol2, void *buf);

View File

@@ -12,6 +12,7 @@
#include <pspkernel.h>
#include <pspdebug.h>
#include <string.h>
#include <stddef.h>
#define CALL 0x0C000000
#define CALL_MASK 0xFC000000
@@ -21,9 +22,13 @@
extern u32 _ftext;
extern u32 _etext;
/* Ideally should be something which is automatic */
#define ELF_START (&_ftext)
#define ELF_END (&_etext)
static inline int validAddress(u32 *addr)
{
u32 *elf_start = &_ftext;
u32 *elf_end = &_etext;
ptrdiff_t startDiff = addr - elf_start;
return (startDiff >= 2) && (addr < elf_end);
}
/* This is a blatently wrong way of doing a stack trace, but I felt as long as you use some intelligence you
could easily work out if some calls in the trace were invalid :P */
@@ -32,7 +37,7 @@ static int _pspDebugDoStackTrace(u32 *sp, u32 *sp_end, u32 *ra, PspDebugStackTra
int count = 0;
int recurse = 0;
if((ra >= (ELF_START + 2)) && (ra < ELF_END) && (IS_CALL(ra[-2])))
if (validAddress(ra) && (IS_CALL(ra[-2])))
{
trace[count].func_addr = CALL_ADDR(ra[-2]);
trace[count].call_addr = (u32) (&ra[-2]);
@@ -48,7 +53,7 @@ static int _pspDebugDoStackTrace(u32 *sp, u32 *sp_end, u32 *ra, PspDebugStackTra
addr = (u32*) *sp;
/* Check that the address could possibly be a valid ra address */
if((addr >= (ELF_START + 2)) && (addr < ELF_END))
if (validAddress(addr))
{
if(IS_CALL(addr[-2]))
{

View File

@@ -152,7 +152,8 @@ int _open(const char *buf, int flags, int mode) {
return __set_errno(scefd);
}
}
#else
int _open(const char *buf, int flags, int mode);
#endif
#ifdef F__close
@@ -339,8 +340,6 @@ int lstat(const char *filename, struct stat *buf)
#ifdef F__fstat
int _fstat(int fd, struct stat *buf) {
int ret;
SceOff oldpos;
if (!__IS_FD_VALID(fd)) {
errno = EBADF;
return -1;
@@ -1070,6 +1069,8 @@ int statvfs (const char *__path, struct statvfs *__buf)
__buf->f_bfree = inf.freeClusters;
__buf->f_bavail = inf.freeClusters;
__buf->f_namemax = MAXNAMLEN;
return 0;
}
#endif /* F_statvfs */

View File

@@ -92,7 +92,8 @@ void __libcglue_deinit();
#endif
#ifdef F__exit
void _exit(int status)
__attribute__((__noreturn__))
void _exit (int __status)
{
__libcglue_deinit();
@@ -101,9 +102,12 @@ void _exit(int status)
} else {
sceKernelExitGame();
}
while (1); // Avoid warning
}
#else
void _exit(int status);
__attribute__((__noreturn__))
void _exit (int __status);
#endif
#ifdef F_abort

View File

@@ -15,6 +15,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/lock.h>
#include <pspthreadman.h>

View File

@@ -12,6 +12,7 @@
#ifndef PSP_WITHOUT_PTHREAD
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pspkerneltypes.h>
#include <pspthreadman.h>