Add fake _Float16 type to enable the latest math.h on macOS
Some checks are pending
build and test / test-x86_64-linux (push) Waiting to run
build and test / test-x86_64-osx (push) Waiting to run
build and test / test-aarch64-osx (push) Waiting to run
build and test / test-x86-win32 (push) Waiting to run
build and test / test-armv7-linux (push) Waiting to run
build and test / test-aarch64-linux (push) Waiting to run
build and test / test-riscv64-linux (push) Waiting to run

This commit is contained in:
waterlens 2025-03-19 00:08:57 +08:00
parent 8c4e67380e
commit a06c608625
2 changed files with 9 additions and 0 deletions

View File

@ -4709,8 +4709,16 @@ static int parse_btype(CType *type, AttributeDef *ad, int ignore_label)
case TOK_COMPLEX:
tcc_error("_Complex is not yet supported");
case TOK_FLOAT:
/* macOS SDK uses it in math.h
fake the size and alignment
*/
u = VT_FLOAT;
/* tcc_warning("_Float16 is not yet supported. Skipped.");
I hope no one really uses it in the wild. */
goto basic_type;
case TOK_FLOAT16:
u = VT_SHORT;
case TOK_DOUBLE:
if ((t & (VT_BTYPE|VT_LONG)) == VT_LONG) {
t = (t & ~(VT_BTYPE|VT_LONG)) | VT_LDOUBLE;

View File

@ -67,6 +67,7 @@
DEF(TOK_TYPEOF2, "__typeof")
DEF(TOK_TYPEOF3, "__typeof__")
DEF(TOK_LABEL, "__label__")
DEF(TOK_FLOAT16, "_Float16")
#ifdef TCC_TARGET_ARM64
DEF(TOK_UINT128, "__uint128_t")