Mercurial > projects > ldc
annotate dmd/mars.h @ 1270:dd135ff697fa
Fixed class default initializers and type generation. Bug #260 is fixed.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail com> |
---|---|
date | Mon, 27 Apr 2009 03:40:40 +0200 |
parents | e961851fb8be |
children | 29d3861aa2da |
rev | line source |
---|---|
159 | 1 |
2 // Compiler implementation of the D programming language | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
3 // Copyright (c) 1999-2009 by Digital Mars |
159 | 4 // All Rights Reserved |
5 // written by Walter Bright | |
6 // http://www.digitalmars.com | |
7 // License for redistribution is by either the Artistic License | |
8 // in artistic.txt, or the GNU General Public License in gnu.txt. | |
9 // See the included readme.txt for details. | |
10 | |
11 #ifndef DMD_MARS_H | |
12 #define DMD_MARS_H | |
13 | |
14 #ifdef __DMC__ | |
15 #pragma once | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
16 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
17 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
18 /* |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
19 It is very important to use version control macros correctly - the |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
20 idea is that host and target are independent. If these are done |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
21 correctly, cross compilers can be built. |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
22 The host compiler and host operating system are also different, |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
23 and are predefined by the host compiler. The ones used in |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
24 dmd are: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
25 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
26 Macros defined by the compiler, not the code: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
27 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
28 Compiler: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
29 __DMC__ Digital Mars compiler |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
30 _MSC_VER Microsoft compiler |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
31 __GNUC__ Gnu compiler |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
32 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
33 Host operating system: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
34 _WIN32 Microsoft NT, Windows 95, Windows 98, Win32s, |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
35 Windows 2000, Win XP, Vista |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
36 _WIN64 Windows for AMD64 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
37 linux Linux |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
38 __APPLE__ Mac OSX |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
39 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
40 For the target systems, there are the target operating system and |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
41 the target object file format: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
42 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
43 Target operating system: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
44 TARGET_WINDOS Covers 32 bit windows and 64 bit windows |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
45 TARGET_LINUX Covers 32 and 64 bit linux |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
46 TARGET_OSX Covers 32 and 64 bit Mac OSX |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
47 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
48 It is expected that the compiler for each platform will be able |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
49 to generate 32 and 64 bit code from the same compiler binary. |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
50 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
51 Target object module format: |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
52 OMFOBJ Intel Object Module Format, used on Windows |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
53 ELFOBJ Elf Object Module Format, used on linux |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
54 MACHOBJ Mach-O Object Module Format, used on Mac OSX |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
55 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
56 There are currently no macros for byte endianness order. |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
57 */ |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
58 |
159 | 59 |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
60 #include <stdio.h> |
159 | 61 #include <stdint.h> |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
277
diff
changeset
|
62 #include <stdarg.h> |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
63 #include <stddef.h> |
305
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
277
diff
changeset
|
64 #define __STDC_FORMAT_MACROS 1 |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
277
diff
changeset
|
65 #include <inttypes.h> |
2b72433d5c8c
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
lindquist
parents:
277
diff
changeset
|
66 #include <stdarg.h> |
159 | 67 |
68 #ifdef __DMC__ | |
69 #ifdef DEBUG | |
70 #undef assert | |
71 #define assert(e) (static_cast<void>((e) || (printf("assert %s(%d) %s\n", __FILE__, __LINE__, #e), halt()))) | |
72 #endif | |
73 #endif | |
74 | |
75 #ifdef IN_GCC | |
76 /* Changes for the GDC compiler by David Friedman */ | |
77 #endif | |
78 | |
336 | 79 #define DMDV2 0 // Version 2.0 features |
159 | 80 #define BREAKABI 1 // 0 if not ready to break the ABI just yet |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
81 #define STRUCTTHISREF DMDV2 // if 'this' for struct is a reference, not a pointer |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
82 #define SNAN_DEFAULT_INIT DMDV2 // if floats are default initialized to signalling NaN |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
83 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
84 /* Other targets are TARGET_LINUX and TARGET_OSX, which are |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
85 * set on the command line via the compiler makefile. |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
86 */ |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
87 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
88 #if _WIN32 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
89 #define TARGET_WINDOS 1 // Windows dmd generates Windows targets |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
90 #define OMFOBJ 1 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
91 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
92 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
93 #if TARGET_LINUX |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
94 #ifndef ELFOBJ |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
95 #define ELFOBJ 1 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
96 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
97 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
98 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
99 #if TARGET_OSX |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
100 #ifndef MACHOBJ |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
101 #define MACHOBJ 1 |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
102 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
103 #endif |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
104 |
159 | 105 |
106 struct Array; | |
107 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
651
diff
changeset
|
108 // LDC |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
109 enum ARCH |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
110 { |
566
68d7df3f9b05
Added some sanity checks for target detection.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
550
diff
changeset
|
111 ARCHinvalid, |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
112 ARCHx86, |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
113 ARCHx86_64, |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
114 ARCHppc, |
734
6dcab994ddc3
Fold in mandel's patch for ARM from #106
Christian Kamm <kamm incasoftware de>
parents:
723
diff
changeset
|
115 ARCHppc_64, |
735
eee9efe5b51f
Attempt at getting LLVM to provide a proper target data layout. Should assert now if things are borked.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
734
diff
changeset
|
116 ARCHarm, |
eee9efe5b51f
Attempt at getting LLVM to provide a proper target data layout. Should assert now if things are borked.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
734
diff
changeset
|
117 ARCHthumb |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
118 }; |
708
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
119 enum OUTPUTFLAG |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
120 { |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
121 OUTPUTFLAGno, |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
122 OUTPUTFLAGdefault, // for the .o default |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
123 OUTPUTFLAGset // for -output |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
124 }; |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
125 |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
126 enum OS |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
127 { |
566
68d7df3f9b05
Added some sanity checks for target detection.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
550
diff
changeset
|
128 OSinvalid, |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
129 OSLinux, |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
130 OSWindows, |
637
29dc68c949b0
Applied the FreeBSD patch from Ralith, closes ticket #95 , slightly changed but basically the same. Thanx Ralith :)
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
580
diff
changeset
|
131 OSMacOSX, |
872
aa953cc960b6
Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents:
853
diff
changeset
|
132 OSFreeBSD, |
aa953cc960b6
Apply BlueZeniX's patch for OpenSolaris compatibility. Fixes #158.
Christian Kamm <kamm incasoftware de>
parents:
853
diff
changeset
|
133 OSSolaris, |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
134 }; |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
135 |
159 | 136 // Put command line switches in here |
137 struct Param | |
138 { | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
139 bool obj; // write object file |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
140 bool link; // perform link |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
141 bool verbose; // verbose compile |
159 | 142 char symdebug; // insert debug symbolic information |
1170
e40c65bd8c5d
Allow specific optimization passes to be requested from the command line.
Frits van Bommel <fvbommel wxs.nl>
parents:
1124
diff
changeset
|
143 #if !IN_LLVM |
e40c65bd8c5d
Allow specific optimization passes to be requested from the command line.
Frits van Bommel <fvbommel wxs.nl>
parents:
1124
diff
changeset
|
144 // LDC uses a different mechanism |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
145 bool optimize; // run optimizer |
159 | 146 char optimizeLevel; // optimization level |
1170
e40c65bd8c5d
Allow specific optimization passes to be requested from the command line.
Frits van Bommel <fvbommel wxs.nl>
parents:
1124
diff
changeset
|
147 #endif |
534
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
148 ARCH cpu; // target CPU |
7e2867ed70d9
Get rid of isLinux and isWindows in favor of global.params.os.
Christian Kamm <kamm incasoftware de>
parents:
445
diff
changeset
|
149 OS os; // target OS |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
150 bool is64bit; // generate 64 bit code |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
151 bool isLE; // generate little endian code |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
152 bool useDeprecated; // allow use of deprecated features |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
153 bool useAssert; // generate runtime code for assert()'s |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
154 bool useInvariants; // generate class invariant checks |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
155 bool useIn; // generate precondition checks |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
156 bool useOut; // generate postcondition checks |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
157 bool useArrayBounds; // generate array bounds checks |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
158 bool useSwitchError; // check for switches without a default |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
159 bool useUnitTests; // generate unittest code |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
160 bool useInline; // inline expand functions |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
161 bool warnings; // enable warnings |
159 | 162 char Dversion; // D version number |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
163 char safe; // enforce safe memory model |
159 | 164 |
165 char *argv0; // program name | |
166 Array *imppath; // array of char*'s of where to look for import modules | |
167 Array *fileImppath; // array of char*'s of where to look for file import modules | |
168 char *objdir; // .obj file output directory | |
169 char *objname; // .obj file output name | |
170 | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
171 bool doDocComments; // process embedded documentation comments |
159 | 172 char *docdir; // write documentation file to docdir directory |
173 char *docname; // write documentation file to docname | |
174 Array *ddocfiles; // macro include files for Ddoc | |
175 | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
176 bool doHdrGeneration; // process embedded documentation comments |
159 | 177 char *hdrdir; // write 'header' file to docdir directory |
178 char *hdrname; // write 'header' file to docname | |
179 | |
180 unsigned debuglevel; // debug level | |
181 Array *debugids; // debug identifiers | |
182 | |
183 unsigned versionlevel; // version level | |
184 Array *versionids; // version identifiers | |
185 | |
186 bool dump_source; | |
187 | |
567
aaba4f7c6d8a
Get rid of runtime path. Allow defaultlib and debuglib switches to be given multiple times.
Christian Kamm <kamm incasoftware de>
parents:
550
diff
changeset
|
188 Array *defaultlibnames; // default libraries for non-debug builds |
aaba4f7c6d8a
Get rid of runtime path. Allow defaultlib and debuglib switches to be given multiple times.
Christian Kamm <kamm incasoftware de>
parents:
550
diff
changeset
|
189 Array *debuglibnames; // default libraries for debug builds |
159 | 190 |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
191 const char *xmlname; // filename for XML output |
159 | 192 |
193 // Hidden debug switches | |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
194 bool debuga; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
195 bool debugb; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
196 bool debugc; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
197 bool debugf; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
198 bool debugr; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
199 bool debugw; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
200 bool debugx; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
201 bool debugy; |
159 | 202 |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
203 bool run; // run resulting executable |
159 | 204 |
205 // Linker stuff | |
206 Array *objfiles; | |
207 Array *linkswitches; | |
208 Array *libfiles; | |
209 char *deffile; | |
210 char *resfile; | |
211 char *exefile; | |
212 | |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
651
diff
changeset
|
213 // LDC stuff |
986
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
214 OUTPUTFLAG output_ll; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
215 OUTPUTFLAG output_bc; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
216 OUTPUTFLAG output_s; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
217 OUTPUTFLAG output_o; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
218 bool llvmAnnotate; |
a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Frits van Bommel <fvbommel wxs.nl>
parents:
918
diff
changeset
|
219 bool useInlineAsm; |
699
ed9a9e6dd1cc
Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
694
diff
changeset
|
220 |
ed9a9e6dd1cc
Started changing target triple stuff, part of fixing #97
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
694
diff
changeset
|
221 // target stuff |
988
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
986
diff
changeset
|
222 const char* llvmArch; |
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
986
diff
changeset
|
223 const char *targetTriple; |
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
986
diff
changeset
|
224 const char *dataLayout; |
159 | 225 }; |
226 | |
227 struct Global | |
228 { | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
229 const char *mars_ext; |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
230 const char *sym_ext; |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
231 const char *obj_ext; |
708
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
232 #if _WIN32 |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
233 char *obj_ext_alt; |
fd5665da3a27
Hopefully sensible command switch handling. Changed default ext to .o on Windows.
Christian Kamm <kamm incasoftware de>
parents:
699
diff
changeset
|
234 #endif |
159 | 235 char *ll_ext; |
236 char *bc_ext; | |
675
bfe5229f9d8e
Disable bc output by default. Remove -dis. Add -output-bc, -output-ll, -output-s.
Christian Kamm <kamm incasoftware de>
parents:
663
diff
changeset
|
237 char *s_ext; |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
238 const char *lib_ext; |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
239 const char *doc_ext; // for Ddoc generated files |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
240 const char *ddoc_ext; // for Ddoc macro include files |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
241 const char *hdr_ext; // for D 'header' import files |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
242 const char *copyright; |
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
243 const char *written; |
159 | 244 Array *path; // Array of char*'s which form the import lookup path |
245 Array *filePath; // Array of char*'s which form the file import lookup path | |
246 int structalign; | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
247 const char *version; |
663
6aaa3d3c1183
First part of rename to LDC.
Christian Kamm <kamm incasoftware de>
parents:
651
diff
changeset
|
248 char *ldc_version; |
853
82ad6c0c601c
Add Elrood's patch to output LDC and LLVM source revs.
Christian Kamm <kamm incasoftware de>
parents:
797
diff
changeset
|
249 char *llvm_version; |
159 | 250 |
251 Param params; | |
252 unsigned errors; // number of errors reported so far | |
253 unsigned gag; // !=0 means gag reporting of errors | |
254 | |
255 Global(); | |
256 }; | |
257 | |
258 extern Global global; | |
259 | |
876
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
260 /* Set if Windows Structured Exception Handling C extensions are supported. |
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
261 * Apparently, VC has dropped support for these? |
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
262 */ |
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
263 #define WINDOWS_SEH (_WIN32 && __DMC__) |
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
264 |
27a379f288bf
Merged DMD 1.039
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
872
diff
changeset
|
265 |
159 | 266 #ifdef __DMC__ |
267 typedef _Complex long double complex_t; | |
268 #else | |
269 #ifndef IN_GCC | |
270 #include "complex_t.h" | |
271 #endif | |
272 #ifdef __APPLE__ | |
273 //#include "complex.h"//This causes problems with include the c++ <complex> and not the C "complex.h" | |
274 #endif | |
275 #endif | |
276 | |
1195
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
277 // Be careful not to care about sign when using dinteger_t |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
278 //typedef uint64_t integer_t; |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
279 typedef uint64_t dinteger_t; // use this instead of integer_t to |
e961851fb8be
Merged DMD 1.042.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1170
diff
changeset
|
280 // avoid conflicts with system #include's |
159 | 281 |
282 // Signed and unsigned variants | |
283 typedef int64_t sinteger_t; | |
284 typedef uint64_t uinteger_t; | |
285 | |
286 typedef int8_t d_int8; | |
287 typedef uint8_t d_uns8; | |
288 typedef int16_t d_int16; | |
289 typedef uint16_t d_uns16; | |
290 typedef int32_t d_int32; | |
291 typedef uint32_t d_uns32; | |
292 typedef int64_t d_int64; | |
293 typedef uint64_t d_uns64; | |
294 | |
295 typedef float d_float32; | |
296 typedef double d_float64; | |
297 typedef long double d_float80; | |
298 | |
299 typedef d_uns8 d_char; | |
300 typedef d_uns16 d_wchar; | |
301 typedef d_uns32 d_dchar; | |
302 | |
303 #ifdef IN_GCC | |
304 #include "d-gcc-real.h" | |
305 #else | |
306 typedef long double real_t; | |
307 #endif | |
308 | |
309 // Modify OutBuffer::writewchar to write the correct size of wchar | |
310 #if _WIN32 | |
311 #define writewchar writeword | |
312 #else | |
313 // This needs a configuration test... | |
314 #define writewchar write4 | |
315 #endif | |
316 | |
317 #ifdef IN_GCC | |
318 #include "d-gcc-complex_t.h" | |
319 #endif | |
320 | |
321 struct Module; | |
322 | |
323 //typedef unsigned Loc; // file location | |
324 struct Loc | |
325 { | |
326 char *filename; | |
327 unsigned linnum; | |
328 | |
329 Loc() | |
330 { | |
331 linnum = 0; | |
332 filename = NULL; | |
333 } | |
334 | |
335 Loc(int x) | |
336 { | |
337 linnum = x; | |
338 filename = NULL; | |
339 } | |
340 | |
341 Loc(Module *mod, unsigned linnum); | |
342 | |
343 char *toChars() const; | |
344 }; | |
345 | |
346 #ifndef GCC_SAFE_DMD | |
347 #define TRUE 1 | |
348 #define FALSE 0 | |
349 #endif | |
350 | |
351 #define INTERFACE_OFFSET 0 // if 1, put classinfo as first entry | |
352 // in interface vtbl[]'s | |
353 #define INTERFACE_VIRTUAL 0 // 1 means if an interface appears | |
354 // in the inheritance graph multiple | |
355 // times, only one is used | |
356 | |
357 enum LINK | |
358 { | |
359 LINKdefault, | |
360 LINKd, | |
361 LINKc, | |
362 LINKcpp, | |
363 LINKwindows, | |
364 LINKpascal, | |
723
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
708
diff
changeset
|
365 |
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
708
diff
changeset
|
366 // LDC |
55f6c2e454d7
Implemented correct parameter order according to x86-32 ABI documentation.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
708
diff
changeset
|
367 LINKintrinsic, |
159 | 368 }; |
369 | |
370 enum DYNCAST | |
371 { | |
372 DYNCAST_OBJECT, | |
373 DYNCAST_EXPRESSION, | |
374 DYNCAST_DSYMBOL, | |
375 DYNCAST_TYPE, | |
376 DYNCAST_IDENTIFIER, | |
377 DYNCAST_TUPLE, | |
378 }; | |
379 | |
380 enum MATCH | |
381 { | |
382 MATCHnomatch, // no match | |
383 MATCHconvert, // match with conversions | |
336 | 384 #if DMDV2 |
159 | 385 MATCHconst, // match with conversion to const |
386 #endif | |
387 MATCHexact // exact match | |
388 }; | |
389 | |
1103
b30fe7e1dbb9
- Updated to DMD frontend 1.041.
Tomas Lindquist Olsen <tomas.l.olsen gmail.com>
parents:
1064
diff
changeset
|
390 void warning(Loc loc, const char *format, ...); |
1124
e7f0c2b48047
Fix a bug where ::warning() was called with a va_list argument instead of an
Frits van Bommel <fvbommel wxs.nl>
parents:
1103
diff
changeset
|
391 void vwarning(Loc loc, const char *format, va_list); |
159 | 392 void error(Loc loc, const char *format, ...); |
393 void verror(Loc loc, const char *format, va_list); | |
394 void fatal(); | |
395 void err_nomem(); | |
988
2667e3a145be
- Fixed LLVM style CL args for D2.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
986
diff
changeset
|
396 void inifile(char *argv0, const char *inifile); |
159 | 397 void halt(); |
398 | |
399 /*** Where to send error messages ***/ | |
797
340acf1535d0
Removed KDevelop3 project files, CMake can generate them just fine!
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
735
diff
changeset
|
400 #if IN_GCC || IN_LLVM |
159 | 401 #define stdmsg stderr |
402 #else | |
403 #define stdmsg stdout | |
404 #endif | |
405 | |
406 #endif /* DMD_MARS_H */ |