Mercurial > projects > ldc
comparison dmd/mars.h @ 986:a8cb25d478c4
Use LLVM-style command line (instead of DMD-style)
Note: For a backward compatible interface, use the new bin/ldmd script. It
supports all old options while passing on anything it doesn't recognize.
Some changes caused by this:
* -debug and -version are now -d-debug and -d-version due to a conflict with
standard LLVM options.
* All "flag" options now allow an optional =true/=1/=false/=0 suffix.
* Some "hidden debug switches" starting with "--" were renamed because LLVM
doesn't care about the number of dashes, so they were conflicting with other
options (such as -c).
The new versions start with "-hidden-debug-" instead of "--"
* --help works, but has a non-zero exit code. This breaks some Tango scripts
which use it to test for compiler existence. See tango.patch.
Some changes not (directly) caused by this;
* (-enable/-disable)-FOO options are now available for pre- and postconditions.
* -march is used instead of -m (like other LLVM programs), but -m is an alias
for it.
* -defaultlib, -debuglib, -d-debug and -d-version allow comma-separated values.
The effect should be identical to specifying the same option multiple times.
I decided against allowing these for some other options because paths might
contain commas on some systems.
* -fPIC is removed in favor of the standard LLVM option -relocation-model=pic
Bug:
* If -run is specified as the last argument in DFLAGS, no error is generated.
(Not very serious IMHO)
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 25 Feb 2009 17:34:51 +0100 |
parents | a4fcc13da3cd |
children | 2667e3a145be |
comparison
equal
deleted
inserted
replaced
985:bce024c60adc | 986:a8cb25d478c4 |
---|---|
15 #pragma once | 15 #pragma once |
16 #endif /* __DMC__ */ | 16 #endif /* __DMC__ */ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 #include <stdarg.h> | 19 #include <stdarg.h> |
20 #include <stddef.h> | |
20 #define __STDC_FORMAT_MACROS 1 | 21 #define __STDC_FORMAT_MACROS 1 |
21 #include <inttypes.h> | 22 #include <inttypes.h> |
22 #include <stdarg.h> | 23 #include <stdarg.h> |
23 | 24 |
24 #ifdef __DMC__ | 25 #ifdef __DMC__ |
70 #define TYPEINFO_LINKAGE_TYPE llvm::GlobalValue::LinkOnceLinkage | 71 #define TYPEINFO_LINKAGE_TYPE llvm::GlobalValue::LinkOnceLinkage |
71 | 72 |
72 // Put command line switches in here | 73 // Put command line switches in here |
73 struct Param | 74 struct Param |
74 { | 75 { |
75 char obj; // write object file | 76 bool obj; // write object file |
76 char link; // perform link | 77 bool link; // perform link |
77 char quiet; // suppress non-error messages | 78 bool verbose; // verbose compile |
78 char verbose; // verbose compile | |
79 char symdebug; // insert debug symbolic information | 79 char symdebug; // insert debug symbolic information |
80 char optimize; // run optimizer | 80 bool optimize; // run optimizer |
81 char optimizeLevel; // optimization level | 81 char optimizeLevel; // optimization level |
82 ARCH cpu; // target CPU | 82 ARCH cpu; // target CPU |
83 OS os; // target OS | 83 OS os; // target OS |
84 char is64bit; // generate 64 bit code | 84 bool is64bit; // generate 64 bit code |
85 char isLE; // generate little endian code | 85 bool isLE; // generate little endian code |
86 char scheduler; // which scheduler to use | 86 bool useDeprecated; // allow use of deprecated features |
87 char useDeprecated; // allow use of deprecated features | 87 bool useAssert; // generate runtime code for assert()'s |
88 char useAssert; // generate runtime code for assert()'s | 88 bool useInvariants; // generate class invariant checks |
89 char useInvariants; // generate class invariant checks | 89 bool useIn; // generate precondition checks |
90 char useIn; // generate precondition checks | 90 bool useOut; // generate postcondition checks |
91 char useOut; // generate postcondition checks | 91 bool useArrayBounds; // generate array bounds checks |
92 char useArrayBounds; // generate array bounds checks | 92 bool useSwitchError; // check for switches without a default |
93 char useSwitchError; // check for switches without a default | 93 bool useUnitTests; // generate unittest code |
94 char useUnitTests; // generate unittest code | 94 bool useInline; // inline expand functions |
95 char useInline; // inline expand functions | 95 bool warnings; // enable warnings |
96 char preservePaths; // !=0 means don't strip path from source file | |
97 char warnings; // enable warnings | |
98 char pic; // generate position-independent-code for shared libs | |
99 char noruntime; // code is not allowed to make implicit calls to the runtime | |
100 char novalidate;// no bitcode validation | |
101 char Dversion; // D version number | 96 char Dversion; // D version number |
102 char ignoreUnsupportedPragmas; // rather than error on them | |
103 | 97 |
104 char *argv0; // program name | 98 char *argv0; // program name |
105 Array *imppath; // array of char*'s of where to look for import modules | 99 Array *imppath; // array of char*'s of where to look for import modules |
106 Array *fileImppath; // array of char*'s of where to look for file import modules | 100 Array *fileImppath; // array of char*'s of where to look for file import modules |
107 char *runtimeImppath; // char* of where to look for the core runtime | |
108 char *objdir; // .obj file output directory | 101 char *objdir; // .obj file output directory |
109 char *objname; // .obj file output name | 102 char *objname; // .obj file output name |
110 | 103 |
111 char doDocComments; // process embedded documentation comments | 104 bool doDocComments; // process embedded documentation comments |
112 char *docdir; // write documentation file to docdir directory | 105 char *docdir; // write documentation file to docdir directory |
113 char *docname; // write documentation file to docname | 106 char *docname; // write documentation file to docname |
114 Array *ddocfiles; // macro include files for Ddoc | 107 Array *ddocfiles; // macro include files for Ddoc |
115 | 108 |
116 char doHdrGeneration; // process embedded documentation comments | 109 bool doHdrGeneration; // process embedded documentation comments |
117 char *hdrdir; // write 'header' file to docdir directory | 110 char *hdrdir; // write 'header' file to docdir directory |
118 char *hdrname; // write 'header' file to docname | 111 char *hdrname; // write 'header' file to docname |
119 | 112 |
120 unsigned debuglevel; // debug level | 113 unsigned debuglevel; // debug level |
121 Array *debugids; // debug identifiers | 114 Array *debugids; // debug identifiers |
129 Array *debuglibnames; // default libraries for debug builds | 122 Array *debuglibnames; // default libraries for debug builds |
130 | 123 |
131 char *xmlname; // filename for XML output | 124 char *xmlname; // filename for XML output |
132 | 125 |
133 // Hidden debug switches | 126 // Hidden debug switches |
134 char debuga; | 127 bool debuga; |
135 char debugb; | 128 bool debugb; |
136 char debugc; | 129 bool debugc; |
137 char debugf; | 130 bool debugf; |
138 char debugr; | 131 bool debugr; |
139 char debugw; | 132 bool debugw; |
140 char debugx; | 133 bool debugx; |
141 char debugy; | 134 bool debugy; |
142 | 135 |
143 char run; // run resulting executable | 136 bool run; // run resulting executable |
144 size_t runargs_length; | |
145 char** runargs; // arguments for executable | |
146 | 137 |
147 // Linker stuff | 138 // Linker stuff |
148 Array *objfiles; | 139 Array *objfiles; |
149 Array *linkswitches; | 140 Array *linkswitches; |
150 Array *libfiles; | 141 Array *libfiles; |
151 char *deffile; | 142 char *deffile; |
152 char *resfile; | 143 char *resfile; |
153 char *exefile; | 144 char *exefile; |
154 | 145 |
155 // LDC stuff | 146 // LDC stuff |
156 char *llvmArch; | 147 const char *llvmArch; |
157 char forceBE; | 148 OUTPUTFLAG output_ll; |
158 char output_ll; | 149 OUTPUTFLAG output_bc; |
159 char output_bc; | 150 OUTPUTFLAG output_s; |
160 char output_s; | 151 OUTPUTFLAG output_o; |
161 char output_o; | 152 bool llvmInline; |
162 char llvmInline; | 153 bool llvmAnnotate; |
163 char llvmAnnotate; | 154 bool useInlineAsm; |
164 char useInlineAsm; | |
165 char fqnNames; // use fully qualified object names | |
166 char noDefaultLib; | |
167 | 155 |
168 // target stuff | 156 // target stuff |
169 char *targetTriple; | 157 char *targetTriple; |
170 char *dataLayout; | 158 char *dataLayout; |
171 }; | 159 }; |