Mercurial > projects > ddmd
comparison dmd/FuncDeclaration.d @ 14:2cc604139636
Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
author | Robert Clipsham <robert@octarineparrot.com> |
---|---|
date | Sun, 04 Apr 2010 02:06:32 +0100 |
parents | 10317f0c89a5 |
children | ddae60498573 |
comparison
equal
deleted
inserted
replaced
11:3356c90e9aac | 14:2cc604139636 |
---|---|
110 import dmd.backend.RTLSYM; | 110 import dmd.backend.RTLSYM; |
111 import dmd.backend.LIST; | 111 import dmd.backend.LIST; |
112 | 112 |
113 import core.stdc.stdio; | 113 import core.stdc.stdio; |
114 import core.stdc.string; | 114 import core.stdc.string; |
115 version (Bug4054) import core.memory; | |
115 | 116 |
116 import std.string; | 117 import std.string; |
117 | 118 |
118 class FuncDeclaration : Declaration | 119 class FuncDeclaration : Declaration |
119 { | 120 { |
2643 char *id; | 2644 char *id; |
2644 char *n; | 2645 char *n; |
2645 type *t; | 2646 type *t; |
2646 | 2647 |
2647 n = sym.Sident; | 2648 n = sym.Sident; |
2649 version (Bug4054) | |
2650 id = cast(char*) GC.malloc(8 + 5 + strlen(n) + 1); | |
2651 else | |
2648 id = cast(char*) alloca(8 + 5 + strlen(n) + 1); | 2652 id = cast(char*) alloca(8 + 5 + strlen(n) + 1); |
2649 sprintf(id, "_thunk%d__%s", offset, n); | 2653 sprintf(id, "_thunk%d__%s", offset, n); |
2650 s = symbol_calloc(id); | 2654 s = symbol_calloc(id); |
2651 slist_add(s); | 2655 slist_add(s); |
2652 s.Stype = csym.Stype; | 2656 s.Stype = csym.Stype; |
2835 pi = (v_arguments !is null); | 2839 pi = (v_arguments !is null); |
2836 if (parameters) | 2840 if (parameters) |
2837 pi += parameters.dim; | 2841 pi += parameters.dim; |
2838 | 2842 |
2839 // Allow extra 2 for sthis and shidden | 2843 // Allow extra 2 for sthis and shidden |
2844 version (Bug4054) | |
2845 params = cast(Symbol**)GC.malloc((pi + 2) * (Symbol*).sizeof); | |
2846 else | |
2840 params = cast(Symbol**)alloca((pi + 2) * (Symbol*).sizeof); | 2847 params = cast(Symbol**)alloca((pi + 2) * (Symbol*).sizeof); |
2841 | 2848 |
2842 // Get the actual number of parameters, pi, and fill in the params[] | 2849 // Get the actual number of parameters, pi, and fill in the params[] |
2843 pi = 0; | 2850 pi = 0; |
2844 if (v_arguments) | 2851 if (v_arguments) |