Source fixes for clangd

This commit is contained in:
Luke Street 2024-10-22 22:36:42 -06:00
parent 9d5e8cf129
commit 0035e33166
5 changed files with 29 additions and 14 deletions

View file

@ -1,6 +1,7 @@
#ifndef _CTYPE_H
#define _CTYPE_H
#include "dolphin/types.h"
extern unsigned char __ctype_map[256];
extern unsigned char __lower_map[256];
@ -22,19 +23,25 @@ extern unsigned char __upper_map[256];
#define __whitespace (__motion_char | __space_char)
#define __control (__motion_char | __control_char)
#ifdef __MWERKS__
#define DECL_WEAK __declspec(weak)
#else
#define DECL_WEAK __attribute__((weak))
#endif
#ifdef __cplusplus
extern "C"
{
#endif
__declspec(weak) int isalpha(int __c);
__declspec(weak) int isdigit(int __c);
__declspec(weak) int isspace(int __c);
__declspec(weak) int isupper(int __c);
__declspec(weak) int isxdigit(int __c);
DECL_WEAK int isalpha(int __c);
DECL_WEAK int isdigit(int __c);
DECL_WEAK int isspace(int __c);
DECL_WEAK int isupper(int __c);
DECL_WEAK int isxdigit(int __c);
__declspec(weak) int tolower(int __c);
__declspec(weak) int toupper(int __c);
DECL_WEAK int tolower(int __c);
DECL_WEAK int toupper(int __c);
// added underscore to avoid naming conflicts
inline int _isalpha(int c) { return (int)(__ctype_map[(u8)c] & __letter); }

View file

@ -19,7 +19,7 @@ extern "C" {
#ifdef __MWERKS__
#define AT_ADDRESS(xyz) : (xyz)
#else
#define AT_ADDRESS
#define AT_ADDRESS(xyz)
#endif
typedef s64 OSTime;
typedef u32 OSTick;

View file

@ -7,7 +7,7 @@
void GWInit(void);
void GWGameStatReset(void);
s32 GWMessSpeedGet(void);
// s32 GWMessSpeedGet(void);
s32 GWMessDelayGet(void);
void GWMGRecordSet(s32 index, u32 value);
u32 GWMGRecordGet(s32 index);

View file

@ -7,6 +7,7 @@
#define _MATH_INLINE static inline
#endif
#ifdef __MWERKS__
extern inline float sqrtf(float x)
{
volatile float y;
@ -21,6 +22,9 @@ extern inline float sqrtf(float x)
}
return x;
}
#else
float sqrtf(float x);
#endif
double atan(double x);
double copysign(double x, double y);
@ -38,15 +42,15 @@ double fmod(double x, double y);
double log(double x);
double pow(double x, double y);
float tanf(float x);
float sinf(float x);
float cosf(float x);
float atan2f(float y, float x);
float acosf(float x);
#ifdef __MWERKS__
extern inline double fabs(double x)
{
return __fabs(x);
}
#else
double fabs(double x);
#endif
_MATH_INLINE float fabsf(float x) { return (float)fabs((double)x); }
_MATH_INLINE float sinf(float x) { return (float)sin((double)x); }

View file

@ -1,6 +1,10 @@
#ifndef _STDLIB_H
#define _STDLIB_H
#ifdef __MWERKS__
#define abs(x) __abs(x)
#else
int abs(int x);
#endif
#endif