]> gcc.gnu.org Git - gcc.git/blame - gcc/d/gdc.texi
Merge branch 'master' into devel/modula-2.
[gcc.git] / gcc / d / gdc.texi
CommitLineData
b4c522fa
IB
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.
4b24d500 15@set copyrights-d 2006-2021
b4c522fa
IB
16
17@copying
18@c man begin COPYRIGHT
19Copyright @copyright{} @value{copyrights-d} Free Software Foundation, Inc.
20
21Permission is granted to copy, distribute and/or modify this document
22under the terms of the GNU Free Documentation License, Version 1.3 or
23any later version published by the Free Software Foundation; with no
24Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
25A copy of the license is included in the
26@c man end
27section entitled ``GNU Free Documentation License''.
28@ignore
29@c man begin COPYRIGHT
30man 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
53Published by the Free Software Foundation @*
5451 Franklin Street, Fifth Floor@*
55Boston, MA 02110-1301, USA@*
56@sp 1
57@insertcopying
58@end titlepage
59@contents
60@page
61
62@node Top
63@top Introduction
64
65This manual describes how to use @command{gdc}, the GNU compiler for
66the D programming language. This manual is specifically about
67@command{gdc}. For more information about the D programming
68language in general, including language specifications and standard
69package 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
92gdc [@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
98Only the most useful options are listed here; see below for the
99remainder.
100@c man end
101@c man begin SEEALSO
102gpl(7), gfdl(7), fsf-funding(7), gcc(1)
103and the Info entries for @file{gdc} and @file{gcc}.
104@c man end
105@end ignore
106
107@c man begin DESCRIPTION gdc
108
109The @command{gdc} command is the GNU compiler for the D language and
110supports many of the same options as @command{gcc}. @xref{Option Summary, ,
111Option Summary, gcc, Using the GNU Compiler Collection (GCC)}.
112This 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
134For any given input file, the file name suffix determines what kind of
135compilation is done. The following kinds of input file names are supported:
136
137@table @gcctabopt
138@item @var{file}.d
139D source files.
140@item @var{file}.dd
141Ddoc source files.
142@item @var{file}.di
143D interface files.
144@end table
145
146You can specify more than one input file on the @command{gdc} command line,
147each being compiled separately in the compilation process. If you specify a
148@code{-o @var{file}} option, all the input files are compiled together,
149producing a single output file, named @var{file}. This is allowed even
150when using @code{-S} or @code{-c}.
151
152@cindex D interface files.
153A D interface file contains only what an import of the module needs,
154rather than the whole implementation of that module. They can be created
155by @command{gdc} from a D source file by using the @code{-H} option.
156When 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.
160A Ddoc source file contains code in the D macro processor language. It is
161primarily designed for use in producing user documentation from embedded
162comments, with a slight affinity towards HTML generation. If a @file{.d}
163source file starts with the string @code{Ddoc} then it is treated as general
164purpose documentation, not as a D source file.
165
166@node Runtime Options
167@section Runtime Options
168@cindex options, runtime
169
170These 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}
178Generate code for all template instantiations. The default template emission
179strategy is to not generate code for declarations that were either
180instantiated speculatively, such as from @code{__traits(compiles, ...)}, or
181that come from an imported module not being compiled.
182
183@item -fno-assert
184@cindex @option{-fassert}
185@cindex @option{-fno-assert}
186Turn off code generation for @code{assert} contracts.
187
188@item -fno-bounds-check
189@cindex @option{-fbounds-check}
190@cindex @option{-fno-bounds-check}
191Turns off array bounds checking for all functions, which can improve
192performance for code that uses arrays extensively. Note that this
193can result in unpredictable behavior if the code in question actually
194does violate array bounds constraints. It is safe to use this option
195if you are sure that your code never throws a @code{RangeError}.
196
197@item -fbounds-check=@var{value}
198@cindex @option{-fbounds-check=}
199An alternative to @option{-fbounds-check} that allows more control
200as to where bounds checking is turned on or off. The following values
201are supported:
202
203@table @samp
204@item on
205Turns on array bounds checking for all functions.
206@item safeonly
207Turns on array bounds checking only for @code{@@safe} functions.
208@item off
209Turns off array bounds checking completely.
210@end table
211
212@item -fno-builtin
213@cindex @option{-fbuiltin}
214@cindex @option{-fno-builtin}
215Don't recognize built-in functions unless they begin with the prefix
216@samp{__builtin_}. By default, the compiler will recognize when a
217function in the @code{core.stdc} package is a built-in function.
218
47fe7be6
IB
219@item -fcheckaction=@var{value}
220@cindex @option{-fcheckaction}
221This option controls what code is generated on an assertion, bounds check, or
222final switch failure. The following values are supported:
223
224@table @samp
225@item context
226Throw an @code{AssertError} with extra context information.
227@item halt
228Halt the program execution.
229@item throw
230Throw an @code{AssertError} (the default).
231@end table
232
b4c522fa
IB
233@item -fdebug
234@item -fdebug=@var{value}
235@cindex @option{-fdebug}
236@cindex @option{-fno-debug}
237Turn on compilation of conditional @code{debug} code into the program.
238The @option{-fdebug} option itself sets the debug level to @code{1},
239while @option{-fdebug=} enables @code{debug} code that are identified
240by any of the following values:
241
242@table @samp
243@item level
244Sets the debug level to @var{level}, any @code{debug} code <= @var{level}
245is compiled into the program.
246@item ident
247Turns on compilation of any @code{debug} code identified by @var{ident}.
248@end table
249
c0aebc60
IB
250@item -fno-druntime
251@cindex @option{-fdruntime}
252@cindex @option{-fno-druntime}
253Implements @uref{https://dlang.org/spec/betterc.html}. Assumes that
254compilation targets an environment without a D runtime library.
255
256This is equivalent to compiling with the following options:
257
258@example
259gdc -nophoboslib -fno-exceptions -fno-moduleinfo -fno-rtti
260@end example
261
47fe7be6
IB
262@item -fextern-std=@var{standard}
263@cindex @option{-fextern-std}
264Sets the C++ name mangling compatibility to the version identified by
265@var{standard}. The following values are supported:
266
267@table @samp
268@item c++98
269@item c++03
270Sets @code{__traits(getTargetInfo "cppStd")} to @code{199711}.
271@item c++11
272Sets @code{__traits(getTargetInfo "cppStd")} to @code{201103}.
273@item c++14
274Sets @code{__traits(getTargetInfo "cppStd")} to @code{201402}.
275@item c++17
276Sets @code{__traits(getTargetInfo "cppStd")} to @code{201703}.
277@item c++20
278Sets @code{__traits(getTargetInfo "cppStd")} to @code{202002}.
279@end table
280
b4c522fa
IB
281@item -fno-invariants
282@cindex @option{-finvariants}
283@cindex @option{-fno-invariants}
284Turns off code generation for class @code{invariant} contracts.
285
0fb57034
IB
286@item -fmain
287@cindex @option{-fmain}
288Generates a default @code{main()} function when compiling. This is useful when
289unittesting a library, as it enables running the unittests in a library without
290having to manually define an entry-point function. This option does nothing
291when @code{main} is already defined in user code.
292
b4c522fa
IB
293@item -fno-moduleinfo
294@cindex @option{-fmoduleinfo}
295@cindex @option{-fno-moduleinfo}
296Turns off generation of the @code{ModuleInfo} and related functions
297that would become unreferenced without it, which may allow linking
298to programs not written in D. Functions that are not be generated
299include module constructors and destructors (@code{static this} and
300@code{static ~this}), @code{unittest} code, and @code{DSO} registry
301functions for dynamically linked code.
302
303@item -fonly=@var{filename}
304@cindex @option{-fonly}
305Tells the compiler to parse and run semantic analysis on all modules
306on the command line, but only generate code for the module specified
307by @var{filename}.
308
309@item -fno-postconditions
310@cindex @option{-fpostconditions}
311@cindex @option{-fno-postconditions}
312Turns off code generation for postcondition @code{out} contracts.
313
314@item -fno-preconditions
315@cindex @option{-fpreconditions}
316@cindex @option{-fno-preconditions}
317Turns off code generation for precondition @code{in} contracts.
318
47fe7be6
IB
319@item -fpreview=@var{id}
320@cindex @option{-fpreview}
321Turns on an upcoming D language change identified by @var{id}. The following
322values are supported:
323
324@table @samp
325@item all
326Turns on all upcoming D language features.
327@item dip1000
328Implements @uref{http://wiki.dlang.org/DIP1000} (Scoped pointers).
329@item dip1008
330Implements @uref{http://wiki.dlang.org/DIP1008} (Allow exceptions in
331@code{@@nogc} code).
332@item dip1021
333Implements @uref{http://wiki.dlang.org/DIP1021} (Mutable function arguments).
334@item dip25
335Implements @uref{http://wiki.dlang.org/DIP25} (Sealed references).
336@item dtorfields
337Turns on generation for destructing fields of partially constructed objects.
338@item fieldwise
339Turns on generation of struct equality to use field-wise comparisons.
340@item fixaliasthis
341Implements new lookup rules that check the current scope for @code{alias this}
342before searching in upper scopes.
343@item in
344Implements @code{in} parameters to mean @code{scope const [ref]} and accepts
345rvalues.
346@item inclusiveincontracts
347Implements @code{in} contracts of overridden methods to be a superset of parent
348contract.
349@item intpromote
350Implements C-style integral promotion for unary @code{+}, @code{-} and @code{~}
351expressions.
352@item nosharedaccess
353Turns off and disallows all access to shared memory objects.
354@item rvaluerefparam
355Implements rvalue arguments to @code{ref} parameters.
356@item shortenedmethods
357Implements use of @code{=>} for methods and top-level functions in addition to
358lambdas.
359@end table
360
b4c522fa
IB
361@item -frelease
362@cindex @option{-frelease}
363@cindex @option{-fno-release}
364Turns on compiling in release mode, which means not emitting runtime
365checks for contracts and asserts. Array bounds checking is not done
366for @code{@@system} and @code{@@trusted} functions, and assertion
367failures are undefined behavior.
368
369This is equivalent to compiling with the following options:
370
371@example
372gdc -fno-assert -fbounds-check=safe -fno-invariants \
373 -fno-postconditions -fno-preconditions -fno-switch-errors
374@end example
375
47fe7be6
IB
376@item -frevert=
377@cindex @option{-frevert}
378Turns off a D language feature identified by @var{id}. The following values
379are supported:
380
381@table @samp
382@item all
383Turns off all revertable D language features.
384@item dip25
385Reverts @uref{http://wiki.dlang.org/DIP25} (Sealed references).
386@item dtorfields
387Turns off generation for destructing fields of partially constructed objects.
388@item markdown
389Turns off Markdown replacements in Ddoc comments.
390@end table
391
c0aebc60
IB
392@item -fno-rtti
393@cindex @option{-frtti}
394@cindex @option{-fno-rtti}
395Turns off generation of run-time type information for all user defined types.
396Any code that uses features of the language that require access to this
397information will result in an error.
398
b4c522fa
IB
399@item -fno-switch-errors
400@cindex @option{-fswitch-errors}
401@cindex @option{-fno-switch-errors}
402This option controls what code is generated when no case is matched
403in a @code{final switch} statement. The default run time behavior
404is to throw a @code{SwitchError}. Turning off @option{-fswitch-errors}
405means that instead the execution of the program is immediately halted.
406
407@item -funittest
408@cindex @option{-funittest}
409@cindex @option{-fno-unittest}
410Turns on compilation of @code{unittest} code, and turns on the
411@code{version(unittest)} identifier. This implies @option{-fassert}.
412
413@item -fversion=@var{value}
414@cindex @option{-fversion}
415Turns on compilation of conditional @code{version} code into the program
416identified by any of the following values:
417
418@table @samp
419@item level
420Sets the version level to @var{level}, any @code{version} code >= @var{level}
421is compiled into the program.
422@item ident
423Turns on compilation of @code{version} code identified by @var{ident}.
424@end table
425
76a7e7e7
IB
426@item -fno-weak-templates
427@cindex @option{-fweak-templates}
428@cindex @option{-fno-weak-templates}
429Turns off emission of declarations that can be defined in multiple objects as
430weak symbols. The default is to emit all public symbols as weak, unless the
431target lacks support for weak symbols. Disabling this option means that common
432symbols are instead put in COMDAT or become private.
b4c522fa
IB
433
434@end table
435
436@node Directory Options
437@section Options for Directory Search
438@cindex directory options
439@cindex options, directory search
440@cindex search path
441
442These options specify directories to search for files, libraries, and
443other parts of the compiler:
444
445@table @gcctabopt
446
447@item -I@var{dir}
448@cindex @option{-I}
449Specify a directory to use when searching for imported modules at
450compile time. Multiple @option{-I} options can be used, and the
451paths are searched in the same order.
452
453@item -J@var{dir}
454@cindex @option{-J}
455Specify a directory to use when searching for files in string imports
456at compile time. This switch is required in order to use
457@code{import(file)} expressions. Multiple @option{-J} options can be
458used, and the paths are searched in the same order.
459
460@item -L@var{dir}
461@cindex @option{-L}
462When linking, specify a library search directory, as with @command{gcc}.
463
464@item -B@var{dir}
465@cindex @option{-B}
466This option specifies where to find the executables, libraries,
467source files, and data files of the compiler itself, as with @command{gcc}.
468
469@item -fmodule-file=@var{module}=@var{spec}
470@cindex @option{-fmodule-file}
471This option manipulates file paths of imported modules, such that if an
472imported module matches all or the leftmost part of @var{module}, the file
473path in @var{spec} is used as the location to search for D sources.
474This is used when the source file path and names are not the same as the
475package and module hierarchy. Consider the following examples:
476
477@example
478gdc test.d -fmodule-file=A.B=foo.d -fmodule-file=C=bar
479@end example
480
481This will tell the compiler to search in all import paths for the source
482file @var{foo.d} when importing @var{A.B}, and the directory @var{bar/}
483when importing @var{C}, as annotated in the following D code:
484
485@example
486module test;
487import A.B; // Matches A.B, searches for foo.d
488import C.D.E; // Matches C, searches for bar/D/E.d
489import A.B.C; // No match, searches for A/B/C.d
490@end example
491
492@item -imultilib @var{dir}
493@cindex @option{-imultilib}
494Use @var{dir} as a subdirectory of the gcc directory containing
495target-specific D sources and interfaces.
496
497@item -iprefix @var{prefix}
498@cindex @option{-iprefix}
499Specify @var{prefix} as the prefix for the gcc directory containing
500target-specific D sources and interfaces. If the @var{prefix} represents
501a directory, you should include the final @code{'/'}.
502
503@item -nostdinc
504@cindex @option{-nostdinc}
505Do not search the standard system directories for D source and interface
506files. Only the directories that have been specified with @option{-I} options
507(and the directory of the current file, if appropriate) are searched.
508
509@end table
510
511@node Code Generation
512@section Code Generation
513@cindex options, code generation
514
515In addition to the many @command{gcc} options controlling code generation,
516@command{gdc} has several options specific to itself.
517
518@table @gcctabopt
519
520@item -H
521@cindex @option{-H}
522Generates D interface files for all modules being compiled. The compiler
523determines the output file based on the name of the input file, removes
524any directory components and suffix, and applies the @file{.di} suffix.
525
526@item -Hd @var{dir}
527@cindex @option{-Hd}
528Same as @option{-H}, but writes interface files to directory @var{dir}.
529This option can be used with @option{-Hf @var{file}} to independently set the
530output file and directory path.
531
532@item -Hf @var{file}
533@cindex @option{-Hf}
534Same as @option{-H} but writes interface files to @var{file}. This option can
535be used with @option{-Hd @var{dir}} to independently set the output file and
536directory path.
537
538@item -M
539@cindex @option{-M}
540Output the module dependencies of all source files being compiled in a
541format suitable for @command{make}. The compiler outputs one
542@command{make} rule containing the object file name for that source file,
543a colon, and the names of all imported files.
544
545@item -MM
546@cindex @option{-MM}
547Like @option{-M} but does not mention imported modules from the D standard
548library package directories.
549
550@item -MF @var{file}
551@cindex @option{-MF}
552When used with @option{-M} or @option{-MM}, specifies a @var{file} to write
553the dependencies to. When used with the driver options @option{-MD} or
554@option{-MMD}, @option{-MF} overrides the default dependency output file.
555
556@item -MG
557@cindex @option{-MG}
558This option is for compatibility with @command{gcc}, and is ignored by the
559compiler.
560
561@item -MP
562@cindex @option{-MP}
563Outputs a phony target for each dependency other than the modules being
564compiled, causing each to depend on nothing.
565
566@item -MT @var{target}
567@cindex @option{-MT}
568Change the @var{target} of the rule emitted by dependency generation
569to be exactly the string you specify. If you want multiple targets,
570you can specify them as a single argument to @option{-MT}, or use
571multiple @option{-MT} options.
572
573@item -MQ @var{target}
574@cindex @option{-MQ}
575Same as @option{-MT}, but it quotes any characters which are special to
576@command{make}.
577
578@item -MD
579@cindex @option{-MD}
580This option is equivalent to @option{-M -MF @var{file}}. The driver
581determines @var{file} by removing any directory components and suffix
582from the input file, and then adding a @file{.deps} suffix.
583
584@item -MMD
585@cindex @option{-MMD}
586Like @option{-MD} but does not mention imported modules from the D standard
587library package directories.
588
589@item -X
590@cindex @option{-X}
591Output information describing the contents of all source files being
592compiled in JSON format to a file. The driver determines @var{file} by
593removing any directory components and suffix from the input file, and then
594adding a @file{.json} suffix.
595
596@item -Xf @var{file}
597@cindex @option{-Xf}
598Same as @option{-X}, but writes all JSON contents to the specified
599@var{file}.
600
601@item -fdoc
602@cindex @option{-fdoc}
603Generates @code{Ddoc} documentation and writes it to a file. The compiler
604determines @var{file} by removing any directory components and suffix
605from the input file, and then adding a @file{.html} suffix.
606
607@item -fdoc-dir=@var{dir}
608@cindex @option{-fdoc-dir}
609Same as @option{-fdoc}, but writes documentation to directory @var{dir}.
610This option can be used with @option{-fdoc-file=@var{file}} to
611independently set the output file and directory path.
612
613@item -fdoc-file=@var{file}
614@cindex @option{-fdoc-file}
615Same as @option{-fdoc}, but writes documentation to @var{file}. This
616option can be used with @option{-fdoc-dir=@var{dir}} to independently
617set the output file and directory path.
618
619@item -fdoc-inc=@var{file}
620@cindex @option{-fdoc-inc}
621Specify @var{file} as a @var{Ddoc} macro file to be read. Multiple
622@option{-fdoc-inc} options can be used, and files are read and processed
623in the same order.
624
47fe7be6
IB
625@item -fdump-c++-spec=@var{file}
626For D source files, generate corresponding C++ declarations in @var{file}.
627
628@item -fdump-c++-spec-verbose
629In conjunction with @option{-fdump-c++-spec=} above, add comments for ignored
630declarations in the generated C++ header.
631
632@item -fsave-mixins=@var{file}
633@cindex @option{-fsave-mixins}
634Generates code expanded from D @code{mixin} statements and writes the
635processed sources to @var{file}. This is useful to debug errors in compilation
636and provides source for debuggers to show when requested.
637
b4c522fa
IB
638@end table
639
640@node Warnings
641@section Warnings
642@cindex options to control warnings
643@cindex warning messages
644@cindex messages, warning
645@cindex suppressing warnings
646
647Warnings are diagnostic messages that report constructions that
648are not inherently erroneous but that are risky or suggest there
649is likely to be a bug in the program. Unless @option{-Werror} is
650specified, they do not prevent compilation of the program.
651
652@table @gcctabopt
653
654@item -Wall
655@cindex @option{-Wall}
656@cindex @option{-Wno-all}
657Turns on all warnings messages. Warnings are not a defined part of
658the D language, and all constructs for which this may generate a
659warning message are valid code.
660
661@item -Walloca
662@cindex @option{-Walloca}
663This option warns on all uses of "alloca" in the source.
664
665@item -Walloca-larger-than=@var{n}
666@cindex @option{-Walloca-larger-than}
667@cindex @option{-Wno-alloca-larger-than}
668Warn on unbounded uses of alloca, and on bounded uses of alloca
669whose bound can be larger than @var{n} bytes.
670@option{-Wno-alloca-larger-than} disables
671@option{-Walloca-larger-than} warning and is equivalent to
672@option{-Walloca-larger-than=@var{SIZE_MAX}} or larger.
673
674@item -Wcast-result
675@cindex @option{-Wcast-result}
676@cindex @option{-Wno-cast-result}
677Warn about casts that will produce a null or zero result. Currently
678this is only done for casting between an imaginary and non-imaginary
679data type, or casting between a D and C++ class.
680
681@item -Wno-deprecated
682@cindex @option{-Wdeprecated}
683@cindex @option{-Wno-deprecated}
684Do not warn about usage of deprecated features and symbols with
685@code{deprecated} attributes.
686
687@item -Werror
688@cindex @option{-Werror}
689@cindex @option{-Wno-error}
690Turns all warnings into errors.
691
692@item -Wspeculative
693@cindex @option{-Wspeculative}
694@cindex @option{-Wno-speculative}
695List all error messages from speculative compiles, such as
696@code{__traits(compiles, ...)}. This option does not report
697messages as warnings, and these messages therefore never become
698errors when the @option{-Werror} option is also used.
699
700@item -Wtemplates
701@cindex @option{-Wtemplates}
702@cindex @option{-Wno-templates}
703Warn when a template instantiation is encountered. Some coding
704rules disallow templates, and this may be used to enforce that rule.
705
706@item -Wunknown-pragmas
707@cindex @option{-Wunknown-pragmas}
708@cindex @option{-Wno-unknown-pragmas}
709Warn when a @code{pragma()} is encountered that is not understood by
710@command{gdc}. This differs from @option{-fignore-unknown-pragmas}
711where a pragma that is part of the D language, but not implemented by
712the compiler, won't get reported.
713
873b45d3
IB
714@item -Wno-varargs
715@cindex Wvarargs
716@cindex Wno-varargs
717Do not warn upon questionable usage of the macros used to handle variable
718arguments like @code{va_start}.
719
b4c522fa
IB
720@item -fignore-unknown-pragmas
721@cindex @option{-fignore-unknown-pragmas}
722@cindex @option{-fno-ignore-unknown-pragmas}
723Turns off errors for unsupported pragmas.
724
725@item -fmax-errors=@var{n}
726@cindex @option{-fmax-errors}
727Limits the maximum number of error messages to @var{n}, at which point
728@command{gdc} bails out rather than attempting to continue processing the
729source code. If @var{n} is 0 (the default), there is no limit on the
730number of error messages produced.
731
732@item -fsyntax-only
733@cindex @option{-fsyntax-only}
734@cindex @option{-fno-syntax-only}
735Check the code for syntax errors, but do not actually compile it. This
736can be used in conjunction with @option{-fdoc} or @option{-H} to generate
737files for each module present on the command-line, but no other output
738file.
739
740@item -ftransition=@var{id}
741@cindex @option{-ftransition}
742Report additional information about D language changes identified by
743@var{id}. The following values are supported:
744
745@table @samp
746@item all
47fe7be6 747List information on all D language transitions.
b4c522fa
IB
748@item complex
749List all usages of complex or imaginary types.
b4c522fa
IB
750@item field
751List all non-mutable fields which occupy an object instance.
0fb57034
IB
752@item in
753List all usages of @code{in} on parameter.
b4c522fa
IB
754@item nogc
755List all hidden GC allocations.
47fe7be6
IB
756@item templates
757List statistics on template instantiations.
b4c522fa
IB
758@item tls
759List all variables going into thread local storage.
47fe7be6
IB
760@item vmarkdown
761List instances of Markdown replacements in Ddoc.
b4c522fa
IB
762@end table
763
764@end table
765
766@node Linking
767@section Options for Linking
768@cindex options, linking
769@cindex linking, static
770
771These options come into play when the compiler links object files into an
772executable output file. They are meaningless if the compiler is not doing
773a link step.
774
775@table @gcctabopt
776
852c4b04
IB
777@item -defaultlib=@var{libname}
778@cindex @option{-defaultlib=}
b4c522fa
IB
779Specify the library to use instead of libphobos when linking. Options
780specifying the linkage of libphobos, such as @option{-static-libphobos}
781or @option{-shared-libphobos}, are ignored.
782
852c4b04
IB
783@item -debuglib=@var{libname}
784@cindex @option{-debuglib=}
b4c522fa
IB
785Specify the debug library to use instead of libphobos when linking.
786This option has no effect unless the @option{-g} option was also given
787on the command line. Options specifying the linkage of libphobos, such
788as @option{-static-libphobos} or @option{-shared-libphobos}, are ignored.
789
790@item -nophoboslib
791@cindex @option{-nophoboslib}
792Do not use the Phobos or D runtime library when linking. Options specifying
793the linkage of libphobos, such as @option{-static-libphobos} or
794@option{-shared-libphobos}, are ignored. The standard system libraries are
795used normally, unless @option{-nostdlib} or @option{-nodefaultlibs} is used.
796
797@item -shared-libphobos
798@cindex @option{-shared-libphobos}
799On systems that provide @file{libgphobos} and @file{libgdruntime} as a
800shared and a static library, this option forces the use of the shared
801version. If no shared version was built when the compiler was configured,
802this option has no effect.
803
804@item -static-libphobos
805@cindex @option{-static-libphobos}
806On systems that provide @file{libgphobos} and @file{libgdruntime} as a
807shared and a static library, this option forces the use of the static
808version. If no static version was built when the compiler was configured,
809this option has no effect.
810
811@end table
812
813@node Developer Options
814@section Developer Options
815@cindex developer options
816@cindex debug dump options
817@cindex dump options
818
819This section describes command-line options that are primarily of
820interest to developers or language tooling.
821
822@table @gcctabopt
823
824@item -fdump-d-original
825@cindex @option{-fdump-d-original}
826Output the internal front-end AST after the @code{semantic3} stage.
827This option is only useful for debugging the GNU D compiler itself.
828
829@item -v
830@cindex @option{-v}
831Dump information about the compiler language processing stages as the source
832program is being compiled. This includes listing all modules that are
833processed through the @code{parse}, @code{semantic}, @code{semantic2}, and
834@code{semantic3} stages; all @code{import} modules and their file paths;
835and all @code{function} bodies that are being compiled.
836
837@end table
838
839@c man end
840
841@node Index
842@unnumbered Index
843
844@printindex cp
845
846@bye
This page took 1.172517 seconds and 5 git commands to generate.