Mercurial > projects > ldc
comparison runtime/internal/llvmdc/vararg.d @ 663:6aaa3d3c1183
First part of rename to LDC.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Mon, 06 Oct 2008 22:46:55 +0200 |
parents | 44f08170f4ef |
children |
comparison
equal
deleted
inserted
replaced
662:88e23f8c2354 | 663:6aaa3d3c1183 |
---|---|
2 * This module holds the implementation of special vararg templates for D style var args. | 2 * This module holds the implementation of special vararg templates for D style var args. |
3 * | 3 * |
4 * Provides the functions tango.core.Vararg expects to be present! | 4 * Provides the functions tango.core.Vararg expects to be present! |
5 */ | 5 */ |
6 | 6 |
7 module llvmdc.Vararg; | 7 module ldc.Vararg; |
8 | 8 |
9 // Check for the right compiler | 9 // Check for the right compiler |
10 version(LLVMDC) | 10 version(LDC) |
11 { | 11 { |
12 // OK | 12 // OK |
13 } | 13 } |
14 else | 14 else |
15 { | 15 { |
16 static assert(false, "This module is only valid for LLVMDC"); | 16 static assert(false, "This module is only valid for LDC"); |
17 } | 17 } |
18 | 18 |
19 alias void* va_list; | 19 alias void* va_list; |
20 | 20 |
21 void va_start(T) ( out va_list ap, inout T parmn ) | 21 void va_start(T) ( out va_list ap, inout T parmn ) |
24 } | 24 } |
25 | 25 |
26 T va_arg(T)(ref va_list vp) | 26 T va_arg(T)(ref va_list vp) |
27 { | 27 { |
28 T* arg = cast(T*) vp; | 28 T* arg = cast(T*) vp; |
29 // llvmdc always aligns to size_t.sizeof in vararg lists | 29 // ldc always aligns to size_t.sizeof in vararg lists |
30 vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) ); | 30 vp = cast(va_list) ( cast(void*) vp + ( ( T.sizeof + size_t.sizeof - 1 ) & ~( size_t.sizeof - 1 ) ) ); |
31 return *arg; | 31 return *arg; |
32 } | 32 } |
33 | 33 |
34 void va_end( va_list ap ) | 34 void va_end( va_list ap ) |