diff --git a/src/cc65/assignment.c b/src/cc65/assignment.c index c67ac1ce5..207e01588 100644 --- a/src/cc65/assignment.c +++ b/src/cc65/assignment.c @@ -127,7 +127,13 @@ void Assignment (ExprDesc* Expr) /* We must have an lvalue for an assignment */ if (ED_IsRVal (Expr)) { - Error ("Invalid lvalue in assignment"); + if (IsTypeArray (Expr->Type)) { + Error ("Array type '%s' is not assignable", GetFullTypeName (Expr->Type)); + } else if (IsTypeFunc (Expr->Type)) { + Error ("Function type '%s' is not assignable", GetFullTypeName (Expr->Type)); + } else { + Error ("Assignment to rvalue"); + } } /* Check for assignment to const */ diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index 005e6109b..aaee7260f 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -903,7 +903,7 @@ unsigned CheckedSizeOf (const Type* T) { unsigned Size = SizeOf (T); if (Size == 0) { - Error ("Size of data type is unknown"); + Error ("Size of type '%s' is unknown", GetFullTypeName (T)); Size = SIZEOF_CHAR; /* Don't return zero */ } return Size; @@ -919,7 +919,7 @@ unsigned CheckedPSizeOf (const Type* T) { unsigned Size = PSizeOf (T); if (Size == 0) { - Error ("Size of data type is unknown"); + Error ("Size of type '%s' is unknown", GetFullTypeName (T)); Size = SIZEOF_CHAR; /* Don't return zero */ } return Size; diff --git a/src/cc65/expr.c b/src/cc65/expr.c index a99f17b55..8cd332173 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -1218,7 +1218,7 @@ static void StructRef (ExprDesc* Expr) NextToken (); const SymEntry Field = FindStructField (Expr->Type, Ident); if (Field.Type == 0) { - Error ("No field named '%s' found in %s", Ident, GetBasicTypeName (Expr->Type)); + Error ("No field named '%s' found in '%s'", Ident, GetFullTypeName (Expr->Type)); /* Make the expression an integer at address zero */ ED_MakeConstAbs (Expr, 0, type_int); return; @@ -1296,7 +1296,7 @@ static void StructRef (ExprDesc* Expr) Flags = CF_LONG | CF_UNSIGNED | CF_CONST; break; default: - Internal ("Invalid %s size: %u", GetBasicTypeName (Expr->Type), StructSize); + Internal ("Invalid '%s' size: %u", GetFullTypeName (Expr->Type), StructSize); break; } diff --git a/src/cc65/function.c b/src/cc65/function.c index e6a974f98..5d0b09380 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -513,7 +513,7 @@ void NewFunc (SymEntry* Func) ** We don't currently support this case. */ if (RType == Param->Type) { - Error ("Passing %s of this size by value is not supported", GetBasicTypeName (Param->Type)); + Error ("Passing '%s' of this size by value is not supported", GetFullTypeName (Param->Type)); } } diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index 27665e619..036cc2d89 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -333,7 +333,7 @@ static void ReturnStatement (void) /* Handle struct/union specially */ ReturnType = GetStructReplacementType (Expr.Type); if (ReturnType == Expr.Type) { - Error ("Returning %s of this size by value is not supported", GetBasicTypeName (Expr.Type)); + Error ("Returning '%s' of this size by value is not supported", GetFullTypeName (Expr.Type)); } LoadExpr (TypeOf (ReturnType), &Expr);