Mercurial > projects > ddmd
comparison dmd/Macro.d @ 99:903b95002d4e
Id and Macro are quite experimental currently
author | Trass3r |
---|---|
date | Tue, 31 Aug 2010 04:04:33 +0200 |
parents | 10317f0c89a5 |
children | e28b18c23469 |
comparison
equal
deleted
inserted
replaced
98:5c859d5fbe27 | 99:903b95002d4e |
---|---|
1 module dmd.Macro; | 1 module dmd.Macro; |
2 | 2 |
3 struct Macro /// ??? | 3 struct Macro /// ??? |
4 { | 4 { |
5 } | 5 } |
6 | |
7 /** | |
8 It is very important to use version control macros correctly - the | |
9 idea is that host and target are independent. If these are done | |
10 correctly, cross compilers can be built. | |
11 The host compiler and host operating system are also different, | |
12 and are predefined by the host compiler. The ones used in | |
13 dmd are: | |
14 | |
15 Macros defined by the compiler, not the code: | |
16 | |
17 Compiler: | |
18 __DMC__ Digital Mars compiler | |
19 _MSC_VER Microsoft compiler | |
20 __GNUC__ Gnu compiler | |
21 | |
22 Host operating system: | |
23 _WIN32 Microsoft NT, Windows 95, Windows 98, Win32s, | |
24 Windows 2000, Win XP, Vista | |
25 _WIN64 Windows for AMD64 | |
26 linux Linux | |
27 __APPLE__ Mac OSX | |
28 __FreeBSD__ FreeBSD | |
29 __sun&&__SVR4 Solaris, OpenSolaris (yes, both macros are necessary) | |
30 | |
31 For the target systems, there are the target operating system and | |
32 the target object file format: | |
33 | |
34 Target operating system: | |
35 TARGET_WINDOS Covers 32 bit windows and 64 bit windows | |
36 TARGET_LINUX Covers 32 and 64 bit linux | |
37 TARGET_OSX Covers 32 and 64 bit Mac OSX | |
38 TARGET_FREEBSD Covers 32 and 64 bit FreeBSD | |
39 TARGET_SOLARIS Covers 32 and 64 bit Solaris | |
40 TARGET_NET Covers .Net | |
41 | |
42 It is expected that the compiler for each platform will be able | |
43 to generate 32 and 64 bit code from the same compiler binary. | |
44 | |
45 Target object module format: | |
46 OMFOBJ Intel Object Module Format, used on Windows | |
47 ELFOBJ Elf Object Module Format, used on linux, FreeBSD and Solaris | |
48 MACHOBJ Mach-O Object Module Format, used on Mac OSX | |
49 | |
50 There are currently no macros for byte endianness order. | |
51 */ | |
52 //version definitions from mars.h | |
53 | |
54 version(IN_GCC) // Changes for the GDC compiler by David Friedman | |
55 { | |
56 static assert(false, "GDC not supported"); | |
57 } | |
58 | |
59 // default to DMDV2 | |
60 version(DMDV1) {} else | |
61 version = DMDV2; // Version 2.0 features | |
62 version = BREAKABI; // 0 if not ready to break the ABI just yet | |
63 version(DMDV2) | |
64 { | |
65 version = STRUCTTHISREF; // if 'this' for struct is a reference, not a pointer | |
66 version = SNAN_DEFAULT_INIT;// if floats are default initialized to signalling NaN | |
67 version = SARRAYVALUE; // static arrays are value types | |
68 } | |
69 | |
70 // Set if C++ mangling is done by the front end | |
71 version(DMDV2) | |
72 { | |
73 version(POSIX) // TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS | |
74 version = CPP_MANGLE; | |
75 } | |
76 | |
77 /* Other targets are TARGET_LINUX, TARGET_OSX, TARGET_FREEBSD and | |
78 * TARGET_SOLARIS, which are | |
79 * set on the command line via the compiler makefile. | |
80 */ | |
81 | |
82 version(_WIN32) | |
83 { | |
84 version = TARGET_WINDOS; // Windows dmd generates Windows targets | |
85 version = OMFOBJ; | |
86 } | |
87 | |
88 version(TARGET_LINUX) | |
89 version = ELFOBJ; | |
90 version(TARGET_FREEBSD) | |
91 version = ELFOBJ; | |
92 version(TARGET_SOLARIS) | |
93 version = ELFOBJ; | |
94 | |
95 | |
96 version(TARGET_OSX) | |
97 version = MACHOBJ; | |
98 | |
99 /* TODO: | |
100 //Modify OutBuffer::writewchar to write the correct size of wchar | |
101 #if _WIN32 | |
102 #define writewchar writeword | |
103 #else | |
104 //This needs a configuration test... | |
105 #define writewchar write4 | |
106 #endif | |
107 | |
108 #define INTERFACE_OFFSET 0 // if 1, put classinfo as first entry | |
109 //in interface vtbl[]'s | |
110 #define INTERFACE_VIRTUAL 0 // 1 means if an interface appears | |
111 //in the inheritance graph multiple | |
112 //times, only one is used | |
113 */ |