diff options
author | Ash Wolf <ninji@wuffs.org> | 2023-01-20 00:39:43 +0000 |
---|---|---|
committer | Ash Wolf <ninji@wuffs.org> | 2023-01-20 00:39:43 +0000 |
commit | 7d986adf37220e1981a707745b784b078de4e3bc (patch) | |
tree | 831dea5f470c0c6b3c373f38d3a5f0354bc22600 /includes | |
parent | 4d670146b4054e11e90227f96a3a1c66410e8d0b (diff) | |
download | MWCC-7d986adf37220e1981a707745b784b078de4e3bc.tar.gz MWCC-7d986adf37220e1981a707745b784b078de4e3bc.zip |
fix various inaccuracies exposed by the mach ppc plugin
Diffstat (limited to 'includes')
-rw-r--r-- | includes/compiler/CError.h | 21 | ||||
-rw-r--r-- | includes/compiler/CInt64.h | 7 | ||||
-rw-r--r-- | includes/compiler/ObjGenMachO.h | 2 | ||||
-rw-r--r-- | includes/compiler/common.h | 13 | ||||
-rw-r--r-- | includes/oslib.h | 4 |
5 files changed, 17 insertions, 30 deletions
diff --git a/includes/compiler/CError.h b/includes/compiler/CError.h index 8eaefd9..e8de502 100644 --- a/includes/compiler/CError.h +++ b/includes/compiler/CError.h @@ -615,34 +615,13 @@ extern void CError_SetNullErrorToken(void); extern void CError_LockErrorPos(TStreamElement *token, TStreamElement **saved); extern void CError_UnlockErrorPos(TStreamElement **saved); extern void CError_ResetErrorSkip(void); -extern void CError_GetErrorString(char *buf, short code); -extern void CError_BufferInit(CErrorBuffer *eb, char *buf, SInt32 bufSize); -extern void CError_BufferGrow(CErrorBuffer *eb, SInt32 amount); -extern void CError_BufferAppendChar(CErrorBuffer *eb, char ch); -extern void CError_BufferAppendString(CErrorBuffer *eb, const char *str); -extern void CError_BufferTerminate(CErrorBuffer *eb); -extern void CError_BufferAppendQualifier(CErrorBuffer *eb, UInt32 qual); -extern void CError_BufferAppendTemplArgExpr(CErrorBuffer *eb, ENode *node); -extern void CError_BufferAppendTemplArg(CErrorBuffer *eb, TemplArg *targ); -extern void CError_BufferAppendTemplArgs(CErrorBuffer *eb, TemplArg *targs); -extern void CError_BufferAppendNameSpace(CErrorBuffer *eb, NameSpace *nspace); -extern void CError_BufferAppendPType(CErrorBuffer *eb, Type *ty); -extern void CError_BufferAppendTemplDepType(CErrorBuffer *eb, TypeTemplDep *type); -extern void CError_BufferAppendFuncArgs(CErrorBuffer *eb, TypeFunc *tfunc, Boolean isMethod); -extern void CError_BufferAppendType(CErrorBuffer *eb, Type *ty, UInt32 qual); extern char *CError_GetTypeName(Type *ty, UInt32 qual, Boolean useGlobalHeap); -extern void CError_AppendUnqualFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc); -extern void CError_AppendFunctionName(CErrorBuffer *eb, NameSpace *nspace, HashNameNode *name, TemplArg *templargs, TypeFunc *tfunc); -extern void CError_AppendObjectName(CErrorBuffer *eb, Object *obj); -extern void CError_AppendMethodName(CErrorBuffer *eb, ObjCMethod *meth); extern char *CError_GetQualifiedName(NameSpace *nspace, HashNameNode *name); extern char *CError_GetFunctionName(NameSpace *nspace, HashNameNode *name, TypeFunc *tfunc); extern char *CError_GetObjectName(Object *obj); extern char *CError_GetNameString(NameSpace *nspace, HashNameNode *operatorName); extern void CError_ErrorMessage(int errTable, char *buf, Boolean flag1, Boolean flag2); -extern void CError_BufferAppendTemplateStack(CErrorBuffer *eb); extern void CError_ErrorMessageVA(int code, const char *format, va_list list, Boolean flag1, Boolean flag2); -extern void CError_VAErrorMessage(int code, va_list list, Boolean flag1, Boolean flag2); extern void CError_Error(int code, ...); extern void CError_ErrorTerm(short code); extern void CError_ErrorSkip(int code, ...); diff --git a/includes/compiler/CInt64.h b/includes/compiler/CInt64.h index 663168a..56fce08 100644 --- a/includes/compiler/CInt64.h +++ b/includes/compiler/CInt64.h @@ -27,18 +27,11 @@ CW_INLINE void CInt64_SetULong(CInt64 *pN, UInt32 n) { } CW_INLINE Boolean CInt64_IsZero(CInt64 *n) { - //if (n->hi == 0 && n->lo == 0) - // return 1; - //else - // return 0; return n->hi == 0 && n->lo == 0; } CW_INLINE Boolean CInt64_IsOne(CInt64 *n) { // assumed name return n->hi == 0 && n->lo == 1; } -CW_INLINE void CInt64_Extend32(CInt64 *n) { // assumed name - n->hi = (n->lo >> 31) ? 0xFFFFFFFF : 0; -} extern void CInt64_Init(void); extern CInt64 CInt64_Not(CInt64 input); diff --git a/includes/compiler/ObjGenMachO.h b/includes/compiler/ObjGenMachO.h index 4088a7f..4467bd0 100644 --- a/includes/compiler/ObjGenMachO.h +++ b/includes/compiler/ObjGenMachO.h @@ -62,7 +62,7 @@ extern void ObjGen_DeclareVectorConst(Object *object); extern void ObjGenMach_SymFuncEnd(Object *function, UInt32 offset); extern void ObjGen_CodeSetup(void); extern MachOSection *ObjGen_DeclareFunction(Object *object); -extern MachOSection *ObjGen_DeclareMachSection(/* unknown args */); +extern MachOSection *ObjGen_DeclareMachSection(char *segname, char *sectname, UInt32 align, UInt32 flags); extern void ObjGen_Relocate(MachOSection *section, SInt32 offset, SInt32 relocID, RelocType relocType, MWReloc mwRelType); extern SInt32 ObjGen_DeclareLiteralString(UInt32 len, char *data, SInt32 align); extern UInt32 ObjGen_GetSectSize(MachOSection *section); diff --git a/includes/compiler/common.h b/includes/compiler/common.h index fc5e84e..ed5b25a 100644 --- a/includes/compiler/common.h +++ b/includes/compiler/common.h @@ -3,6 +3,8 @@ #include "cw_common.h" +enum { CR = 13, LF = 10 }; + typedef struct HashNameNode { struct HashNameNode *next; SInt32 id; @@ -326,9 +328,18 @@ struct CompilerLinkerParamBlk { #define FITS_IN_USHORT(value) ( (value) == ((unsigned short) (value)) ) #define FITS_IN_HI_SHORT(value) ( (value) == (value & 0xFFFF0000) ) #define FITS_IN_SHORT2(value) ( ((short) (value)) == (value) ) -#define HIGH_PART(value) ( (short) (((value) >> 16) + (((value) & 0x8000) >> 15)) ) +#define HIGH_PART(value) ( (short) (((value) >> 16) + (((value) >> 15) & 1)) ) #define LOW_PART(value) ( (short) (value) ) +// The PowerPC code generator has a bug which breaks the PowerPC code generator, +// causing 32-bit value loads to emit "addi x, y, 0" even if the lower 16 bits are +// zero. This define simulates that behaviour on other platforms +#ifdef CW_REPLICATE_PPC_CODEGEN_BUG +#define LOW_PART_BUGGY(value) (value) +#else +#define LOW_PART_BUGGY(value) ( (short) (value) ) +#endif + #ifdef __MWERKS__ #pragma options align=reset #endif diff --git a/includes/oslib.h b/includes/oslib.h index 3c8d88c..5959efe 100644 --- a/includes/oslib.h +++ b/includes/oslib.h @@ -3,7 +3,11 @@ #include "common.h" +#ifdef CW_HOST_MAC_CLASSIC +#define OS_PATHSEP ':' +#else #define OS_PATHSEP '/' +#endif /** * OS abstraction layer |