mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-28 08:10:25 +08:00
use of TOK_alloca breaks cross compiler build
VLA inserts a call to alloca via enum TOK_alloca, but TOK_alloca only exists on I386 and X86_64 targets. This patch just emits an error at compile-time if someone tries to compile some VLA code for a TOK_alloca-less target. The best solution might be to just push the problem to link-time, since the existence-or-not of a alloca implementation can only be determined by linking. It seems like just declaring TOK_alloca unconditionally would achieve that, but for now, this at least gets the cross compilers to build.
This commit is contained in:
parent
46e2dd7c32
commit
2b7a8eb8f5
4
tccgen.c
4
tccgen.c
@ -4863,6 +4863,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
||||
CType *t1;
|
||||
|
||||
if (type->t & VT_VLA) {
|
||||
#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
|
||||
int a;
|
||||
CValue retcval;
|
||||
|
||||
@ -4877,6 +4878,9 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
||||
vswap();
|
||||
vstore();
|
||||
vpop();
|
||||
#else
|
||||
error("variable length arrays unsupported for this target");
|
||||
#endif
|
||||
} else if (type->t & VT_ARRAY) {
|
||||
s = type->ref;
|
||||
n = s->c;
|
||||
|
Loading…
Reference in New Issue
Block a user