Mercurial > projects > ldc
annotate tests/mini/calls1.d @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 1bb99290e03a |
children |
rev | line source |
---|---|
131 | 1 module calls1; |
270
d9d5d59873d8
[svn r291] Fixed a bunch of the old Phobos tests to work with Tango.
lindquist
parents:
131
diff
changeset
|
2 import tango.core.Vararg; |
291
068cb3c60afb
[svn r312] Changed assert codegen to insert an unreachable terminator after the call to the assert function, which currently calls abort().
lindquist
parents:
270
diff
changeset
|
3 extern(C) int printf(char*, ...); |
131 | 4 void main() |
5 { | |
6 {int a = byVal1(3);} | |
7 {int a = void; byRef1(a);} | |
8 {char[] c = void; refType(c);} | |
9 {char[] c = void; refTypeByRef(c);} | |
10 {S s = void; structByVal(s);} | |
11 {S s = void; structByRef(s);} | |
12 {S s = void; structByPtr(&s);} | |
13 {printf("c-varargs %d %d %d\n", 1,2,3);} | |
14 {int i=3; float f=24.7; dvararg(i,f);} | |
15 {char[] s = "hello"; dvarargRefTy(s);} | |
16 {char[] ss = "hello world!"; dvarargRefTy(ss);} | |
17 } | |
18 | |
19 int byVal1(int a) | |
20 { | |
21 return a; | |
22 } | |
23 | |
24 void byRef1(ref int a) | |
25 { | |
26 a = 3; | |
27 } | |
28 | |
29 void refType(char[] s) | |
30 { | |
31 } | |
32 | |
33 void refTypeByRef(ref char[] s) | |
34 { | |
35 } | |
36 | |
37 struct S | |
38 { | |
39 float f; | |
40 double d; | |
41 long l; | |
42 byte b; | |
43 } | |
44 | |
45 void structByVal(S s) | |
46 { | |
47 } | |
48 | |
49 void structByRef(ref S s) | |
50 { | |
51 } | |
52 | |
53 void structByPtr(S* s) | |
54 { | |
55 } | |
56 | |
57 void dvararg(...) | |
58 { | |
59 printf("%d %.1f\n", va_arg!(int)(_argptr), va_arg!(float)(_argptr)); | |
60 } | |
61 | |
62 void dvarargRefTy(...) | |
63 { | |
64 char[] s = va_arg!(char[])(_argptr); | |
65 printf("%.*s\n", s.length, s.ptr); | |
66 } |