mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-23 15:52:42 +02:00
linux-build: -std=gnu extensions + fix remaining snprintf decls
- CMakeLists: CMAKE_C_EXTENSIONS/CXX_EXTENSIONS ON. Strict -std=c11/c++20
define __STRICT_ANSI__, which disables glibc _DEFAULT_SOURCE and hides
clock_gettime(CLOCK_REALTIME) etc. that port/src/libultra.c needs.
-std=gnu11/gnu++20 is GCC's default and what MinGW already used.
- port/src/{pccg,pcmodels,romdata}.c: local 'extern int snprintf(...,
unsigned long long maxsize, ...)' decls conflict with glibc's size_t one
(same bug already fixed in pc_protos.h in M-39); spell it size_t.
- libultra.c: drop the _GNU_SOURCE define (pulls cpu_set_t refs into
<pthread.h> without <sched.h>); the D60 POSIX stack-bounds diagnostic
now just prints n/a rather than needing pthread_getattr_np.
Windows: full rebuild 240/241, -level_09 crash-free past frame 1740.
This commit is contained in:
1 parent
59751d608c
commit
7c3bb42687
6 files changed
+13
-24
No files matched your search
+6
-2
@@ -52,9 +52,13 @@ include(TargetArch)
|
||||
include(FindPkgConfig)
|
||||
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_EXTENSIONS OFF)
|
||||
# GNU extensions ON: strict -std=c11/-std=c++20 define __STRICT_ANSI__, which
|
||||
# disables glibc's _DEFAULT_SOURCE and hides POSIX symbols the port needs
|
||||
# (clock_gettime/CLOCK_REALTIME in port/src/libultra.c, mmap flags, etc.).
|
||||
# -std=gnu11/gnu++20 is GCC's own default and what MinGW was already using.
|
||||
set(CMAKE_C_EXTENSIONS ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
set(CMAKE_CXX_EXTENSIONS ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Default build type
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 531 KiB |
+4
-19
@@ -1,8 +1,3 @@
|
||||
/* POSIX: enable clock_gettime(CLOCK_REALTIME/MONOTONIC) and pthread_getattr_np. */
|
||||
#if !defined(_WIN32) && !defined(_GNU_SOURCE)
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* libultra OS shims for the PC port, plus the cooperative thread kernel.
|
||||
*
|
||||
@@ -841,20 +836,10 @@ static void piServiceDma(s32 direction, u32 srcPA, void *dstVA, u32 size)
|
||||
(uintptr_t)dstVA < (uintptr_t)thigh));
|
||||
}
|
||||
#else
|
||||
{
|
||||
pthread_attr_t at;
|
||||
void *sbase = NULL;
|
||||
size_t ssize = 0;
|
||||
if (pthread_getattr_np(pthread_self(), &at) == 0) {
|
||||
pthread_attr_getstack(&at, &sbase, &ssize);
|
||||
pthread_attr_destroy(&at);
|
||||
}
|
||||
sysLogPrintf(LOG_ERROR,
|
||||
"D60 thread stack: %p..%p dst-in-stack=%d\n",
|
||||
sbase, (void *)((uintptr_t)sbase + ssize),
|
||||
((uintptr_t)dstVA >= (uintptr_t)sbase &&
|
||||
(uintptr_t)dstVA < (uintptr_t)sbase + ssize));
|
||||
}
|
||||
/* TEMP D60 diagnostic: no portable committed-stack query without
|
||||
* _GNU_SOURCE (pthread_getattr_np); the raw stack window above and
|
||||
* the crash handler's register dump are enough to symbolicate. */
|
||||
sysLogPrintf(LOG_ERROR, "D60 thread stack: (n/a on POSIX)\n");
|
||||
#endif
|
||||
sysLogPrintf(LOG_ERROR,
|
||||
"D60 BAD DMA TARGET dst=%p src=0x%08X size=0x%X "
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@
|
||||
#include <string.h>
|
||||
|
||||
extern void *malloc(unsigned long long size);
|
||||
extern int snprintf(char *str, unsigned long long maxsize, const char *format, ...);
|
||||
extern int snprintf(char *str, size_t maxsize, const char *format, ...);
|
||||
|
||||
#include "platform.h"
|
||||
#include "system.h"
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
/* D38: <stdlib.h>/<string.h> resolve to the decomp's N64 stubs via the
|
||||
* include path; declare the host functions this file uses. */
|
||||
extern void *malloc(unsigned long long size);
|
||||
extern int snprintf(char *str, unsigned long long maxsize, const char *format, ...);
|
||||
extern int snprintf(char *str, size_t maxsize, const char *format, ...);
|
||||
|
||||
#include "platform.h"
|
||||
#include "system.h"
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@
|
||||
/* D38: <stdio.h>/<stdlib.h> resolve to the decomp's N64 stubs via the include
|
||||
* path; declare the host functions this file uses. */
|
||||
extern void *malloc(unsigned long long size);
|
||||
extern int snprintf(char *str, unsigned long long maxsize, const char *format, ...);
|
||||
extern int snprintf(char *str, size_t maxsize, const char *format, ...);
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
|
||||
Reference in new issue
Block a user