Mercurial > projects > ldc
annotate tests/mini/calls1.d @ 1138:4c8bb03e4fbc
Update DtoConstFP() to be correct after LLVM r67562, which changed the way the
APFloat constructor expects its i80 APInts to be formatted. (They're now
actually consistent with the x87 format)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Tue, 24 Mar 2009 15:24:59 +0100 |
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 } |