summaryrefslogtreecommitdiff
path: root/src/codegen/codegen_decl.c
diff options
context:
space:
mode:
authorZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-29 03:03:56 +0000
committerZuhaitz Méndez Fernández de Aránguiz <zuhaitz@debian>2026-01-29 03:03:56 +0000
commitda9e8758e9d89dc7362be67f8e7573309efe170c (patch)
tree02250ce42b825c35453c7fde576120eef9d3537d /src/codegen/codegen_decl.c
parent4049809f230e5e27adaf19aa57e7e9b69da5a4f0 (diff)
Centralize TCC compat
Diffstat (limited to 'src/codegen/codegen_decl.c')
-rw-r--r--src/codegen/codegen_decl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codegen/codegen_decl.c b/src/codegen/codegen_decl.c
index 5fb9f54..11cdece 100644
--- a/src/codegen/codegen_decl.c
+++ b/src/codegen/codegen_decl.c
@@ -3,6 +3,7 @@
#include "../parser/parser.h"
#include "../zprep.h"
#include "codegen.h"
+#include "compat.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -12,7 +13,7 @@ static void emit_freestanding_preamble(FILE *out)
fputs("#include <stddef.h>\n#include <stdint.h>\n#include "
"<stdbool.h>\n#include <stdarg.h>\n",
out);
- fputs("#ifdef __TINYC__\n#define __auto_type __typeof__\n#endif\n", out);
+ fputs(ZC_TCC_COMPAT_STR, out);
fputs("typedef size_t usize;\ntypedef char* string;\n", out);
fputs("#define U0 void\n#define I8 int8_t\n#define U8 uint8_t\n#define I16 "
"int16_t\n#define U16 uint16_t\n",
@@ -86,7 +87,7 @@ void emit_preamble(ParserContext *ctx, FILE *out)
// C mode
fputs("#define ZC_AUTO __auto_type\n", out);
fputs("#define ZC_CAST(T, x) ((T)(x))\n", out);
- fputs("#ifdef __TINYC__\n#define __auto_type __typeof__\n#endif\n", out);
+ fputs(ZC_TCC_COMPAT_STR, out);
fputs("static inline const char* _z_bool_str(_Bool b) { return b ? \"true\" : "
"\"false\"; }\n",
out);