Skip to content

Commit a06c608

Browse files
committed
Add fake _Float16 type to enable the latest math.h on macOS
1 parent 8c4e673 commit a06c608

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

tccgen.c

+8
Original file line numberDiff line numberDiff line change
@@ -4709,8 +4709,16 @@ static int parse_btype(CType *type, AttributeDef *ad, int ignore_label)
47094709
case TOK_COMPLEX:
47104710
tcc_error("_Complex is not yet supported");
47114711
case TOK_FLOAT:
4712+
/* macOS SDK uses it in math.h
4713+
fake the size and alignment
4714+
*/
47124715
u = VT_FLOAT;
4716+
/* tcc_warning("_Float16 is not yet supported. Skipped.");
4717+
I hope no one really uses it in the wild. */
47134718
goto basic_type;
4719+
case TOK_FLOAT16:
4720+
u = VT_SHORT;
4721+
47144722
case TOK_DOUBLE:
47154723
if ((t & (VT_BTYPE|VT_LONG)) == VT_LONG) {
47164724
t = (t & ~(VT_BTYPE|VT_LONG)) | VT_LDOUBLE;

tcctok.h

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
DEF(TOK_TYPEOF2, "__typeof")
6868
DEF(TOK_TYPEOF3, "__typeof__")
6969
DEF(TOK_LABEL, "__label__")
70+
DEF(TOK_FLOAT16, "_Float16")
7071

7172
#ifdef TCC_TARGET_ARM64
7273
DEF(TOK_UINT128, "__uint128_t")

0 commit comments

Comments
 (0)