[iQue] Build some C files with EGCS (#2396)

This commit is contained in:
cadmic
2025-01-02 00:35:22 -08:00
committed by GitHub
parent ffc9f2d4f1
commit 9dafc2f2e4
19 changed files with 121 additions and 37 deletions
+13 -3
View File
@@ -8,12 +8,22 @@
#endif
#define UNUSED __attribute__((unused))
#define FALLTHROUGH __attribute__((fallthrough))
#define NORETURN __attribute__((noreturn))
#define NO_REORDER __attribute__((no_reorder))
#define SECTION_DATA __attribute__((section(".data")))
#ifdef __GNUC__
#if __GNUC__ >= 7
#define FALLTHROUGH __attribute__((fallthrough))
#else
#define FALLTHROUGH
#endif
#if defined(__GNUC__) && defined(NON_MATCHING)
#define NORETURN __attribute__((noreturn))
#else
#define NORETURN
#endif
#if defined(__GNUC__) && defined(NON_MATCHING)
#define UNREACHABLE() __builtin_unreachable()
#else
#define UNREACHABLE()
+1 -1
View File
@@ -29,7 +29,7 @@ __attribute__((noreturn)) void __assert(const char* assertion, const char* file,
// Static/compile-time assertions
#if !defined(__sgi) && (defined(__GNUC__) || (__STDC_VERSION__ >= 201112L))
#if !defined(__sgi) && (__GNUC__ >= 5 || __STDC_VERSION__ >= 201112L)
# define static_assert(cond, msg) _Static_assert(cond, msg)
#else
# ifndef GLUE
+26 -4
View File
@@ -1,16 +1,16 @@
#ifndef STDARG_H
#define STDARG_H
// When building with GCC, use the official vaarg macros to avoid warnings and possibly bad codegen.
// When building with modern GCC, use the official vaarg macros to avoid warnings and possibly bad codegen.
#ifdef __GNUC__
#if __GNUC__ >= 3
#define va_list __builtin_va_list
#define va_start __builtin_va_start
#define va_arg __builtin_va_arg
#define va_end __builtin_va_end
#else
#elif defined(__sgi) /* IDO */
#ifndef _VA_LIST_
# define _VA_LIST_
@@ -52,6 +52,28 @@ typedef char* va_list;
/* No cleanup processing is required for the end of a varargs list: */
#define va_end(__list)
#endif /* __GNUC__ */
#else /* EGCS */
typedef char * __gnuc_va_list;
#define __va_rounded_size(__TYPE) \
(((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define va_start(__AP, __LASTARG) \
(__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
#define va_end(__AP) ((void)0)
/* We cast to void * and then to TYPE * because this avoids
a warning about increasing the alignment requirement. */
#define va_arg(__AP, __type) \
((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8 \
: ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4) \
+ __va_rounded_size(__type))))[-1]
typedef __gnuc_va_list va_list;
#endif
#endif
+1 -1
View File
@@ -15,7 +15,7 @@ typedef unsigned long size_t;
#endif
#ifdef __GNUC__
#if __GNUC__ >= 4
#define offsetof(structure, member) __builtin_offsetof (structure, member)
#else
#define offsetof(structure, member) ((size_t)&(((structure*)0)->member))
+2
View File
@@ -53,6 +53,8 @@
#define PRINTF osSyncPrintf
#elif IDO_PRINTF_WORKAROUND
#define PRINTF(args) (void)0
#elif defined(__GNUC__) && __GNUC__ < 3
#define PRINTF(format, args...) (void)0
#else
#define PRINTF(format, ...) (void)0
#endif
+1 -1
View File
@@ -5,7 +5,7 @@
void osSyncPrintf(const char* fmt, ...);
#ifdef __GNUC__
#if defined(__GNUC__) && defined(NON_MATCHING)
void bzero(void* __s, unsigned int __n);
int bcmp(const void* __sl, const void* __s2, unsigned int __n);
void bcopy(const void* __src, void* __dest, unsigned int __n);
+1 -3
View File
@@ -201,11 +201,9 @@ typedef struct AdpcmBookHeader {
* The procedure used to design the codeBook is based on an adaptive clustering algorithm.
* The size of the codeBook is (8 * order * numPredictors) and is 8-byte aligned
*/
typedef s16 AdpcmBookData[];
typedef struct AdpcmBook {
/* 0x00 */ AdpcmBookHeader header;
/* 0x08 */ AdpcmBookData book; // size 8 * order * numPredictors. 8-byte aligned
/* 0x08 */ s16 book[1]; // size 8 * order * numPredictors. 8-byte aligned
} AdpcmBook; // size >= 0x8
typedef struct Sample {