tccpp: Add the define __STDC_HOSTED__ [C99]

Usually defined to 1, but when using "-nostdlib", the value is 0
(required for C99)

--
Regards ... Detlef
This commit is contained in:
Detlef Riekenberg
2025-11-01 18:11:49 +01:00
parent f4e01bfcab
commit cdebce3079

View File

@@ -3737,6 +3737,7 @@ static void tcc_predefs(TCCState *s1, CString *cs, int is_asm)
cstr_printf(cs, "#define __SIZEOF_LONG__ %d\n", LONG_SIZE); cstr_printf(cs, "#define __SIZEOF_LONG__ %d\n", LONG_SIZE);
if (!is_asm) { if (!is_asm) {
putdef(cs, "__STDC__"); putdef(cs, "__STDC__");
cstr_printf(cs, "#define __STDC_HOSTED__ %d\n", s1->nostdlib ? 0 : 1);
cstr_printf(cs, "#define __STDC_VERSION__ %dL\n", s1->cversion); cstr_printf(cs, "#define __STDC_VERSION__ %dL\n", s1->cversion);
cstr_cat(cs, cstr_cat(cs,
/* load more predefs and __builtins */ /* load more predefs and __builtins */