History

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.

Joe Soroka committed 15 years ago

Commit 2b7a8eb1 parent 46e2dd71 file · +4 −0Browse files

Unified · Split

tccgen.c+4−0
@@ -4863,6 +4863,7 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 4862 unmodified lines
4863 CType *t1;4863 CType *t1;
4864 4864
4865 if (type->t & VT_VLA) {4865 if (type->t & VT_VLA) {
4866#if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
4866 int a;4867 int a;
4867 CValue retcval;4868 CValue retcval;
4868 4869
@@ -4877,6 +4878,9 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c, · 8 unmodified lines
4877 vswap();4878 vswap();
4878 vstore();4879 vstore();
4879 vpop();4880 vpop();
4881#else
4882 error("variable length arrays unsupported for this target");
4883#endif
4880 } else if (type->t & VT_ARRAY) {4884 } else if (type->t & VT_ARRAY) {
4881 s = type->ref;4885 s = type->ref;
4882 n = s->c;4886 n = s->c;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t