summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-11 23:26:04 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-11 23:26:04 +0000
commit54bb1363a26b6a52cf1a8ecf1f16f76e9920956f (patch)
tree53644f3d0a9b24a10275ba723f6e7e43aee00ec9 /includes
parent0bec4f557a96e1a40437cf5af20cc78a5eec8a63 (diff)
downloadMWCC-54bb1363a26b6a52cf1a8ecf1f16f76e9920956f.tar.gz
MWCC-54bb1363a26b6a52cf1a8ecf1f16f76e9920956f.zip
get it to compile with clang
Diffstat (limited to 'includes')
-rw-r--r--includes/cmdline.h2
-rw-r--r--includes/common.h4
-rw-r--r--includes/compiler/BitVector.h2
-rw-r--r--includes/compiler/CInt64.h14
-rw-r--r--includes/compiler/InlineAsm.h6
-rw-r--r--includes/compiler/IroFlowgraph.h10
-rw-r--r--includes/compiler/IroUtil.h6
-rw-r--r--includes/compiler/objects.h2
-rw-r--r--includes/oslib.h1
9 files changed, 26 insertions, 21 deletions
diff --git a/includes/cmdline.h b/includes/cmdline.h
index 6c39423..e9d3726 100644
--- a/includes/cmdline.h
+++ b/includes/cmdline.h
@@ -119,7 +119,7 @@ enum {
CLStr112 = 112
};
-#define DO_INTERNAL_ERROR(...) CLInternalError(__FILE__, __LINE__, __VA_ARGS__)
+#define DO_INTERNAL_ERROR(line, ...) CLInternalError(__FILE__, line, __VA_ARGS__)
#ifdef __MWERKS__
#pragma options align=mac68k
diff --git a/includes/common.h b/includes/common.h
index 5bbb017..ba9b54c 100644
--- a/includes/common.h
+++ b/includes/common.h
@@ -28,10 +28,14 @@
#define alloca(x) __alloca(x)
+#define CW_INLINE inline
+
#else
#include <stdarg.h>
// expand this to nothing
#define CW_PASCAL
+
+#define CW_INLINE static inline
#endif
// ----------
diff --git a/includes/compiler/BitVector.h b/includes/compiler/BitVector.h
index 724bb8f..a6830d6 100644
--- a/includes/compiler/BitVector.h
+++ b/includes/compiler/BitVector.h
@@ -23,7 +23,7 @@ extern void Bv_Set(BitVector *bv);
extern Boolean Bv_IsSubset(const BitVector *a, const BitVector *b);
extern Boolean Bv_IsEmpty(const BitVector *bv);
-inline void Bv_SetBit(UInt32 bit, BitVector *bv) {
+CW_INLINE void Bv_SetBit(UInt32 bit, BitVector *bv) {
if ((bit / 32) < bv->size) {
bv->data[bit / 32] |= 1 << (bit & 31);
} else {
diff --git a/includes/compiler/CInt64.h b/includes/compiler/CInt64.h
index a0938e2..663168a 100644
--- a/includes/compiler/CInt64.h
+++ b/includes/compiler/CInt64.h
@@ -10,33 +10,33 @@ extern const CInt64 cint64_one;
extern const CInt64 cint64_max;
extern const CInt64 cint64_min;
-inline Boolean CInt64_IsNegative(const CInt64 *n) {
+CW_INLINE Boolean CInt64_IsNegative(const CInt64 *n) {
return (n->hi & 0x80000000) != 0;
}
-inline UInt32 CInt64_GetULong(const CInt64 *n) { // 42E660 in mwcppc.exe
+CW_INLINE UInt32 CInt64_GetULong(const CInt64 *n) { // 42E660 in mwcppc.exe
return n->lo;
}
-inline void CInt64_SetLong(CInt64 *pN, SInt32 n) {
+CW_INLINE void CInt64_SetLong(CInt64 *pN, SInt32 n) {
pN->lo = n;
pN->hi = (n < 0) ? 0xFFFFFFFF : 0;
}
-inline void CInt64_SetULong(CInt64 *pN, UInt32 n) {
+CW_INLINE void CInt64_SetULong(CInt64 *pN, UInt32 n) {
pN->lo = n;
pN->hi = 0;
}
-inline Boolean CInt64_IsZero(CInt64 *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;
}
-inline Boolean CInt64_IsOne(CInt64 *n) { // assumed name
+CW_INLINE Boolean CInt64_IsOne(CInt64 *n) { // assumed name
return n->hi == 0 && n->lo == 1;
}
-inline void CInt64_Extend32(CInt64 *n) { // assumed name
+CW_INLINE void CInt64_Extend32(CInt64 *n) { // assumed name
n->hi = (n->lo >> 31) ? 0xFFFFFFFF : 0;
}
diff --git a/includes/compiler/InlineAsm.h b/includes/compiler/InlineAsm.h
index ca0032e..7c07b23 100644
--- a/includes/compiler/InlineAsm.h
+++ b/includes/compiler/InlineAsm.h
@@ -211,7 +211,7 @@ extern Object *InlineAsm_GetObjectOffset(InlineAsm *ia, SInt32 index, SInt32 *of
extern char *InlineAsm_DumpStatement(Statement *stmt);
// unknown name
-inline void InlineAsm_InitExpr5(IAExpr *expr, SInt32 value) {
+CW_INLINE void InlineAsm_InitExpr5(IAExpr *expr, SInt32 value) {
expr->type = IAExpr_5;
expr->flags = 0;
expr->value = value;
@@ -224,12 +224,12 @@ inline void InlineAsm_InitExpr5(IAExpr *expr, SInt32 value) {
}
// unknown name
-inline int InlineAsm_CheckExpr(IAExpr *expr) {
+CW_INLINE int InlineAsm_CheckExpr(IAExpr *expr) {
return (expr->xC == NULL && expr->object == NULL && expr->label == NULL);
}
// unknown name
-inline SInt32 InlineAsm_GetExprValue(IAExpr *expr) {
+CW_INLINE SInt32 InlineAsm_GetExprValue(IAExpr *expr) {
switch (expr->type) {
case IAExpr_8:
return HIGH_PART(expr->value);
diff --git a/includes/compiler/IroFlowgraph.h b/includes/compiler/IroFlowgraph.h
index 98b6110..90e696c 100644
--- a/includes/compiler/IroFlowgraph.h
+++ b/includes/compiler/IroFlowgraph.h
@@ -62,20 +62,20 @@ extern void IRO_BuildFlowgraph(IROLinear *linear);
extern IRONode *IRO_NewFlowGraphNode(void);
extern IRONode *IRO_MergeFlowGraphNodes(IRONode *a, IRONode *b);
-inline void IROFlowgraph_sub_4C2140(IRONodes *nodes) {
+CW_INLINE void IROFlowgraph_sub_4C2140(IRONodes *nodes) {
nodes->indices = oalloc(sizeof(UInt16) * IRO_NumNodes);
nodes->num = 0;
nodes->base = 0;
}
-inline void IROFlowgraph_sub_4C20E0(IRONodes *nodes) {
+CW_INLINE void IROFlowgraph_sub_4C20E0(IRONodes *nodes) {
}
-inline UInt16 IROFlowgraph_sub_4C2040(IRONodes *nodes) {
+CW_INLINE UInt16 IROFlowgraph_sub_4C2040(IRONodes *nodes) {
return nodes->num;
}
-inline UInt16 IROFlowgraph_sub_4C2100(IRONodes *nodes) {
+CW_INLINE UInt16 IROFlowgraph_sub_4C2100(IRONodes *nodes) {
UInt16 result = -1;
if (nodes->num) {
result = nodes->indices[nodes->base];
@@ -85,7 +85,7 @@ inline UInt16 IROFlowgraph_sub_4C2100(IRONodes *nodes) {
return result;
}
-inline void IROFlowgraph_sub_4C3880(IRONodes *nodes, UInt16 index) {
+CW_INLINE void IROFlowgraph_sub_4C3880(IRONodes *nodes, UInt16 index) {
if (nodes->num < IRO_NumNodes) {
nodes->indices[(nodes->base + nodes->num) % IRO_NumNodes] = index;
nodes->num++;
diff --git a/includes/compiler/IroUtil.h b/includes/compiler/IroUtil.h
index 502d0cd..a757025 100644
--- a/includes/compiler/IroUtil.h
+++ b/includes/compiler/IroUtil.h
@@ -106,19 +106,19 @@ extern void IRO_SetupForUserBreakChecking(void);
extern void IRO_CheckForUserBreak(void);
// TODO is this elsewhere?
-inline Boolean IRO_IsUnsignedType(Type *type) {
+CW_INLINE Boolean IRO_IsUnsignedType(Type *type) {
return is_unsigned(type);
}
// 4B4D40
-inline CInt64 IRO_MakeULong(UInt32 i) {
+CW_INLINE CInt64 IRO_MakeULong(UInt32 i) {
CInt64 val;
CInt64_SetULong(&val, i);
return val;
}
// 4BAAA0
-inline CInt64 IRO_MakeLong(SInt32 i) {
+CW_INLINE CInt64 IRO_MakeLong(SInt32 i) {
CInt64 val;
CInt64_SetLong(&val, i);
return val;
diff --git a/includes/compiler/objects.h b/includes/compiler/objects.h
index 2209dee..5f56877 100644
--- a/includes/compiler/objects.h
+++ b/includes/compiler/objects.h
@@ -235,7 +235,7 @@ enum {
// placing these here until further notice
// unknown name, mwcppc.exe 7.0: 484870
-inline Boolean Inline_IsObjectData(Object *object) {
+CW_INLINE Boolean Inline_IsObjectData(Object *object) {
return object->datatype == DDATA;
}
diff --git a/includes/oslib.h b/includes/oslib.h
index d5be38e..3c8d88c 100644
--- a/includes/oslib.h
+++ b/includes/oslib.h
@@ -10,6 +10,7 @@
*/
#define OPTION_ASSERT(cond) do { if (!!(cond) == 0) { printf("%s:%u: failed assertion\n", __FILE__, __LINE__); abort(); } } while(0)
+#define OS_ASSERT(line, cond) do { if (!!(cond) == 0) { printf("%s:%u: failed assertion\n", __FILE__, line); abort(); } } while(0)
typedef struct uOSTypePair {
int perm;