zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit cb8d46b1abb7885c794eeec0fc8e4a3b359ee5e8 (tree)
parent 00db079347809ac468b60ba4f4116f385d5ca554
Author: Motiejus Jakštys <motiejus@jakstys.lt>
Date:   Tue, 10 Feb 2026 11:35:41 +0000

fix tcc

Diffstat:
Mast.c | 4++--
Mcommon.h | 12+++++++++++-
Mmain.c | 2++
Mparser.c | 3++-
Mtokenizer.c | 3++-
Mzig0.c | 2++
6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/ast.c b/ast.c @@ -1,10 +1,10 @@ +#include "common.h" + #include <stdbool.h> -#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include "ast.h" -#include "common.h" #include "parser.h" #define N 1024 diff --git a/common.h b/common.h @@ -1,7 +1,17 @@ -// common.h +// common.h — must be included before any system headers. #ifndef _ZIG0_COMMON_H__ #define _ZIG0_COMMON_H__ +// tcc doesn't define __GNUC__, causing glibc to #define __attribute__ to +// nothing. +#if defined(__TINYC__) && !defined(__GNUC__) +#define __GNUC__ 2 +#define __GNUC_MINOR__ 0 +#undef __REDIRECT +#undef __REDIRECT_NTH +#undef __REDIRECT_NTHNL +#endif + #include <stdint.h> #include <stdlib.h> diff --git a/main.c b/main.c @@ -1,3 +1,5 @@ +#include "common.h" + #include <stdbool.h> #include <stdio.h> #include <stdlib.h> diff --git a/parser.c b/parser.c @@ -1,10 +1,11 @@ +#include "common.h" + #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "ast.h" -#include "common.h" #include "parser.h" const AstNodeIndex null_node = 0; diff --git a/tokenizer.c b/tokenizer.c @@ -1,5 +1,6 @@ +#include "common.h" + #include <stdbool.h> -#include <stdint.h> #include <stdio.h> #include <string.h> diff --git a/zig0.c b/zig0.c @@ -1,3 +1,5 @@ +#include "common.h" + #include <stdbool.h> #include <stdio.h> #include <stdlib.h>