From e7046a02ff392d793647fccd76245ce1bc00c4cc Mon Sep 17 00:00:00 2001 From: bbbradsmith Date: Tue, 2 May 2023 19:00:34 -0400 Subject: [PATCH] Disallow pass/return of 3-byte struct (#2022), document capability added in #1102. --- doc/cc65.sgml | 5 ++--- src/cc65/datatype.c | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/cc65.sgml b/doc/cc65.sgml index 683249bda..2e99f3201 100644 --- a/doc/cc65.sgml +++ b/doc/cc65.sgml @@ -806,9 +806,8 @@ and the one defined by the ISO standard: The datatypes "float" and "double" are not available.

- C Functions may not return structs (or unions), and structs may not - be passed as parameters by value. However, struct assignment *is* - possible. + C Functions may return structs (or unions) by value, but only of + 1, 2 or 4 byte sizes.

Most of the C library is available with only the fastcall calling convention (). It means diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index 6907ee099..caa41a7a4 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -803,7 +803,6 @@ const Type* GetStructReplacementType (const Type* SType) switch (SizeOf (SType)) { case 1: NewType = type_uchar; break; case 2: NewType = type_uint; break; - case 3: /* FALLTHROUGH */ case 4: NewType = type_ulong; break; default: NewType = SType; break; }