Skip to content

Commit e956c21

Browse files
committed
fixed up some warnings about structures
1 parent 8a67440 commit e956c21

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

backends/asm/outasm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4572,6 +4572,9 @@ CompileExpression(IRList *irl, AST *expr, Operand *dest)
45724572
Module *P;
45734573
const char *name;
45744574
objtype = ExprType(expr->left);
4575+
if (curfunc && IsSpinLang(curfunc->language) && IsRefType(objtype)) {
4576+
objtype = objtype->left;
4577+
}
45754578
name = GetUserIdentifierName(expr->right);
45764579
if (!objtype) {
45774580
ERROR(expr, "%s is not accessible in this context", GetIdentifierName(expr->left));

frontends/lexer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
#define VT '\013'
2525

26-
#define MAX_PNUT_VERSION 43 /* maximum PNut version we understand */
26+
#define MAX_PNUT_VERSION 44 /* maximum PNut version we understand */
2727

2828
int allow_type_names = 1;
2929

frontends/types.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,12 @@ AST *CoerceAssignTypes(AST *line, int kind, AST **astptr, AST *desttype, AST *sr
14551455
if (IsPointerType(desttype) && IsPointerType(srctype)) {
14561456
if (curfunc && IsBasicLang(curfunc->language) && IsRefType(desttype) && IsArrayType(desttype->left) && TypeSize(desttype->left) == 0) {
14571457
/* OK, parameter declared as foo() so can accept any array */
1458+
} else if (curfunc && IsSpinLang(curfunc->language) && IsRefType(desttype) && IsRefType(srctype)
1459+
&& IsArrayType(srctype->left)
1460+
&& CompatibleTypes(BaseType(srctype->left), BaseType(desttype))
1461+
)
1462+
{
1463+
/* no warning for passing arrays to Spin pointers */
14581464
} else {
14591465
WARNING(line, "incompatible pointer types in %s: expected %s but got %s", msg, desttype_name, srctype_name);
14601466
}

0 commit comments

Comments
 (0)