comparison dmd/mars.c @ 38:27b2f40bdb58 trunk

[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back. Fiddled a bit the the testing system. Added a very simple SDL graphics demo.
author lindquist
date Wed, 10 Oct 2007 06:16:48 +0200
parents 3cfcb944304e
children 8b0e809563df
comparison
equal deleted inserted replaced
37:77cdca8c210f 38:27b2f40bdb58
37 #include "mtype.h" 37 #include "mtype.h"
38 #include "id.h" 38 #include "id.h"
39 #include "cond.h" 39 #include "cond.h"
40 #include "expression.h" 40 #include "expression.h"
41 #include "lexer.h" 41 #include "lexer.h"
42
43 #include "gen/logger.h"
42 44
43 void getenv_setargv(const char *envvar, int *pargc, char** *pargv); 45 void getenv_setargv(const char *envvar, int *pargc, char** *pargv);
44 46
45 Global global; 47 Global global;
46 48
165 \n\ 167 \n\
166 files.d D source files\n%s\ 168 files.d D source files\n%s\
167 -c do not link\n\ 169 -c do not link\n\
168 -cov do code coverage analysis\n\ 170 -cov do code coverage analysis\n\
169 -D generate documentation\n\ 171 -D generate documentation\n\
170 -Dddocdir write documentation file to docdir directory\n\ 172 -Dd<docdir> write documentation file to <docdir> directory\n\
171 -Dffilename write documentation file to filename\n\ 173 -Df<filename> write documentation file to <filename>\n\
172 -d allow deprecated features\n\ 174 -d allow deprecated features\n\
173 -debug compile in debug code\n\ 175 -debug compile in debug code\n\
174 -debug=level compile in debug code <= level\n\ 176 -debug=level compile in debug code <= level\n\
175 -debug=ident compile in debug code identified by ident\n\ 177 -debug=ident compile in debug code identified by ident\n\
176 -debuglib=name set symbolic debug library to name\n\ 178 -debuglib=name set symbolic debug library to name\n\
177 -defaultlib=name set default library to name\n\ 179 -defaultlib=name set default library to name\n\
178 -g add symbolic debug info\n\ 180 -g add symbolic debug info\n\
179 -gc add symbolic debug info, pretend to be C\n\ 181 -gc add symbolic debug info, pretend to be C\n\
180 -H generate 'header' file\n\ 182 -H generate 'header' file\n\
181 -Hdhdrdir write 'header' file to hdrdir directory\n\ 183 -Hd<hdrdir> write 'header' file to <hdrdir> directory\n\
182 -Hffilename write 'header' file to filename\n\ 184 -Hf<filename> write 'header' file to <filename>\n\
183 --help print help\n\ 185 --help print help\n\
184 -Ipath where to look for imports\n\ 186 -I<path> where to look for imports\n\
185 -Epath where to look for the core runtime\n\ 187 -E<path> where to look for the core runtime\n\
186 -Jpath where to look for string imports\n\ 188 -J<path> where to look for string imports\n\
187 -inline do function inlining\n\ 189 -inline do function inlining\n\
188 -Llinkerflag pass linkerflag to link\n\ 190 -Llinkerflag pass linkerflag to link\n\
189 -march emit code specific to arch\n\ 191 -m<arch> emit code specific to <arch>\n\
190 x86 x86-64 ppc32 ppc64\n\ 192 x86 x86-64 ppc32 ppc64\n\
191 -nofloat do not emit reference to floating point\n\ 193 -nofloat do not emit reference to floating point\n\
192 -noruntime do not allow code that generates implicit runtime calls\n\ 194 -noruntime do not allow code that generates implicit runtime calls\n\
193 -novalidate do not run the validation pass before writing bitcode\n\ 195 -novalidate do not run the validation pass before writing bitcode\n\
194 -O optimize, same as -O2\n\ 196 -O optimize, same as -O2\n\
195 -On optimize at level n (0-5)\n\ 197 -O<n> optimize at level <n> (0-5)\n\
196 -o- do not write object file\n\ 198 -o- do not write object file\n\
197 -odobjdir write object files to directory objdir\n\ 199 -od<objdir> write object files to directory <objdir>\n\
198 -offilename name output file to filename\n\ 200 -of<filename> name output file to <filename>\n\
199 -op do not strip paths from source file\n\ 201 -op do not strip paths from source file\n\
200 -profile profile runtime performance of generated code\n\ 202 -profile profile runtime performance of generated code\n\
201 -quiet suppress unnecessary messages\n\ 203 -quiet suppress unnecessary messages\n\
202 -release compile release version\n\ 204 -release compile release version\n\
203 -run srcfile args... run resulting program, passing args\n\ 205 -run srcfile args... run resulting program, passing args\n\
204 -unittest compile in unit tests\n\ 206 -unittest compile in unit tests\n\
205 -v verbose\n\ 207 -v verbose\n\
208 -vv very verbose (does not include -v)\n\
206 -v1 D language version 1\n\ 209 -v1 D language version 1\n\
207 -version=level compile in version code >= level\n\ 210 -version=level compile in version code >= level\n\
208 -version=ident compile in version code identified by ident\n\ 211 -version=ident compile in version code identified by ident\n\
209 -w enable warnings\n\ 212 -w enable warnings\n\
210 ", 213 ",
225 int status = EXIT_SUCCESS; 228 int status = EXIT_SUCCESS;
226 int argcstart = argc; 229 int argcstart = argc;
227 char* tt_arch = 0; 230 char* tt_arch = 0;
228 char* tt_os = 0; 231 char* tt_os = 0;
229 char* data_layout = 0; 232 char* data_layout = 0;
233 bool very_verbose = false;
230 234
231 // Check for malformed input 235 // Check for malformed input
232 if (argc < 1 || !argv) 236 if (argc < 1 || !argv)
233 { 237 {
234 Largs: 238 Largs:
350 } 354 }
351 else if (strcmp(p + 1, "profile") == 0) 355 else if (strcmp(p + 1, "profile") == 0)
352 global.params.trace = 1; 356 global.params.trace = 1;
353 else if (strcmp(p + 1, "v") == 0) 357 else if (strcmp(p + 1, "v") == 0)
354 global.params.verbose = 1; 358 global.params.verbose = 1;
359 else if (strcmp(p + 1, "vv") == 0) {
360 Logger::enable();
361 very_verbose = true;
362 }
355 else if (strcmp(p + 1, "v1") == 0) 363 else if (strcmp(p + 1, "v1") == 0)
356 global.params.Dversion = 1; 364 global.params.Dversion = 1;
357 else if (strcmp(p + 1, "w") == 0) 365 else if (strcmp(p + 1, "w") == 0)
358 global.params.warnings = 1; 366 global.params.warnings = 1;
359 else if (p[1] == 'O') 367 else if (p[1] == 'O')
652 error("Failed to find a default target machine: %s", err_str.c_str()); 660 error("Failed to find a default target machine: %s", err_str.c_str());
653 fatal(); 661 fatal();
654 } 662 }
655 else { 663 else {
656 global.params.llvmArch = const_cast<char*>(e->Name); 664 global.params.llvmArch = const_cast<char*>(e->Name);
665 if (global.params.verbose || very_verbose)
657 printf("Default target found: %s\n", global.params.llvmArch); 666 printf("Default target found: %s\n", global.params.llvmArch);
658 } 667 }
659 } 668 }
660 669
661 if (strcmp(global.params.llvmArch,"x86")==0) { 670 if (strcmp(global.params.llvmArch,"x86")==0) {