Mercurial > hg > CbC > CbC_gcc
comparison gcc/d/gdc.texi @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
1 \input texinfo @c -*-texinfo-*- | |
2 @setfilename gdc.info | |
3 @settitle The GNU D Compiler | |
4 | |
5 @c Merge the standard indexes into a single one. | |
6 @syncodeindex fn cp | |
7 @syncodeindex vr cp | |
8 @syncodeindex ky cp | |
9 @syncodeindex pg cp | |
10 @syncodeindex tp cp | |
11 | |
12 @include gcc-common.texi | |
13 | |
14 @c Copyright years for this manual. | |
15 @set copyrights-d 2006-2020 | |
16 | |
17 @copying | |
18 @c man begin COPYRIGHT | |
19 Copyright @copyright{} @value{copyrights-d} Free Software Foundation, Inc. | |
20 | |
21 Permission is granted to copy, distribute and/or modify this document | |
22 under the terms of the GNU Free Documentation License, Version 1.3 or | |
23 any later version published by the Free Software Foundation; with no | |
24 Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. | |
25 A copy of the license is included in the | |
26 @c man end | |
27 section entitled ``GNU Free Documentation License''. | |
28 @ignore | |
29 @c man begin COPYRIGHT | |
30 man page gfdl(7). | |
31 @c man end | |
32 @end ignore | |
33 @end copying | |
34 | |
35 @ifinfo | |
36 @format | |
37 @dircategory Software development | |
38 @direntry | |
39 * gdc: (gdc). A GCC-based compiler for the D language | |
40 @end direntry | |
41 @end format | |
42 | |
43 @insertcopying | |
44 @end ifinfo | |
45 | |
46 @titlepage | |
47 @title The GNU D Compiler | |
48 @versionsubtitle | |
49 @author David Friedman, Iain Buclaw | |
50 | |
51 @page | |
52 @vskip 0pt plus 1filll | |
53 Published by the Free Software Foundation @* | |
54 51 Franklin Street, Fifth Floor@* | |
55 Boston, MA 02110-1301, USA@* | |
56 @sp 1 | |
57 @insertcopying | |
58 @end titlepage | |
59 @contents | |
60 @page | |
61 | |
62 @node Top | |
63 @top Introduction | |
64 | |
65 This manual describes how to use @command{gdc}, the GNU compiler for | |
66 the D programming language. This manual is specifically about | |
67 @command{gdc}. For more information about the D programming | |
68 language in general, including language specifications and standard | |
69 package documentation, see @uref{http://dlang.org/}. | |
70 | |
71 @menu | |
72 * Copying:: The GNU General Public License. | |
73 * GNU Free Documentation License:: | |
74 How you can share and copy this manual. | |
75 * Invoking gdc:: How to run gdc. | |
76 * Index:: Index. | |
77 @end menu | |
78 | |
79 | |
80 @include gpl_v3.texi | |
81 | |
82 @include fdl.texi | |
83 | |
84 | |
85 @node Invoking gdc | |
86 @chapter Invoking gdc | |
87 | |
88 @c man title gdc A GCC-based compiler for the D language | |
89 | |
90 @ignore | |
91 @c man begin SYNOPSIS gdc | |
92 gdc [@option{-c}|@option{-S}] [@option{-g}] [@option{-pg}] | |
93 [@option{-O}@var{level}] [@option{-W}@var{warn}@dots{}] | |
94 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}] | |
95 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}] | |
96 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{} | |
97 | |
98 Only the most useful options are listed here; see below for the | |
99 remainder. | |
100 @c man end | |
101 @c man begin SEEALSO | |
102 gpl(7), gfdl(7), fsf-funding(7), gcc(1) | |
103 and the Info entries for @file{gdc} and @file{gcc}. | |
104 @c man end | |
105 @end ignore | |
106 | |
107 @c man begin DESCRIPTION gdc | |
108 | |
109 The @command{gdc} command is the GNU compiler for the D language and | |
110 supports many of the same options as @command{gcc}. @xref{Option Summary, , | |
111 Option Summary, gcc, Using the GNU Compiler Collection (GCC)}. | |
112 This manual only documents the options specific to @command{gdc}. | |
113 | |
114 @c man end | |
115 | |
116 @menu | |
117 * Input and Output files:: Controlling the kind of output: | |
118 an executable, object files, assembler files, | |
119 * Runtime Options:: Options controlling runtime behavior | |
120 * Directory Options:: Where to find module files | |
121 * Code Generation:: Options controlling the output of gdc | |
122 * Warnings:: Options controlling warnings specific to gdc | |
123 * Linking:: Options influencing the linking step | |
124 * Developer Options:: Options useful for developers of gdc | |
125 @end menu | |
126 | |
127 @c man begin OPTIONS | |
128 | |
129 @node Input and Output files | |
130 @section Input and Output files | |
131 @cindex suffixes for D source | |
132 @cindex D source file suffixes | |
133 | |
134 For any given input file, the file name suffix determines what kind of | |
135 compilation is done. The following kinds of input file names are supported: | |
136 | |
137 @table @gcctabopt | |
138 @item @var{file}.d | |
139 D source files. | |
140 @item @var{file}.dd | |
141 Ddoc source files. | |
142 @item @var{file}.di | |
143 D interface files. | |
144 @end table | |
145 | |
146 You can specify more than one input file on the @command{gdc} command line, | |
147 each being compiled separately in the compilation process. If you specify a | |
148 @code{-o @var{file}} option, all the input files are compiled together, | |
149 producing a single output file, named @var{file}. This is allowed even | |
150 when using @code{-S} or @code{-c}. | |
151 | |
152 @cindex D interface files. | |
153 A D interface file contains only what an import of the module needs, | |
154 rather than the whole implementation of that module. They can be created | |
155 by @command{gdc} from a D source file by using the @code{-H} option. | |
156 When the compiler resolves an import declaration, it searches for matching | |
157 @file{.di} files first, then for @file{.d}. | |
158 | |
159 @cindex Ddoc source files. | |
160 A Ddoc source file contains code in the D macro processor language. It is | |
161 primarily designed for use in producing user documentation from embedded | |
162 comments, with a slight affinity towards HTML generation. If a @file{.d} | |
163 source file starts with the string @code{Ddoc} then it is treated as general | |
164 purpose documentation, not as a D source file. | |
165 | |
166 @node Runtime Options | |
167 @section Runtime Options | |
168 @cindex options, runtime | |
169 | |
170 These options affect the runtime behavior of programs compiled with | |
171 @command{gdc}. | |
172 | |
173 @table @gcctabopt | |
174 | |
175 @item -fall-instantiations | |
176 @cindex @option{-fall-instantiations} | |
177 @cindex @option{-fno-all-instantiations} | |
178 Generate code for all template instantiations. The default template emission | |
179 strategy is to not generate code for declarations that were either | |
180 instantiated speculatively, such as from @code{__traits(compiles, ...)}, or | |
181 that come from an imported module not being compiled. | |
182 | |
183 @item -fno-assert | |
184 @cindex @option{-fassert} | |
185 @cindex @option{-fno-assert} | |
186 Turn off code generation for @code{assert} contracts. | |
187 | |
188 @item -fno-bounds-check | |
189 @cindex @option{-fbounds-check} | |
190 @cindex @option{-fno-bounds-check} | |
191 Turns off array bounds checking for all functions, which can improve | |
192 performance for code that uses arrays extensively. Note that this | |
193 can result in unpredictable behavior if the code in question actually | |
194 does violate array bounds constraints. It is safe to use this option | |
195 if you are sure that your code never throws a @code{RangeError}. | |
196 | |
197 @item -fbounds-check=@var{value} | |
198 @cindex @option{-fbounds-check=} | |
199 An alternative to @option{-fbounds-check} that allows more control | |
200 as to where bounds checking is turned on or off. The following values | |
201 are supported: | |
202 | |
203 @table @samp | |
204 @item on | |
205 Turns on array bounds checking for all functions. | |
206 @item safeonly | |
207 Turns on array bounds checking only for @code{@@safe} functions. | |
208 @item off | |
209 Turns off array bounds checking completely. | |
210 @end table | |
211 | |
212 @item -fno-builtin | |
213 @cindex @option{-fbuiltin} | |
214 @cindex @option{-fno-builtin} | |
215 Don't recognize built-in functions unless they begin with the prefix | |
216 @samp{__builtin_}. By default, the compiler will recognize when a | |
217 function in the @code{core.stdc} package is a built-in function. | |
218 | |
219 @item -fdebug | |
220 @item -fdebug=@var{value} | |
221 @cindex @option{-fdebug} | |
222 @cindex @option{-fno-debug} | |
223 Turn on compilation of conditional @code{debug} code into the program. | |
224 The @option{-fdebug} option itself sets the debug level to @code{1}, | |
225 while @option{-fdebug=} enables @code{debug} code that are identified | |
226 by any of the following values: | |
227 | |
228 @table @samp | |
229 @item level | |
230 Sets the debug level to @var{level}, any @code{debug} code <= @var{level} | |
231 is compiled into the program. | |
232 @item ident | |
233 Turns on compilation of any @code{debug} code identified by @var{ident}. | |
234 @end table | |
235 | |
236 @item -fno-druntime | |
237 @cindex @option{-fdruntime} | |
238 @cindex @option{-fno-druntime} | |
239 Implements @uref{https://dlang.org/spec/betterc.html}. Assumes that | |
240 compilation targets an environment without a D runtime library. | |
241 | |
242 This is equivalent to compiling with the following options: | |
243 | |
244 @example | |
245 gdc -nophoboslib -fno-exceptions -fno-moduleinfo -fno-rtti | |
246 @end example | |
247 | |
248 @item -fno-invariants | |
249 @cindex @option{-finvariants} | |
250 @cindex @option{-fno-invariants} | |
251 Turns off code generation for class @code{invariant} contracts. | |
252 | |
253 @item -fno-moduleinfo | |
254 @cindex @option{-fmoduleinfo} | |
255 @cindex @option{-fno-moduleinfo} | |
256 Turns off generation of the @code{ModuleInfo} and related functions | |
257 that would become unreferenced without it, which may allow linking | |
258 to programs not written in D. Functions that are not be generated | |
259 include module constructors and destructors (@code{static this} and | |
260 @code{static ~this}), @code{unittest} code, and @code{DSO} registry | |
261 functions for dynamically linked code. | |
262 | |
263 @item -fonly=@var{filename} | |
264 @cindex @option{-fonly} | |
265 Tells the compiler to parse and run semantic analysis on all modules | |
266 on the command line, but only generate code for the module specified | |
267 by @var{filename}. | |
268 | |
269 @item -fno-postconditions | |
270 @cindex @option{-fpostconditions} | |
271 @cindex @option{-fno-postconditions} | |
272 Turns off code generation for postcondition @code{out} contracts. | |
273 | |
274 @item -fno-preconditions | |
275 @cindex @option{-fpreconditions} | |
276 @cindex @option{-fno-preconditions} | |
277 Turns off code generation for precondition @code{in} contracts. | |
278 | |
279 @item -frelease | |
280 @cindex @option{-frelease} | |
281 @cindex @option{-fno-release} | |
282 Turns on compiling in release mode, which means not emitting runtime | |
283 checks for contracts and asserts. Array bounds checking is not done | |
284 for @code{@@system} and @code{@@trusted} functions, and assertion | |
285 failures are undefined behavior. | |
286 | |
287 This is equivalent to compiling with the following options: | |
288 | |
289 @example | |
290 gdc -fno-assert -fbounds-check=safe -fno-invariants \ | |
291 -fno-postconditions -fno-preconditions -fno-switch-errors | |
292 @end example | |
293 | |
294 @item -fno-rtti | |
295 @cindex @option{-frtti} | |
296 @cindex @option{-fno-rtti} | |
297 Turns off generation of run-time type information for all user defined types. | |
298 Any code that uses features of the language that require access to this | |
299 information will result in an error. | |
300 | |
301 @item -fno-switch-errors | |
302 @cindex @option{-fswitch-errors} | |
303 @cindex @option{-fno-switch-errors} | |
304 This option controls what code is generated when no case is matched | |
305 in a @code{final switch} statement. The default run time behavior | |
306 is to throw a @code{SwitchError}. Turning off @option{-fswitch-errors} | |
307 means that instead the execution of the program is immediately halted. | |
308 | |
309 @item -funittest | |
310 @cindex @option{-funittest} | |
311 @cindex @option{-fno-unittest} | |
312 Turns on compilation of @code{unittest} code, and turns on the | |
313 @code{version(unittest)} identifier. This implies @option{-fassert}. | |
314 | |
315 @item -fversion=@var{value} | |
316 @cindex @option{-fversion} | |
317 Turns on compilation of conditional @code{version} code into the program | |
318 identified by any of the following values: | |
319 | |
320 @table @samp | |
321 @item level | |
322 Sets the version level to @var{level}, any @code{version} code >= @var{level} | |
323 is compiled into the program. | |
324 @item ident | |
325 Turns on compilation of @code{version} code identified by @var{ident}. | |
326 @end table | |
327 | |
328 @item -fno-weak | |
329 @cindex @option{-fweak} | |
330 @cindex @option{-fno-weak} | |
331 Turns off emission of instantiated declarations that can be defined in multiple | |
332 objects as weak or one-only symbols. The default is to emit all public symbols | |
333 as weak, unless the target lacks support for weak symbols. Disabling this | |
334 option means that common symbols are instead put in COMDAT or become private. | |
335 | |
336 @end table | |
337 | |
338 @node Directory Options | |
339 @section Options for Directory Search | |
340 @cindex directory options | |
341 @cindex options, directory search | |
342 @cindex search path | |
343 | |
344 These options specify directories to search for files, libraries, and | |
345 other parts of the compiler: | |
346 | |
347 @table @gcctabopt | |
348 | |
349 @item -I@var{dir} | |
350 @cindex @option{-I} | |
351 Specify a directory to use when searching for imported modules at | |
352 compile time. Multiple @option{-I} options can be used, and the | |
353 paths are searched in the same order. | |
354 | |
355 @item -J@var{dir} | |
356 @cindex @option{-J} | |
357 Specify a directory to use when searching for files in string imports | |
358 at compile time. This switch is required in order to use | |
359 @code{import(file)} expressions. Multiple @option{-J} options can be | |
360 used, and the paths are searched in the same order. | |
361 | |
362 @item -L@var{dir} | |
363 @cindex @option{-L} | |
364 When linking, specify a library search directory, as with @command{gcc}. | |
365 | |
366 @item -B@var{dir} | |
367 @cindex @option{-B} | |
368 This option specifies where to find the executables, libraries, | |
369 source files, and data files of the compiler itself, as with @command{gcc}. | |
370 | |
371 @item -fmodule-file=@var{module}=@var{spec} | |
372 @cindex @option{-fmodule-file} | |
373 This option manipulates file paths of imported modules, such that if an | |
374 imported module matches all or the leftmost part of @var{module}, the file | |
375 path in @var{spec} is used as the location to search for D sources. | |
376 This is used when the source file path and names are not the same as the | |
377 package and module hierarchy. Consider the following examples: | |
378 | |
379 @example | |
380 gdc test.d -fmodule-file=A.B=foo.d -fmodule-file=C=bar | |
381 @end example | |
382 | |
383 This will tell the compiler to search in all import paths for the source | |
384 file @var{foo.d} when importing @var{A.B}, and the directory @var{bar/} | |
385 when importing @var{C}, as annotated in the following D code: | |
386 | |
387 @example | |
388 module test; | |
389 import A.B; // Matches A.B, searches for foo.d | |
390 import C.D.E; // Matches C, searches for bar/D/E.d | |
391 import A.B.C; // No match, searches for A/B/C.d | |
392 @end example | |
393 | |
394 @item -imultilib @var{dir} | |
395 @cindex @option{-imultilib} | |
396 Use @var{dir} as a subdirectory of the gcc directory containing | |
397 target-specific D sources and interfaces. | |
398 | |
399 @item -iprefix @var{prefix} | |
400 @cindex @option{-iprefix} | |
401 Specify @var{prefix} as the prefix for the gcc directory containing | |
402 target-specific D sources and interfaces. If the @var{prefix} represents | |
403 a directory, you should include the final @code{'/'}. | |
404 | |
405 @item -nostdinc | |
406 @cindex @option{-nostdinc} | |
407 Do not search the standard system directories for D source and interface | |
408 files. Only the directories that have been specified with @option{-I} options | |
409 (and the directory of the current file, if appropriate) are searched. | |
410 | |
411 @end table | |
412 | |
413 @node Code Generation | |
414 @section Code Generation | |
415 @cindex options, code generation | |
416 | |
417 In addition to the many @command{gcc} options controlling code generation, | |
418 @command{gdc} has several options specific to itself. | |
419 | |
420 @table @gcctabopt | |
421 | |
422 @item -H | |
423 @cindex @option{-H} | |
424 Generates D interface files for all modules being compiled. The compiler | |
425 determines the output file based on the name of the input file, removes | |
426 any directory components and suffix, and applies the @file{.di} suffix. | |
427 | |
428 @item -Hd @var{dir} | |
429 @cindex @option{-Hd} | |
430 Same as @option{-H}, but writes interface files to directory @var{dir}. | |
431 This option can be used with @option{-Hf @var{file}} to independently set the | |
432 output file and directory path. | |
433 | |
434 @item -Hf @var{file} | |
435 @cindex @option{-Hf} | |
436 Same as @option{-H} but writes interface files to @var{file}. This option can | |
437 be used with @option{-Hd @var{dir}} to independently set the output file and | |
438 directory path. | |
439 | |
440 @item -M | |
441 @cindex @option{-M} | |
442 Output the module dependencies of all source files being compiled in a | |
443 format suitable for @command{make}. The compiler outputs one | |
444 @command{make} rule containing the object file name for that source file, | |
445 a colon, and the names of all imported files. | |
446 | |
447 @item -MM | |
448 @cindex @option{-MM} | |
449 Like @option{-M} but does not mention imported modules from the D standard | |
450 library package directories. | |
451 | |
452 @item -MF @var{file} | |
453 @cindex @option{-MF} | |
454 When used with @option{-M} or @option{-MM}, specifies a @var{file} to write | |
455 the dependencies to. When used with the driver options @option{-MD} or | |
456 @option{-MMD}, @option{-MF} overrides the default dependency output file. | |
457 | |
458 @item -MG | |
459 @cindex @option{-MG} | |
460 This option is for compatibility with @command{gcc}, and is ignored by the | |
461 compiler. | |
462 | |
463 @item -MP | |
464 @cindex @option{-MP} | |
465 Outputs a phony target for each dependency other than the modules being | |
466 compiled, causing each to depend on nothing. | |
467 | |
468 @item -MT @var{target} | |
469 @cindex @option{-MT} | |
470 Change the @var{target} of the rule emitted by dependency generation | |
471 to be exactly the string you specify. If you want multiple targets, | |
472 you can specify them as a single argument to @option{-MT}, or use | |
473 multiple @option{-MT} options. | |
474 | |
475 @item -MQ @var{target} | |
476 @cindex @option{-MQ} | |
477 Same as @option{-MT}, but it quotes any characters which are special to | |
478 @command{make}. | |
479 | |
480 @item -MD | |
481 @cindex @option{-MD} | |
482 This option is equivalent to @option{-M -MF @var{file}}. The driver | |
483 determines @var{file} by removing any directory components and suffix | |
484 from the input file, and then adding a @file{.deps} suffix. | |
485 | |
486 @item -MMD | |
487 @cindex @option{-MMD} | |
488 Like @option{-MD} but does not mention imported modules from the D standard | |
489 library package directories. | |
490 | |
491 @item -X | |
492 @cindex @option{-X} | |
493 Output information describing the contents of all source files being | |
494 compiled in JSON format to a file. The driver determines @var{file} by | |
495 removing any directory components and suffix from the input file, and then | |
496 adding a @file{.json} suffix. | |
497 | |
498 @item -Xf @var{file} | |
499 @cindex @option{-Xf} | |
500 Same as @option{-X}, but writes all JSON contents to the specified | |
501 @var{file}. | |
502 | |
503 @item -fdoc | |
504 @cindex @option{-fdoc} | |
505 Generates @code{Ddoc} documentation and writes it to a file. The compiler | |
506 determines @var{file} by removing any directory components and suffix | |
507 from the input file, and then adding a @file{.html} suffix. | |
508 | |
509 @item -fdoc-dir=@var{dir} | |
510 @cindex @option{-fdoc-dir} | |
511 Same as @option{-fdoc}, but writes documentation to directory @var{dir}. | |
512 This option can be used with @option{-fdoc-file=@var{file}} to | |
513 independently set the output file and directory path. | |
514 | |
515 @item -fdoc-file=@var{file} | |
516 @cindex @option{-fdoc-file} | |
517 Same as @option{-fdoc}, but writes documentation to @var{file}. This | |
518 option can be used with @option{-fdoc-dir=@var{dir}} to independently | |
519 set the output file and directory path. | |
520 | |
521 @item -fdoc-inc=@var{file} | |
522 @cindex @option{-fdoc-inc} | |
523 Specify @var{file} as a @var{Ddoc} macro file to be read. Multiple | |
524 @option{-fdoc-inc} options can be used, and files are read and processed | |
525 in the same order. | |
526 | |
527 @end table | |
528 | |
529 @node Warnings | |
530 @section Warnings | |
531 @cindex options to control warnings | |
532 @cindex warning messages | |
533 @cindex messages, warning | |
534 @cindex suppressing warnings | |
535 | |
536 Warnings are diagnostic messages that report constructions that | |
537 are not inherently erroneous but that are risky or suggest there | |
538 is likely to be a bug in the program. Unless @option{-Werror} is | |
539 specified, they do not prevent compilation of the program. | |
540 | |
541 @table @gcctabopt | |
542 | |
543 @item -Wall | |
544 @cindex @option{-Wall} | |
545 @cindex @option{-Wno-all} | |
546 Turns on all warnings messages. Warnings are not a defined part of | |
547 the D language, and all constructs for which this may generate a | |
548 warning message are valid code. | |
549 | |
550 @item -Walloca | |
551 @cindex @option{-Walloca} | |
552 This option warns on all uses of "alloca" in the source. | |
553 | |
554 @item -Walloca-larger-than=@var{n} | |
555 @cindex @option{-Walloca-larger-than} | |
556 @cindex @option{-Wno-alloca-larger-than} | |
557 Warn on unbounded uses of alloca, and on bounded uses of alloca | |
558 whose bound can be larger than @var{n} bytes. | |
559 @option{-Wno-alloca-larger-than} disables | |
560 @option{-Walloca-larger-than} warning and is equivalent to | |
561 @option{-Walloca-larger-than=@var{SIZE_MAX}} or larger. | |
562 | |
563 @item -Wcast-result | |
564 @cindex @option{-Wcast-result} | |
565 @cindex @option{-Wno-cast-result} | |
566 Warn about casts that will produce a null or zero result. Currently | |
567 this is only done for casting between an imaginary and non-imaginary | |
568 data type, or casting between a D and C++ class. | |
569 | |
570 @item -Wno-deprecated | |
571 @cindex @option{-Wdeprecated} | |
572 @cindex @option{-Wno-deprecated} | |
573 Do not warn about usage of deprecated features and symbols with | |
574 @code{deprecated} attributes. | |
575 | |
576 @item -Werror | |
577 @cindex @option{-Werror} | |
578 @cindex @option{-Wno-error} | |
579 Turns all warnings into errors. | |
580 | |
581 @item -Wspeculative | |
582 @cindex @option{-Wspeculative} | |
583 @cindex @option{-Wno-speculative} | |
584 List all error messages from speculative compiles, such as | |
585 @code{__traits(compiles, ...)}. This option does not report | |
586 messages as warnings, and these messages therefore never become | |
587 errors when the @option{-Werror} option is also used. | |
588 | |
589 @item -Wtemplates | |
590 @cindex @option{-Wtemplates} | |
591 @cindex @option{-Wno-templates} | |
592 Warn when a template instantiation is encountered. Some coding | |
593 rules disallow templates, and this may be used to enforce that rule. | |
594 | |
595 @item -Wunknown-pragmas | |
596 @cindex @option{-Wunknown-pragmas} | |
597 @cindex @option{-Wno-unknown-pragmas} | |
598 Warn when a @code{pragma()} is encountered that is not understood by | |
599 @command{gdc}. This differs from @option{-fignore-unknown-pragmas} | |
600 where a pragma that is part of the D language, but not implemented by | |
601 the compiler, won't get reported. | |
602 | |
603 @item -fignore-unknown-pragmas | |
604 @cindex @option{-fignore-unknown-pragmas} | |
605 @cindex @option{-fno-ignore-unknown-pragmas} | |
606 Turns off errors for unsupported pragmas. | |
607 | |
608 @item -fmax-errors=@var{n} | |
609 @cindex @option{-fmax-errors} | |
610 Limits the maximum number of error messages to @var{n}, at which point | |
611 @command{gdc} bails out rather than attempting to continue processing the | |
612 source code. If @var{n} is 0 (the default), there is no limit on the | |
613 number of error messages produced. | |
614 | |
615 @item -fsyntax-only | |
616 @cindex @option{-fsyntax-only} | |
617 @cindex @option{-fno-syntax-only} | |
618 Check the code for syntax errors, but do not actually compile it. This | |
619 can be used in conjunction with @option{-fdoc} or @option{-H} to generate | |
620 files for each module present on the command-line, but no other output | |
621 file. | |
622 | |
623 @item -ftransition=@var{id} | |
624 @cindex @option{-ftransition} | |
625 Report additional information about D language changes identified by | |
626 @var{id}. The following values are supported: | |
627 | |
628 @table @samp | |
629 @item all | |
630 List information on all language changes. | |
631 @item checkimports | |
632 Give deprecation messages about @option{-ftransition=import} anomalies. | |
633 @item complex | |
634 List all usages of complex or imaginary types. | |
635 @item dip1000 | |
636 Implements @uref{http://wiki.dlang.org/DIP1000} (experimental). | |
637 @item dip25 | |
638 Implements @uref{http://wiki.dlang.org/DIP25} (experimental). | |
639 @item field | |
640 List all non-mutable fields which occupy an object instance. | |
641 @item import | |
642 Tells the compiler to revert to using an old lookup behavior for resolving | |
643 unqualified symbol names, where this was done in a single pass, ignoring | |
644 any protection attributes. The default name lookup strategy is to use two | |
645 passes, the first ignoring imported declarations, and the second only | |
646 looking at imports. The protection (@code{private}, @code{package}, | |
647 @code{protected}) of symbols is also enforced to resolve any conflicts | |
648 between private and public symbols. | |
649 @item nogc | |
650 List all hidden GC allocations. | |
651 @item tls | |
652 List all variables going into thread local storage. | |
653 @end table | |
654 | |
655 @end table | |
656 | |
657 @node Linking | |
658 @section Options for Linking | |
659 @cindex options, linking | |
660 @cindex linking, static | |
661 | |
662 These options come into play when the compiler links object files into an | |
663 executable output file. They are meaningless if the compiler is not doing | |
664 a link step. | |
665 | |
666 @table @gcctabopt | |
667 | |
668 @item -defaultlib @var{libname} | |
669 @cindex @option{-defaultlib} | |
670 Specify the library to use instead of libphobos when linking. Options | |
671 specifying the linkage of libphobos, such as @option{-static-libphobos} | |
672 or @option{-shared-libphobos}, are ignored. | |
673 | |
674 @item -debuglib | |
675 @cindex @option{-debuglib} | |
676 Specify the debug library to use instead of libphobos when linking. | |
677 This option has no effect unless the @option{-g} option was also given | |
678 on the command line. Options specifying the linkage of libphobos, such | |
679 as @option{-static-libphobos} or @option{-shared-libphobos}, are ignored. | |
680 | |
681 @item -nophoboslib | |
682 @cindex @option{-nophoboslib} | |
683 Do not use the Phobos or D runtime library when linking. Options specifying | |
684 the linkage of libphobos, such as @option{-static-libphobos} or | |
685 @option{-shared-libphobos}, are ignored. The standard system libraries are | |
686 used normally, unless @option{-nostdlib} or @option{-nodefaultlibs} is used. | |
687 | |
688 @item -shared-libphobos | |
689 @cindex @option{-shared-libphobos} | |
690 On systems that provide @file{libgphobos} and @file{libgdruntime} as a | |
691 shared and a static library, this option forces the use of the shared | |
692 version. If no shared version was built when the compiler was configured, | |
693 this option has no effect. | |
694 | |
695 @item -static-libphobos | |
696 @cindex @option{-static-libphobos} | |
697 On systems that provide @file{libgphobos} and @file{libgdruntime} as a | |
698 shared and a static library, this option forces the use of the static | |
699 version. If no static version was built when the compiler was configured, | |
700 this option has no effect. | |
701 | |
702 @end table | |
703 | |
704 @node Developer Options | |
705 @section Developer Options | |
706 @cindex developer options | |
707 @cindex debug dump options | |
708 @cindex dump options | |
709 | |
710 This section describes command-line options that are primarily of | |
711 interest to developers or language tooling. | |
712 | |
713 @table @gcctabopt | |
714 | |
715 @item -fdump-d-original | |
716 @cindex @option{-fdump-d-original} | |
717 Output the internal front-end AST after the @code{semantic3} stage. | |
718 This option is only useful for debugging the GNU D compiler itself. | |
719 | |
720 @item -v | |
721 @cindex @option{-v} | |
722 Dump information about the compiler language processing stages as the source | |
723 program is being compiled. This includes listing all modules that are | |
724 processed through the @code{parse}, @code{semantic}, @code{semantic2}, and | |
725 @code{semantic3} stages; all @code{import} modules and their file paths; | |
726 and all @code{function} bodies that are being compiled. | |
727 | |
728 @end table | |
729 | |
730 @c man end | |
731 | |
732 @node Index | |
733 @unnumbered Index | |
734 | |
735 @printindex cp | |
736 | |
737 @bye |