Update gcc-50 to SVN version 221572
[dragonfly.git] / contrib / gcc-5.0 / gcc / doc / invoke.texi
1@c Copyright (C) 1988-2015 Free Software Foundation, Inc.
2@c This is part of the GCC manual.
3@c For copying conditions, see the file gcc.texi.
6@c man begin INCLUDE
7@include gcc-vers.texi
8@c man end
10@c man begin COPYRIGHT
11Copyright @copyright{} 1988-2015 Free Software Foundation, Inc.
13Permission is granted to copy, distribute and/or modify this document
14under the terms of the GNU Free Documentation License, Version 1.3 or
15any later version published by the Free Software Foundation; with the
16Invariant Sections being ``GNU General Public License'' and ``Funding
17Free Software'', the Front-Cover texts being (a) (see below), and with
18the Back-Cover Texts being (b) (see below). A copy of the license is
19included in the gfdl(7) man page.
21(a) The FSF's Front-Cover Text is:
23 A GNU Manual
25(b) The FSF's Back-Cover Text is:
27 You have freedom to copy and modify this GNU Manual, like GNU
28 software. Copies published by the Free Software Foundation raise
29 funds for GNU development.
30@c man end
31@c Set file name and title for the man page.
32@setfilename gcc
33@settitle GNU project C and C++ compiler
34@c man begin SYNOPSIS
35gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
36 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
37 [@option{-W}@var{warn}@dots{}] [@option{-Wpedantic}]
38 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
39 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
40 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
41 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
43Only the most useful options are listed here; see below for the
44remainder. @command{g++} accepts mostly the same options as @command{gcc}.
45@c man end
46@c man begin SEEALSO
47gpl(7), gfdl(7), fsf-funding(7),
48cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
49and the Info entries for @file{gcc}, @file{cpp}, @file{as},
50@file{ld}, @file{binutils} and @file{gdb}.
51@c man end
52@c man begin BUGS
53For instructions on reporting bugs, see
55@c man end
56@c man begin AUTHOR
57See the Info entry for @command{gcc}, or
59for contributors to GCC@.
60@c man end
61@end ignore
63@node Invoking GCC
64@chapter GCC Command Options
65@cindex GCC command options
66@cindex command options
67@cindex options, GCC command
69@c man begin DESCRIPTION
70When you invoke GCC, it normally does preprocessing, compilation,
71assembly and linking. The ``overall options'' allow you to stop this
72process at an intermediate stage. For example, the @option{-c} option
73says not to run the linker. Then the output consists of object files
74output by the assembler.
76Other options are passed on to one stage of processing. Some options
77control the preprocessor and others the compiler itself. Yet other
78options control the assembler and linker; most of these are not
79documented here, since you rarely need to use any of them.
81@cindex C compilation options
82Most of the command-line options that you can use with GCC are useful
83for C programs; when an option is only useful with another language
84(usually C++), the explanation says so explicitly. If the description
85for a particular option does not mention a source language, you can use
86that option with all supported languages.
88@cindex C++ compilation options
89@xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
90options for compiling C++ programs.
92@cindex grouping options
93@cindex options, grouping
94The @command{gcc} program accepts options and file names as operands. Many
95options have multi-letter names; therefore multiple single-letter options
96may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
99@cindex order of options
100@cindex options, order
101You can mix options and other arguments. For the most part, the order
102you use doesn't matter. Order does matter when you use several
103options of the same kind; for example, if you specify @option{-L} more
104than once, the directories are searched in the order specified. Also,
105the placement of the @option{-l} option is significant.
107Many options have long names starting with @samp{-f} or with
108@samp{-W}---for example,
109@option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
110these have both positive and negative forms; the negative form of
111@option{-ffoo} is @option{-fno-foo}. This manual documents
112only one of these two forms, whichever one is not the default.
114@c man end
116@xref{Option Index}, for an index to GCC's options.
119* Option Summary:: Brief list of all options, without explanations.
120* Overall Options:: Controlling the kind of output:
121 an executable, object files, assembler files,
122 or preprocessed source.
123* Invoking G++:: Compiling C++ programs.
124* C Dialect Options:: Controlling the variant of C language compiled.
125* C++ Dialect Options:: Variations on C++.
126* Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
127 and Objective-C++.
128* Language Independent Options:: Controlling how diagnostics should be
129 formatted.
130* Warning Options:: How picky should the compiler be?
131* Debugging Options:: Symbol tables, measurements, and debugging dumps.
132* Optimize Options:: How much optimization?
133* Preprocessor Options:: Controlling header files and macro definitions.
134 Also, getting dependency information for Make.
135* Assembler Options:: Passing options to the assembler.
136* Link Options:: Specifying libraries and so on.
137* Directory Options:: Where to find header files and libraries.
138 Where to find the compiler executable files.
139* Spec Files:: How to pass switches to sub-processes.
140* Target Options:: Running a cross-compiler, or an old version of GCC.
141* Submodel Options:: Specifying minor hardware or convention variations,
142 such as 68010 vs 68020.
143* Code Gen Options:: Specifying conventions for function calls, data layout
144 and register usage.
145* Environment Variables:: Env vars that affect GCC.
146* Precompiled Headers:: Compiling a header once, and using it many times.
147@end menu
149@c man begin OPTIONS
151@node Option Summary
152@section Option Summary
154Here is a summary of all the options, grouped by type. Explanations are
155in the following sections.
157@table @emph
158@item Overall Options
159@xref{Overall Options,,Options Controlling the Kind of Output}.
160@gccoptlist{-c -S -E -o @var{file} -no-canonical-prefixes @gol
161-pipe -pass-exit-codes @gol
162-x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
163--version -wrapper @@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg} @gol
164-fdump-ada-spec@r{[}-slim@r{]} -fada-spec-parent=@var{unit} -fdump-go-spec=@var{file}}
166@item C Language Options
167@xref{C Dialect Options,,Options Controlling C Dialect}.
168@gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
169-aux-info @var{filename} -fallow-parameterless-variadic-functions @gol
170-fno-asm -fno-builtin -fno-builtin-@var{function} @gol
171-fhosted -ffreestanding -fopenacc -fopenmp -fopenmp-simd @gol
172-fms-extensions -fplan9-extensions -trigraphs -traditional -traditional-cpp @gol
173-fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
174-fsigned-bitfields -fsigned-char @gol
175-funsigned-bitfields -funsigned-char}
177@item C++ Language Options
178@xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
179@gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
180-fconstexpr-depth=@var{n} -ffriend-injection @gol
181-fno-elide-constructors @gol
182-fno-enforce-eh-specs @gol
183-ffor-scope -fno-for-scope -fno-gnu-keywords @gol
184-fno-implicit-templates @gol
185-fno-implicit-inline-templates @gol
186-fno-implement-inlines -fms-extensions @gol
187-fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
188-fno-optional-diags -fpermissive @gol
189-fno-pretty-templates @gol
190-frepo -fno-rtti -fsized-deallocation @gol
191-fstats -ftemplate-backtrace-limit=@var{n} @gol
192-ftemplate-depth=@var{n} @gol
193-fno-threadsafe-statics -fuse-cxa-atexit @gol
194-fno-weak -nostdinc++ @gol
195-fvisibility-inlines-hidden @gol
196-fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]} @gol
197-fvtv-counts -fvtv-debug @gol
198-fvisibility-ms-compat @gol
199-fext-numeric-literals @gol
38c0c85b 200-Wabi=@var{n} -Wabi-tag -Wconversion-null -Wctor-dtor-privacy @gol
201-Wdelete-non-virtual-dtor -Wliteral-suffix -Wnarrowing @gol
202-Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
203-Weffc++ -Wstrict-null-sentinel @gol
204-Wno-non-template-friend -Wold-style-cast @gol
205-Woverloaded-virtual -Wno-pmf-conversions @gol
208@item Objective-C and Objective-C++ Language Options
209@xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
210Objective-C and Objective-C++ Dialects}.
211@gccoptlist{-fconstant-string-class=@var{class-name} @gol
212-fgnu-runtime -fnext-runtime @gol
213-fno-nil-receivers @gol
214-fobjc-abi-version=@var{n} @gol
215-fobjc-call-cxx-cdtors @gol
216-fobjc-direct-dispatch @gol
217-fobjc-exceptions @gol
218-fobjc-gc @gol
219-fobjc-nilcheck @gol
220-fobjc-std=objc1 @gol
221-fno-local-ivars @gol
222-fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]} @gol
223-freplace-objc-classes @gol
224-fzero-link @gol
225-gen-decls @gol
226-Wassign-intercept @gol
227-Wno-protocol -Wselector @gol
228-Wstrict-selector-match @gol
231@item Language Independent Options
232@xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
233@gccoptlist{-fmessage-length=@var{n} @gol
234-fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
235-fdiagnostics-color=@r{[}auto@r{|}never@r{|}always@r{]} @gol
236-fno-diagnostics-show-option -fno-diagnostics-show-caret}
238@item Warning Options
239@xref{Warning Options,,Options to Request or Suppress Warnings}.
240@gccoptlist{-fsyntax-only -fmax-errors=@var{n} -Wpedantic @gol
241-pedantic-errors @gol
242-w -Wextra -Wall -Waddress -Waggregate-return @gol
243-Waggressive-loop-optimizations -Warray-bounds -Warray-bounds=@var{n} @gol
244-Wbool-compare @gol
245-Wno-attributes -Wno-builtin-macro-redefined @gol
246-Wc90-c99-compat -Wc99-c11-compat @gol
247-Wc++-compat -Wc++11-compat -Wc++14-compat -Wcast-align -Wcast-qual @gol
248-Wchar-subscripts -Wclobbered -Wcomment -Wconditionally-supported @gol
249-Wconversion -Wcoverage-mismatch -Wdate-time -Wdelete-incomplete -Wno-cpp @gol
250-Wno-deprecated -Wno-deprecated-declarations -Wno-designated-init @gol
251-Wdisabled-optimization @gol
252-Wno-discarded-qualifiers -Wno-discarded-array-qualifiers @gol
253-Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
254-Wno-endif-labels -Werror -Werror=* @gol
255-Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
256-Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
257-Wformat-security -Wformat-signedness -Wformat-y2k @gol
258-Wframe-larger-than=@var{len} -Wno-free-nonheap-object -Wjump-misses-init @gol
259-Wignored-qualifiers -Wincompatible-pointer-types @gol
260-Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
261-Winit-self -Winline -Wno-int-conversion @gol
262-Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
263-Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
264-Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol
265-Wmain -Wmaybe-uninitialized -Wmemset-transposed-args -Wmissing-braces @gol
266-Wmissing-field-initializers -Wmissing-include-dirs @gol
267-Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol
268 -Wodr -Wno-overflow -Wopenmp-simd @gol
269-Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
270-Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
271-Wpointer-arith -Wno-pointer-to-int-cast @gol
272-Wredundant-decls -Wno-return-local-addr @gol
273-Wreturn-type -Wsequence-point -Wshadow -Wno-shadow-ivar @gol
274-Wshift-count-negative -Wshift-count-overflow @gol
275-Wsign-compare -Wsign-conversion -Wfloat-conversion @gol
276-Wsizeof-pointer-memaccess -Wsizeof-array-argument @gol
277-Wstack-protector -Wstack-usage=@var{len} -Wstrict-aliasing @gol
278-Wstrict-aliasing=n @gol -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
279-Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{|}format@r{]} @gol
280-Wsuggest-final-types @gol -Wsuggest-final-methods @gol -Wsuggest-override @gol
281-Wmissing-format-attribute @gol
282-Wswitch -Wswitch-default -Wswitch-enum -Wswitch-bool -Wsync-nand @gol
283-Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
284-Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
285-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
286-Wunused-label -Wunused-local-typedefs -Wunused-parameter @gol
287-Wno-unused-result -Wunused-value @gol -Wunused-variable @gol
288-Wunused-but-set-parameter -Wunused-but-set-variable @gol
289-Wuseless-cast -Wvariadic-macros -Wvector-operation-performance @gol
290-Wvla -Wvolatile-register-var -Wwrite-strings @gol
293@item C and Objective-C-only Warning Options
294@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
295-Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
296-Wold-style-declaration -Wold-style-definition @gol
297-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
298-Wdeclaration-after-statement -Wpointer-sign}
300@item Debugging Options
301@xref{Debugging Options,,Options for Debugging Your Program or GCC}.
302@gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
303-fsanitize=@var{style} -fsanitize-recover -fsanitize-recover=@var{style} @gol
304-fasan-shadow-offset=@var{number} -fsanitize-undefined-trap-on-error @gol
305-fcheck-pointer-bounds -fchkp-check-incomplete-type @gol
306-fchkp-first-field-has-own-bounds -fchkp-narrow-bounds @gol
307-fchkp-narrow-to-innermost-array -fchkp-optimize @gol
308-fchkp-use-fast-string-functions -fchkp-use-nochk-string-functions @gol
309-fchkp-use-static-bounds -fchkp-use-static-const-bounds @gol
310-fchkp-treat-zero-dynamic-size-as-infinite -fchkp-check-read @gol
311-fchkp-check-read -fchkp-check-write -fchkp-store-bounds @gol
312-fchkp-instrument-calls -fchkp-instrument-marked-only @gol
313-fchkp-use-wrappers @gol
314-fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
315-fdisable-ipa-@var{pass_name} @gol
316-fdisable-rtl-@var{pass_name} @gol
317-fdisable-rtl-@var{pass-name}=@var{range-list} @gol
318-fdisable-tree-@var{pass_name} @gol
319-fdisable-tree-@var{pass-name}=@var{range-list} @gol
320-fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
321-fdump-translation-unit@r{[}-@var{n}@r{]} @gol
322-fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
323-fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
324-fdump-passes @gol
325-fdump-statistics @gol
326-fdump-tree-all @gol
327-fdump-tree-original@r{[}-@var{n}@r{]} @gol
328-fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
329-fdump-tree-cfg -fdump-tree-alias @gol
330-fdump-tree-ch @gol
331-fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
332-fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
333-fdump-tree-gimple@r{[}-raw@r{]} @gol
334-fdump-tree-dom@r{[}-@var{n}@r{]} @gol
335-fdump-tree-dse@r{[}-@var{n}@r{]} @gol
336-fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
337-fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
338-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
339-fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
340-fdump-tree-nrv -fdump-tree-vect @gol
341-fdump-tree-sink @gol
342-fdump-tree-sra@r{[}-@var{n}@r{]} @gol
343-fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
344-fdump-tree-fre@r{[}-@var{n}@r{]} @gol
345-fdump-tree-vtable-verify @gol
346-fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
347-fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
348-fdump-final-insns=@var{file} @gol
349-fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
350-feliminate-dwarf2-dups -fno-eliminate-unused-debug-types @gol
351-feliminate-unused-debug-symbols -femit-class-debug-always @gol
352-fenable-@var{kind}-@var{pass} @gol
353-fenable-@var{kind}-@var{pass}=@var{range-list} @gol
354-fdebug-types-section -fmem-report-wpa @gol
355-fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
356-fopt-info @gol
357-fopt-info-@var{options}@r{[}=@var{file}@r{]} @gol
358-frandom-seed=@var{number} -fsched-verbose=@var{n} @gol
359-fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
360-fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
361-fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
362-g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
363-ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol
364-gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
365-gvms -gxcoff -gxcoff+ -gz@r{[}=@var{type}@r{]} @gol
366-fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
367-fdebug-prefix-map=@var{old}=@var{new} @gol
368-femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
369-femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
370-p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
371-print-multi-directory -print-multi-lib -print-multi-os-directory @gol
372-print-prog-name=@var{program} -print-search-dirs -Q @gol
373-print-sysroot -print-sysroot-headers-suffix @gol
374-save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
376@item Optimization Options
377@xref{Optimize Options,,Options that Control Optimization}.
378@gccoptlist{-faggressive-loop-optimizations -falign-functions[=@var{n}] @gol
379-falign-jumps[=@var{n}] @gol
380-falign-labels[=@var{n}] -falign-loops[=@var{n}] @gol
381-fassociative-math -fauto-profile -fauto-profile[=@var{path}] @gol
382-fauto-inc-dec -fbranch-probabilities @gol
383-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
384-fbtr-bb-exclusive -fcaller-saves @gol
385-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
386-fcompare-elim -fcprop-registers -fcrossjumping @gol
387-fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
388-fcx-limited-range @gol
389-fdata-sections -fdce -fdelayed-branch @gol
390-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively @gol
391-fdevirtualize-at-ltrans -fdse @gol
392-fearly-inlining -fipa-sra -fexpensive-optimizations -ffat-lto-objects @gol
393-ffast-math -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
394-fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
395-fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
396-fgcse-sm -fhoist-adjacent-loads -fif-conversion @gol
397-fif-conversion2 -findirect-inlining @gol
398-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
f4d9d362 399-finline-small-functions -fipa-cp -fipa-cp-clone -fipa-cp-alignment @gol
400-fipa-pta -fipa-profile -fipa-pure-const -fipa-reference -fipa-icf @gol
401-fira-algorithm=@var{algorithm} @gol
402-fira-region=@var{region} -fira-hoist-pressure @gol
403-fira-loop-pressure -fno-ira-share-save-slots @gol
404-fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
405-fisolate-erroneous-paths-dereference -fisolate-erroneous-paths-attribute @gol
406-fivopts -fkeep-inline-functions -fkeep-static-consts @gol
407-flive-range-shrinkage @gol
408-floop-block -floop-interchange -floop-strip-mine @gol
409-floop-unroll-and-jam -floop-nest-optimize @gol
410-floop-parallelize-all -flra-remat -flto -flto-compression-level @gol
411-flto-partition=@var{alg} -flto-report -flto-report-wpa -fmerge-all-constants @gol
412-fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
413-fmove-loop-invariants -fno-branch-count-reg @gol
414-fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
415-fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
416-fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
417-fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
418-fomit-frame-pointer -foptimize-sibling-calls @gol
419-fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
420-fprefetch-loop-arrays -fprofile-report @gol
421-fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
422-fprofile-generate=@var{path} @gol
423-fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
424-fprofile-reorder-functions @gol
425-freciprocal-math -free -frename-registers -freorder-blocks @gol
426-freorder-blocks-and-partition -freorder-functions @gol
427-frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
428-frounding-math -fsched2-use-superblocks -fsched-pressure @gol
429-fsched-spec-load -fsched-spec-load-dangerous @gol
430-fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
431-fsched-group-heuristic -fsched-critical-path-heuristic @gol
432-fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
433-fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
434-fschedule-fusion @gol
435-fschedule-insns -fschedule-insns2 -fsection-anchors @gol
436-fselective-scheduling -fselective-scheduling2 @gol
437-fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
438-fsemantic-interposition @gol
439-fshrink-wrap -fsignaling-nans -fsingle-precision-constant @gol
440-fsplit-ivs-in-unroller -fsplit-wide-types -fssa-phiopt @gol
441-fstack-protector -fstack-protector-all -fstack-protector-strong @gol
f4d9d362 442-fstack-protector-explicit -fstdarg-opt -fstrict-aliasing @gol
443-fstrict-overflow -fthread-jumps -ftracer -ftree-bit-ccp @gol
444-ftree-builtin-call-dce -ftree-ccp -ftree-ch @gol
445-ftree-coalesce-inline-vars -ftree-coalesce-vars -ftree-copy-prop @gol
446-ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
447-ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
448-ftree-loop-if-convert-stores -ftree-loop-im @gol
449-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
450-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
451-ftree-loop-vectorize @gol
452-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
453-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
454-ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
455-ftree-vectorize -ftree-vrp @gol
456-funit-at-a-time -funroll-all-loops -funroll-loops @gol
457-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
458-fipa-ra -fvariable-expansion-in-unroller -fvect-cost-model -fvpt @gol
459-fweb -fwhole-program -fwpa -fuse-linker-plugin @gol
460--param @var{name}=@var{value}
461-O -O0 -O1 -O2 -O3 -Os -Ofast -Og}
463@item Preprocessor Options
464@xref{Preprocessor Options,,Options Controlling the Preprocessor}.
465@gccoptlist{-A@var{question}=@var{answer} @gol
466-A-@var{question}@r{[}=@var{answer}@r{]} @gol
467-C -dD -dI -dM -dN @gol
468-D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
469-idirafter @var{dir} @gol
470-include @var{file} -imacros @var{file} @gol
471-iprefix @var{file} -iwithprefix @var{dir} @gol
472-iwithprefixbefore @var{dir} -isystem @var{dir} @gol
473-imultilib @var{dir} -isysroot @var{dir} @gol
474-M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
475-P -fdebug-cpp -ftrack-macro-expansion -fworking-directory @gol
476-remap -trigraphs -undef -U@var{macro} @gol
477-Wp,@var{option} -Xpreprocessor @var{option} -no-integrated-cpp}
479@item Assembler Option
480@xref{Assembler Options,,Passing Options to the Assembler}.
481@gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
483@item Linker Options
484@xref{Link Options,,Options for Linking}.
485@gccoptlist{@var{object-file-name} -fuse-ld=@var{linker} -l@var{library} @gol
486-nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
487-s -static -static-libgcc -static-libstdc++ @gol
488-static-libasan -static-libtsan -static-liblsan -static-libubsan @gol
f09a3553 489-static-libmpx -static-libmpxwrappers @gol
490-shared -shared-libgcc -symbolic @gol
491-T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
492-u @var{symbol} -z @var{keyword}}
494@item Directory Options
495@xref{Directory Options,,Options for Directory Search}.
496@gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir} @gol
497-iquote@var{dir} -L@var{dir} -specs=@var{file} -I- @gol
498--sysroot=@var{dir} --no-sysroot-suffix}
500@item Machine Dependent Options
501@xref{Submodel Options,,Hardware Models and Configurations}.
502@c This list is ordered alphanumerically by subsection name.
503@c Try and put the significant identifier (CPU or system) first,
504@c so users have a clue at guessing where the ones they want will be.
506@emph{AArch64 Options}
507@gccoptlist{-mabi=@var{name} -mbig-endian -mlittle-endian @gol
508-mgeneral-regs-only @gol
509-mcmodel=tiny -mcmodel=small -mcmodel=large @gol
510-mstrict-align @gol
511-momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
512-mtls-dialect=desc -mtls-dialect=traditional @gol
513-mfix-cortex-a53-835769 -mno-fix-cortex-a53-835769 @gol
514-march=@var{name} -mcpu=@var{name} -mtune=@var{name}}
516@emph{Adapteva Epiphany Options}
517@gccoptlist{-mhalf-reg-file -mprefer-short-insn-regs @gol
518-mbranch-cost=@var{num} -mcmove -mnops=@var{num} -msoft-cmpsf @gol
519-msplit-lohi -mpost-inc -mpost-modify -mstack-offset=@var{num} @gol
520-mround-nearest -mlong-calls -mshort-calls -msmall16 @gol
521-mfp-mode=@var{mode} -mvect-double -max-vect-align=@var{num} @gol
522-msplit-vecmove-early -m1reg-@var{reg}}
524@emph{ARC Options}
525@gccoptlist{-mbarrel-shifter @gol
526-mcpu=@var{cpu} -mA6 -mARC600 -mA7 -mARC700 @gol
527-mdpfp -mdpfp-compact -mdpfp-fast -mno-dpfp-lrsr @gol
528-mea -mno-mpy -mmul32x16 -mmul64 @gol
529-mnorm -mspfp -mspfp-compact -mspfp-fast -msimd -msoft-float -mswap @gol
530-mcrc -mdsp-packa -mdvbf -mlock -mmac-d16 -mmac-24 -mrtsc -mswape @gol
531-mtelephony -mxy -misize -mannotate-align -marclinux -marclinux_prof @gol
532-mepilogue-cfi -mlong-calls -mmedium-calls -msdata @gol
533-mucb-mcount -mvolatile-cache @gol
534-malign-call -mauto-modify-reg -mbbit-peephole -mno-brcc @gol
535-mcase-vector-pcrel -mcompact-casesi -mno-cond-exec -mearly-cbranchsi @gol
536-mexpand-adddi -mindexed-loads -mlra -mlra-priority-none @gol
537-mlra-priority-compact mlra-priority-noncompact -mno-millicode @gol
538-mmixed-code -mq-class -mRcq -mRcw -msize-level=@var{level} @gol
539-mtune=@var{cpu} -mmultcost=@var{num} -munalign-prob-threshold=@var{probability}}
541@emph{ARM Options}
542@gccoptlist{-mapcs-frame -mno-apcs-frame @gol
543-mabi=@var{name} @gol
544-mapcs-stack-check -mno-apcs-stack-check @gol
545-mapcs-float -mno-apcs-float @gol
546-mapcs-reentrant -mno-apcs-reentrant @gol
547-msched-prolog -mno-sched-prolog @gol
548-mlittle-endian -mbig-endian @gol
549-mfloat-abi=@var{name} @gol
551-mthumb-interwork -mno-thumb-interwork @gol
552-mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
553-mstructure-size-boundary=@var{n} @gol
554-mabort-on-noreturn @gol
555-mlong-calls -mno-long-calls @gol
556-msingle-pic-base -mno-single-pic-base @gol
557-mpic-register=@var{reg} @gol
558-mnop-fun-dllimport @gol
559-mpoke-function-name @gol
560-mthumb -marm @gol
561-mtpcs-frame -mtpcs-leaf-frame @gol
562-mcaller-super-interworking -mcallee-super-interworking @gol
563-mtp=@var{name} -mtls-dialect=@var{dialect} @gol
564-mword-relocations @gol
565-mfix-cortex-m3-ldrd @gol
566-munaligned-access @gol
567-mneon-for-64bits @gol
568-mslow-flash-data @gol
569-masm-syntax-unified @gol
572@emph{AVR Options}
573@gccoptlist{-mmcu=@var{mcu} -maccumulate-args -mbranch-cost=@var{cost} @gol
f09a3553 574-mcall-prologues -mint8 -mn_flash=@var{size} -mno-interrupts @gol
38c0c85b 575-mrelax -mrmw -mstrict-X -mtiny-stack -nodevicelib -Waddr-space-convert}
577@emph{Blackfin Options}
578@gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
579-msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
580-mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
581-mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
582-mno-id-shared-library -mshared-library-id=@var{n} @gol
583-mleaf-id-shared-library -mno-leaf-id-shared-library @gol
584-msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
585-mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
588@emph{C6X Options}
589@gccoptlist{-mbig-endian -mlittle-endian -march=@var{cpu} @gol
590-msim -msdata=@var{sdata-type}}
592@emph{CRIS Options}
593@gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
594-mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
595-metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
596-mstack-align -mdata-align -mconst-align @gol
597-m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
598-melf -maout -melinux -mlinux -sim -sim2 @gol
599-mmul-bug-workaround -mno-mul-bug-workaround}
601@emph{CR16 Options}
602@gccoptlist{-mmac @gol
603-mcr16cplus -mcr16c @gol
604-msim -mint32 -mbit-ops
607@emph{Darwin Options}
608@gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
609-arch_only -bind_at_load -bundle -bundle_loader @gol
610-client_name -compatibility_version -current_version @gol
611-dead_strip @gol
612-dependency-file -dylib_file -dylinker_install_name @gol
613-dynamic -dynamiclib -exported_symbols_list @gol
614-filelist -flat_namespace -force_cpusubtype_ALL @gol
615-force_flat_namespace -headerpad_max_install_names @gol
616-iframework @gol
617-image_base -init -install_name -keep_private_externs @gol
618-multi_module -multiply_defined -multiply_defined_unused @gol
619-noall_load -no_dead_strip_inits_and_terms @gol
620-nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
621-pagezero_size -prebind -prebind_all_twolevel_modules @gol
622-private_bundle -read_only_relocs -sectalign @gol
623-sectobjectsymbols -whyload -seg1addr @gol
624-sectcreate -sectobjectsymbols -sectorder @gol
625-segaddr -segs_read_only_addr -segs_read_write_addr @gol
626-seg_addr_table -seg_addr_table_filename -seglinkedit @gol
627-segprot -segs_read_only_addr -segs_read_write_addr @gol
628-single_module -static -sub_library -sub_umbrella @gol
629-twolevel_namespace -umbrella -undefined @gol
630-unexported_symbols_list -weak_reference_mismatches @gol
631-whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
632-mkernel -mone-byte-bool}
634@emph{DEC Alpha Options}
635@gccoptlist{-mno-fp-regs -msoft-float @gol
636-mieee -mieee-with-inexact -mieee-conformant @gol
637-mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
638-mtrap-precision=@var{mode} -mbuild-constants @gol
639-mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
640-mbwx -mmax -mfix -mcix @gol
641-mfloat-vax -mfloat-ieee @gol
642-mexplicit-relocs -msmall-data -mlarge-data @gol
643-msmall-text -mlarge-text @gol
646@emph{FR30 Options}
647@gccoptlist{-msmall-model -mno-lsim}
649@emph{FRV Options}
650@gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
651-mhard-float -msoft-float @gol
652-malloc-cc -mfixed-cc -mdword -mno-dword @gol
653-mdouble -mno-double @gol
654-mmedia -mno-media -mmuladd -mno-muladd @gol
655-mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
656-mlinked-fp -mlong-calls -malign-labels @gol
657-mlibrary-pic -macc-4 -macc-8 @gol
658-mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
659-moptimize-membar -mno-optimize-membar @gol
660-mscc -mno-scc -mcond-exec -mno-cond-exec @gol
661-mvliw-branch -mno-vliw-branch @gol
662-mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
663-mno-nested-cond-exec -mtomcat-stats @gol
664-mTLS -mtls @gol
667@emph{GNU/Linux Options}
668@gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
669-tno-android-cc -tno-android-ld}
671@emph{H8/300 Options}
672@gccoptlist{-mrelax -mh -ms -mn -mexr -mno-exr -mint32 -malign-300}
674@emph{HPPA Options}
675@gccoptlist{-march=@var{architecture-type} @gol
676-mdisable-fpregs -mdisable-indexing @gol
677-mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
678-mfixed-range=@var{register-range} @gol
679-mjump-in-delay -mlinker-opt -mlong-calls @gol
680-mlong-load-store -mno-disable-fpregs @gol
681-mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
682-mno-jump-in-delay -mno-long-load-store @gol
683-mno-portable-runtime -mno-soft-float @gol
684-mno-space-regs -msoft-float -mpa-risc-1-0 @gol
685-mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
686-mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
687-munix=@var{unix-std} -nolibdld -static -threads}
689@emph{IA-64 Options}
690@gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
691-mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
692-mconstant-gp -mauto-pic -mfused-madd @gol
693-minline-float-divide-min-latency @gol
694-minline-float-divide-max-throughput @gol
695-mno-inline-float-divide @gol
696-minline-int-divide-min-latency @gol
697-minline-int-divide-max-throughput @gol
698-mno-inline-int-divide @gol
699-minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
700-mno-inline-sqrt @gol
701-mdwarf2-asm -mearly-stop-bits @gol
702-mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
703-mtune=@var{cpu-type} -milp32 -mlp64 @gol
704-msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
705-msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
706-msched-spec-ldc -msched-spec-control-ldc @gol
707-msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
708-msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
709-msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
710-msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
712@emph{LM32 Options}
713@gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
714-msign-extend-enabled -muser-enabled}
716@emph{M32R/D Options}
717@gccoptlist{-m32r2 -m32rx -m32r @gol
718-mdebug @gol
719-malign-loops -mno-align-loops @gol
720-missue-rate=@var{number} @gol
721-mbranch-cost=@var{number} @gol
722-mmodel=@var{code-size-model-type} @gol
723-msdata=@var{sdata-type} @gol
724-mno-flush-func -mflush-func=@var{name} @gol
725-mno-flush-trap -mflush-trap=@var{number} @gol
726-G @var{num}}
728@emph{M32C Options}
729@gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
731@emph{M680x0 Options}
732@gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune} @gol
733-m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
734-m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
735-mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
736-mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
737-mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
738-malign-int -mstrict-align -msep-data -mno-sep-data @gol
739-mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
740-mxgot -mno-xgot}
742@emph{MCore Options}
743@gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
744-mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
745-m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
746-mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
747-mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
749@emph{MeP Options}
750@gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
751-mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
752-mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
753-mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
756@emph{MicroBlaze Options}
757@gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
758-mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
759-mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
760-mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
761-mbig-endian -mlittle-endian -mxl-reorder -mxl-mode-@var{app-model}}
763@emph{MIPS Options}
764@gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
765-mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 -mips32r3 -mips32r5 @gol
766-mips32r6 -mips64 -mips64r2 -mips64r3 -mips64r5 -mips64r6 @gol
767-mips16 -mno-mips16 -mflip-mips16 @gol
768-minterlink-compressed -mno-interlink-compressed @gol
769-minterlink-mips16 -mno-interlink-mips16 @gol
770-mabi=@var{abi} -mabicalls -mno-abicalls @gol
771-mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
772-mgp32 -mgp64 -mfp32 -mfpxx -mfp64 -mhard-float -msoft-float @gol
773-mno-float -msingle-float -mdouble-float @gol
774-modd-spreg -mno-odd-spreg @gol
775-mabs=@var{mode} -mnan=@var{encoding} @gol
776-mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
777-mmcu -mmno-mcu @gol
778-meva -mno-eva @gol
779-mvirt -mno-virt @gol
780-mxpa -mno-xpa @gol
781-mmicromips -mno-micromips @gol
782-mfpu=@var{fpu-type} @gol
783-msmartmips -mno-smartmips @gol
784-mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
785-mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
786-mlong64 -mlong32 -msym32 -mno-sym32 @gol
787-G@var{num} -mlocal-sdata -mno-local-sdata @gol
788-mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
789-membedded-data -mno-embedded-data @gol
790-muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
791-mcode-readable=@var{setting} @gol
792-msplit-addresses -mno-split-addresses @gol
793-mexplicit-relocs -mno-explicit-relocs @gol
794-mcheck-zero-division -mno-check-zero-division @gol
795-mdivide-traps -mdivide-breaks @gol
796-mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
797-mmad -mno-mad -mimadd -mno-imadd -mfused-madd -mno-fused-madd -nocpp @gol
798-mfix-24k -mno-fix-24k @gol
799-mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
800-mfix-r10000 -mno-fix-r10000 -mfix-rm7000 -mno-fix-rm7000 @gol
801-mfix-vr4120 -mno-fix-vr4120 @gol
802-mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
803-mflush-func=@var{func} -mno-flush-func @gol
804-mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
805-mfp-exceptions -mno-fp-exceptions @gol
806-mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
807-mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
809@emph{MMIX Options}
810@gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
811-mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
812-melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
813-mno-base-addresses -msingle-exit -mno-single-exit}
815@emph{MN10300 Options}
816@gccoptlist{-mmult-bug -mno-mult-bug @gol
817-mno-am33 -mam33 -mam33-2 -mam34 @gol
818-mtune=@var{cpu-type} @gol
819-mreturn-pointer-on-d0 @gol
820-mno-crt0 -mrelax -mliw -msetlb}
822@emph{Moxie Options}
823@gccoptlist{-meb -mel -mmul.x -mno-crt0}
825@emph{MSP430 Options}
826@gccoptlist{-msim -masm-hex -mmcu= -mcpu= -mlarge -msmall -mrelax @gol
827-mhwmult= -minrt}
829@emph{NDS32 Options}
830@gccoptlist{-mbig-endian -mlittle-endian @gol
831-mreduced-regs -mfull-regs @gol
832-mcmov -mno-cmov @gol
833-mperf-ext -mno-perf-ext @gol
834-mv3push -mno-v3push @gol
835-m16bit -mno-16bit @gol
836-misr-vector-size=@var{num} @gol
837-mcache-block-size=@var{num} @gol
838-march=@var{arch} @gol
839-mcmodel=@var{code-model} @gol
840-mctor-dtor -mrelax}
842@emph{Nios II Options}
843@gccoptlist{-G @var{num} -mgpopt=@var{option} -mgpopt -mno-gpopt @gol
844-mel -meb @gol
845-mno-bypass-cache -mbypass-cache @gol
846-mno-cache-volatile -mcache-volatile @gol
847-mno-fast-sw-div -mfast-sw-div @gol
848-mhw-mul -mno-hw-mul -mhw-mulx -mno-hw-mulx -mno-hw-div -mhw-div @gol
849-mcustom-@var{insn}=@var{N} -mno-custom-@var{insn} @gol
850-mcustom-fpu-cfg=@var{name} @gol
851-mhal -msmallc -msys-crt0=@var{name} -msys-lib=@var{name}}
853@emph{Nvidia PTX Options}
854@gccoptlist{-m32 -m64 -mmainkernel}
856@emph{PDP-11 Options}
857@gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
858-mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
859-mint16 -mno-int32 -mfloat32 -mno-float64 @gol
860-mfloat64 -mno-float32 -mabshi -mno-abshi @gol
861-mbranch-expensive -mbranch-cheap @gol
862-munix-asm -mdec-asm}
864@emph{picoChip Options}
865@gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
866-msymbol-as-address -mno-inefficient-warnings}
868@emph{PowerPC Options}
869See RS/6000 and PowerPC Options.
871@emph{RL78 Options}
872@gccoptlist{-msim -mmul=none -mmul=g13 -mmul=rl78 @gol
873-m64bit-doubles -m32bit-doubles}
875@emph{RS/6000 and PowerPC Options}
876@gccoptlist{-mcpu=@var{cpu-type} @gol
877-mtune=@var{cpu-type} @gol
878-mcmodel=@var{code-model} @gol
879-mpowerpc64 @gol
880-maltivec -mno-altivec @gol
881-mpowerpc-gpopt -mno-powerpc-gpopt @gol
882-mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
883-mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
884-mfprnd -mno-fprnd @gol
885-mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
886-mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
887-m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
888-malign-power -malign-natural @gol
889-msoft-float -mhard-float -mmultiple -mno-multiple @gol
890-msingle-float -mdouble-float -msimple-fpu @gol
891-mstring -mno-string -mupdate -mno-update @gol
892-mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
893-mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
894-mstrict-align -mno-strict-align -mrelocatable @gol
895-mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
896-mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
897-mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
898-mprioritize-restricted-insns=@var{priority} @gol
899-msched-costly-dep=@var{dependence_type} @gol
900-minsert-sched-nops=@var{scheme} @gol
901-mcall-sysv -mcall-netbsd @gol
902-maix-struct-return -msvr4-struct-return @gol
903-mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
904-mblock-move-inline-limit=@var{num} @gol
905-misel -mno-isel @gol
906-misel=yes -misel=no @gol
907-mspe -mno-spe @gol
908-mspe=yes -mspe=no @gol
909-mpaired @gol
910-mgen-cell-microcode -mwarn-cell-microcode @gol
911-mvrsave -mno-vrsave @gol
912-mmulhw -mno-mulhw @gol
913-mdlmzb -mno-dlmzb @gol
914-mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
915-mprototype -mno-prototype @gol
916-msim -mmvme -mads -myellowknife -memb -msdata @gol
917-msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
918-mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision @gol
919-mno-recip-precision @gol
920-mveclibabi=@var{type} -mfriz -mno-friz @gol
921-mpointers-to-nested-functions -mno-pointers-to-nested-functions @gol
922-msave-toc-indirect -mno-save-toc-indirect @gol
923-mpower8-fusion -mno-mpower8-fusion -mpower8-vector -mno-power8-vector @gol
924-mcrypto -mno-crypto -mdirect-move -mno-direct-move @gol
925-mquad-memory -mno-quad-memory @gol
926-mquad-memory-atomic -mno-quad-memory-atomic @gol
927-mcompat-align-parm -mno-compat-align-parm @gol
928-mupper-regs-df -mno-upper-regs-df -mupper-regs-sf -mno-upper-regs-sf @gol
929-mupper-regs -mno-upper-regs}
931@emph{RX Options}
932@gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
934-mbig-endian-data -mlittle-endian-data @gol
935-msmall-data @gol
936-msim -mno-sim@gol
937-mas100-syntax -mno-as100-syntax@gol
945@emph{S/390 and zSeries Options}
946@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
947-mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
948-mlong-double-64 -mlong-double-128 @gol
949-mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
950-msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
951-m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
952-mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
953-mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard @gol
956@emph{Score Options}
957@gccoptlist{-meb -mel @gol
958-mnhwloop @gol
959-muls @gol
960-mmac @gol
961-mscore5 -mscore5u -mscore7 -mscore7d}
963@emph{SH Options}
964@gccoptlist{-m1 -m2 -m2e @gol
965-m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
966-m3 -m3e @gol
967-m4-nofpu -m4-single-only -m4-single -m4 @gol
968-m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
969-m5-64media -m5-64media-nofpu @gol
970-m5-32media -m5-32media-nofpu @gol
971-m5-compact -m5-compact-nofpu @gol
972-mb -ml -mdalign -mrelax @gol
973-mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
974-mieee -mno-ieee -mbitops -misize -minline-ic_invalidate -mpadstruct @gol
975-mspace -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
976-mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
977-mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
978-maccumulate-outgoing-args -minvalid-symbols @gol
979-matomic-model=@var{atomic-model} @gol
980-mbranch-cost=@var{num} -mzdcbranch -mno-zdcbranch @gol
f4d9d362 981-mcbranch-force-delay-slot @gol
982-mfused-madd -mno-fused-madd -mfsca -mno-fsca -mfsrra -mno-fsrra @gol
983-mpretend-cmove -mtas}
985@emph{Solaris 2 Options}
986@gccoptlist{-mclear-hwcap -mno-clear-hwcap -mimpure-text -mno-impure-text @gol
987-pthreads -pthread}
989@emph{SPARC Options}
990@gccoptlist{-mcpu=@var{cpu-type} @gol
991-mtune=@var{cpu-type} @gol
992-mcmodel=@var{code-model} @gol
993-mmemory-model=@var{mem-model} @gol
994-m32 -m64 -mapp-regs -mno-app-regs @gol
995-mfaster-structs -mno-faster-structs -mflat -mno-flat @gol
996-mfpu -mno-fpu -mhard-float -msoft-float @gol
997-mhard-quad-float -msoft-quad-float @gol
998-mstack-bias -mno-stack-bias @gol
999-munaligned-doubles -mno-unaligned-doubles @gol
1000-muser-mode -mno-user-mode @gol
1001-mv8plus -mno-v8plus -mvis -mno-vis @gol
1002-mvis2 -mno-vis2 -mvis3 -mno-vis3 @gol
1003-mcbcond -mno-cbcond @gol
1004-mfmaf -mno-fmaf -mpopc -mno-popc @gol
1005-mfix-at697f -mfix-ut699}
1007@emph{SPU Options}
1008@gccoptlist{-mwarn-reloc -merror-reloc @gol
1009-msafe-dma -munsafe-dma @gol
1010-mbranch-hints @gol
1011-msmall-mem -mlarge-mem -mstdmain @gol
1012-mfixed-range=@var{register-range} @gol
1013-mea32 -mea64 @gol
1014-maddress-space-conversion -mno-address-space-conversion @gol
1015-mcache-size=@var{cache-size} @gol
1016-matomic-updates -mno-atomic-updates}
1018@emph{System V Options}
1019@gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
1021@emph{TILE-Gx Options}
1022@gccoptlist{-mcpu=CPU -m32 -m64 -mbig-endian -mlittle-endian @gol
1025@emph{TILEPro Options}
1026@gccoptlist{-mcpu=@var{cpu} -m32}
1028@emph{V850 Options}
1029@gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
1030-mprolog-function -mno-prolog-function -mspace @gol
1031-mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
1032-mapp-regs -mno-app-regs @gol
1033-mdisable-callt -mno-disable-callt @gol
1034-mv850e2v3 -mv850e2 -mv850e1 -mv850es @gol
1035-mv850e -mv850 -mv850e3v5 @gol
1036-mloop @gol
1037-mrelax @gol
1038-mlong-jumps @gol
1039-msoft-float @gol
1040-mhard-float @gol
1041-mgcc-abi @gol
1042-mrh850-abi @gol
1045@emph{VAX Options}
1046@gccoptlist{-mg -mgnu -munix}
1048@emph{Visium Options}
1049@gccoptlist{-mdebug -msim -mfpu -mno-fpu -mhard-float -msoft-float @gol
1050-mcpu=@var{cpu-type} -mtune=@var{cpu-type} -msv-mode -muser-mode}
1052@emph{VMS Options}
1053@gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64 @gol
1056@emph{VxWorks Options}
1057@gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
1058-Xbind-lazy -Xbind-now}
1060@emph{x86 Options}
1061@gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
1062-mtune-ctrl=@var{feature-list} -mdump-tune-features -mno-default @gol
1063-mfpmath=@var{unit} @gol
1064-masm=@var{dialect} -mno-fancy-math-387 @gol
1065-mno-fp-ret-in-387 -msoft-float @gol
1066-mno-wide-multiply -mrtd -malign-double @gol
1067-mpreferred-stack-boundary=@var{num} @gol
1068-mincoming-stack-boundary=@var{num} @gol
1069-mcld -mcx16 -msahf -mmovbe -mcrc32 @gol
1070-mrecip -mrecip=@var{opt} @gol
1071-mvzeroupper -mprefer-avx128 @gol
1072-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
1073-mavx2 -mavx512f -mavx512pf -mavx512er -mavx512cd -msha @gol
1074-maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfma -mprefetchwt1 @gol
1075-mclflushopt -mxsavec -mxsaves @gol
1076-msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlzcnt @gol
1077-mbmi2 -mfxsr -mxsave -mxsaveopt -mrtm -mlwp -mmpx -mthreads @gol
1078-mno-align-stringops -minline-all-stringops @gol
1079-minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
1080-mmemcpy-strategy=@var{strategy} -mmemset-strategy=@var{strategy} @gol
1081-mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
1082-m96bit-long-double -mlong-double-64 -mlong-double-80 -mlong-double-128 @gol
1083-mregparm=@var{num} -msseregparm @gol
1084-mveclibabi=@var{type} -mvect8-ret-in-mem @gol
1085-mpc32 -mpc64 -mpc80 -mstackrealign @gol
1086-momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
1087-mcmodel=@var{code-model} -mabi=@var{name} -maddress-mode=@var{mode} @gol
1088-m32 -m64 -mx32 -m16 -mlarge-data-threshold=@var{num} @gol
1089-msse2avx -mfentry -mrecord-mcount -mnop-mcount -m8bit-idiv @gol
1090-mavx256-split-unaligned-load -mavx256-split-unaligned-store @gol
1091-malign-data=@var{type} -mstack-protector-guard=@var{guard}}
1093@emph{x86 Windows Options}
1094@gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll @gol
1095-mnop-fun-dllimport -mthread @gol
1096-municode -mwin32 -mwindows -fno-set-stack-executable}
1098@emph{Xstormy16 Options}
1101@emph{Xtensa Options}
1102@gccoptlist{-mconst16 -mno-const16 @gol
1103-mfused-madd -mno-fused-madd @gol
1104-mforce-no-pic @gol
1105-mserialize-volatile -mno-serialize-volatile @gol
1106-mtext-section-literals -mno-text-section-literals @gol
1107-mtarget-align -mno-target-align @gol
1108-mlongcalls -mno-longcalls}
1110@emph{zSeries Options}
1111See S/390 and zSeries Options.
1113@item Code Generation Options
1114@xref{Code Gen Options,,Options for Code Generation Conventions}.
1115@gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
1116-ffixed-@var{reg} -fexceptions @gol
1117-fnon-call-exceptions -fdelete-dead-exceptions -funwind-tables @gol
1118-fasynchronous-unwind-tables @gol
1119-fno-gnu-unique @gol
1120-finhibit-size-directive -finstrument-functions @gol
1121-finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
1122-finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
1123-fno-common -fno-ident @gol
1124-fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
1125-fno-jump-tables @gol
1126-frecord-gcc-switches @gol
1127-freg-struct-return -fshort-enums @gol
1128-fshort-double -fshort-wchar @gol
1129-fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
1130-fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
1131-fno-stack-limit -fsplit-stack @gol
1132-fleading-underscore -ftls-model=@var{model} @gol
1133-fstack-reuse=@var{reuse_level} @gol
1134-ftrapv -fwrapv -fbounds-check @gol
1135-fvisibility=@r{[}default@r{|}internal@r{|}hidden@r{|}protected@r{]} @gol
1136-fstrict-volatile-bitfields -fsync-libcalls}
1137@end table
1140@node Overall Options
1141@section Options Controlling the Kind of Output
1143Compilation can involve up to four stages: preprocessing, compilation
1144proper, assembly and linking, always in that order. GCC is capable of
1145preprocessing and compiling several files either into several
1146assembler input files, or into one assembler input file; then each
1147assembler input file produces an object file, and linking combines all
1148the object files (those newly compiled, and those specified as input)
1149into an executable file.
1151@cindex file name suffix
1152For any given input file, the file name suffix determines what kind of
1153compilation is done:
1155@table @gcctabopt
1156@item @var{file}.c
1157C source code that must be preprocessed.
1159@item @var{file}.i
1160C source code that should not be preprocessed.
1162@item @var{file}.ii
1163C++ source code that should not be preprocessed.
1165@item @var{file}.m
1166Objective-C source code. Note that you must link with the @file{libobjc}
1167library to make an Objective-C program work.
1169@item @var{file}.mi
1170Objective-C source code that should not be preprocessed.
1172@item @var{file}.mm
1173@itemx @var{file}.M
1174Objective-C++ source code. Note that you must link with the @file{libobjc}
1175library to make an Objective-C++ program work. Note that @samp{.M} refers
1176to a literal capital M@.
1178@item @var{file}.mii
1179Objective-C++ source code that should not be preprocessed.
1181@item @var{file}.h
1182C, C++, Objective-C or Objective-C++ header file to be turned into a
1183precompiled header (default), or C, C++ header file to be turned into an
1184Ada spec (via the @option{-fdump-ada-spec} switch).
1186@item @var{file}.cc
1187@itemx @var{file}.cp
1188@itemx @var{file}.cxx
1189@itemx @var{file}.cpp
1190@itemx @var{file}.CPP
1191@itemx @var{file}.c++
1192@itemx @var{file}.C
1193C++ source code that must be preprocessed. Note that in @samp{.cxx},
1194the last two letters must both be literally @samp{x}. Likewise,
1195@samp{.C} refers to a literal capital C@.
1197@item @var{file}.mm
1198@itemx @var{file}.M
1199Objective-C++ source code that must be preprocessed.
1201@item @var{file}.mii
1202Objective-C++ source code that should not be preprocessed.
1204@item @var{file}.hh
1205@itemx @var{file}.H
1206@itemx @var{file}.hp
1207@itemx @var{file}.hxx
1208@itemx @var{file}.hpp
1209@itemx @var{file}.HPP
1210@itemx @var{file}.h++
1211@itemx @var{file}.tcc
1212C++ header file to be turned into a precompiled header or Ada spec.
1214@item @var{file}.f
1215@itemx @var{file}.for
1216@itemx @var{file}.ftn
1217Fixed form Fortran source code that should not be preprocessed.
1219@item @var{file}.F
1220@itemx @var{file}.FOR
1221@itemx @var{file}.fpp
1222@itemx @var{file}.FPP
1223@itemx @var{file}.FTN
1224Fixed form Fortran source code that must be preprocessed (with the traditional
1227@item @var{file}.f90
1228@itemx @var{file}.f95
1229@itemx @var{file}.f03
1230@itemx @var{file}.f08
1231Free form Fortran source code that should not be preprocessed.
1233@item @var{file}.F90
1234@itemx @var{file}.F95
1235@itemx @var{file}.F03
1236@itemx @var{file}.F08
1237Free form Fortran source code that must be preprocessed (with the
1238traditional preprocessor).
1240@item @var{file}.go
1241Go source code.
1243@c FIXME: Descriptions of Java file types.
1244@c @var{file}.java
1245@c @var{file}.class
1246@c @var{file}.zip
1247@c @var{file}.jar
1249@item @var{file}.ads
1250Ada source code file that contains a library unit declaration (a
1251declaration of a package, subprogram, or generic, or a generic
1252instantiation), or a library unit renaming declaration (a package,
1253generic, or subprogram renaming declaration). Such files are also
1254called @dfn{specs}.
1256@item @var{file}.adb
1257Ada source code file containing a library unit body (a subprogram or
1258package body). Such files are also called @dfn{bodies}.
1260@c GCC also knows about some suffixes for languages not yet included:
1261@c Pascal:
1262@c @var{file}.p
1263@c @var{file}.pas
1264@c Ratfor:
1265@c @var{file}.r
1267@item @var{file}.s
1268Assembler code.
1270@item @var{file}.S
1271@itemx @var{file}.sx
1272Assembler code that must be preprocessed.
1274@item @var{other}
1275An object file to be fed straight into linking.
1276Any file name with no recognized suffix is treated this way.
1277@end table
1279@opindex x
1280You can specify the input language explicitly with the @option{-x} option:
1282@table @gcctabopt
1283@item -x @var{language}
1284Specify explicitly the @var{language} for the following input files
1285(rather than letting the compiler choose a default based on the file
1286name suffix). This option applies to all following input files until
1287the next @option{-x} option. Possible values for @var{language} are:
1289c c-header cpp-output
1290c++ c++-header c++-cpp-output
1291objective-c objective-c-header objective-c-cpp-output
1292objective-c++ objective-c++-header objective-c++-cpp-output
1293assembler assembler-with-cpp
1295f77 f77-cpp-input f95 f95-cpp-input
1298@end smallexample
1300@item -x none
1301Turn off any specification of a language, so that subsequent files are
1302handled according to their file name suffixes (as they are if @option{-x}
1303has not been used at all).
1305@item -pass-exit-codes
1306@opindex pass-exit-codes
1307Normally the @command{gcc} program exits with the code of 1 if any
1308phase of the compiler returns a non-success return code. If you specify
1309@option{-pass-exit-codes}, the @command{gcc} program instead returns with
1310the numerically highest error produced by any phase returning an error
1311indication. The C, C++, and Fortran front ends return 4 if an internal
1312compiler error is encountered.
1313@end table
1315If you only want some of the stages of compilation, you can use
1316@option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1317one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1318@command{gcc} is to stop. Note that some combinations (for example,
1319@samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1321@table @gcctabopt
1322@item -c
1323@opindex c
1324Compile or assemble the source files, but do not link. The linking
1325stage simply is not done. The ultimate output is in the form of an
1326object file for each source file.
1328By default, the object file name for a source file is made by replacing
1329the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1331Unrecognized input files, not requiring compilation or assembly, are
1334@item -S
1335@opindex S
1336Stop after the stage of compilation proper; do not assemble. The output
1337is in the form of an assembler code file for each non-assembler input
1338file specified.
1340By default, the assembler file name for a source file is made by
1341replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1343Input files that don't require compilation are ignored.
1345@item -E
1346@opindex E
1347Stop after the preprocessing stage; do not run the compiler proper. The
1348output is in the form of preprocessed source code, which is sent to the
1349standard output.
1351Input files that don't require preprocessing are ignored.
1353@cindex output file option
1354@item -o @var{file}
1355@opindex o
1356Place output in file @var{file}. This applies to whatever
1357sort of output is being produced, whether it be an executable file,
1358an object file, an assembler file or preprocessed C code.
1360If @option{-o} is not specified, the default is to put an executable
1361file in @file{a.out}, the object file for
1362@file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1363assembler file in @file{@var{source}.s}, a precompiled header file in
1364@file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1365standard output.
1367@item -v
1368@opindex v
1369Print (on standard error output) the commands executed to run the stages
1370of compilation. Also print the version number of the compiler driver
1371program and of the preprocessor and the compiler proper.
1373@item -###
1374@opindex ###
1375Like @option{-v} except the commands are not executed and arguments
1376are quoted unless they contain only alphanumeric characters or @code{./-_}.
1377This is useful for shell scripts to capture the driver-generated command lines.
1379@item -pipe
1380@opindex pipe
1381Use pipes rather than temporary files for communication between the
1382various stages of compilation. This fails to work on some systems where
1383the assembler is unable to read from a pipe; but the GNU assembler has
1384no trouble.
1386@item --help
1387@opindex help
1388Print (on the standard output) a description of the command-line options
1389understood by @command{gcc}. If the @option{-v} option is also specified
1390then @option{--help} is also passed on to the various processes
1391invoked by @command{gcc}, so that they can display the command-line options
1392they accept. If the @option{-Wextra} option has also been specified
1393(prior to the @option{--help} option), then command-line options that
1394have no documentation associated with them are also displayed.
1396@item --target-help
1397@opindex target-help
1398Print (on the standard output) a description of target-specific command-line
1399options for each tool. For some targets extra target-specific
1400information may also be printed.
1402@item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1403Print (on the standard output) a description of the command-line
1404options understood by the compiler that fit into all specified classes
1405and qualifiers. These are the supported classes:
1407@table @asis
1408@item @samp{optimizers}
1409Display all of the optimization options supported by the
1412@item @samp{warnings}
1413Display all of the options controlling warning messages
1414produced by the compiler.
1416@item @samp{target}
1417Display target-specific options. Unlike the
1418@option{--target-help} option however, target-specific options of the
1419linker and assembler are not displayed. This is because those
1420tools do not currently support the extended @option{--help=} syntax.
1422@item @samp{params}
1423Display the values recognized by the @option{--param}
1426@item @var{language}
1427Display the options supported for @var{language}, where
1428@var{language} is the name of one of the languages supported in this
1429version of GCC@.
1431@item @samp{common}
1432Display the options that are common to all languages.
1433@end table
1435These are the supported qualifiers:
1437@table @asis
1438@item @samp{undocumented}
1439Display only those options that are undocumented.
1441@item @samp{joined}
1442Display options taking an argument that appears after an equal
1443sign in the same continuous piece of text, such as:
1446@item @samp{separate}
1447Display options taking an argument that appears as a separate word
1448following the original option, such as: @samp{-o output-file}.
1449@end table
1451Thus for example to display all the undocumented target-specific
1452switches supported by the compiler, use:
1456@end smallexample
1458The sense of a qualifier can be inverted by prefixing it with the
1459@samp{^} character, so for example to display all binary warning
1460options (i.e., ones that are either on or off and that do not take an
1461argument) that have a description, use:
1465@end smallexample
1467The argument to @option{--help=} should not consist solely of inverted
1470Combining several classes is possible, although this usually
1471restricts the output so much that there is nothing to display. One
1472case where it does work, however, is when one of the classes is
1473@var{target}. For example, to display all the target-specific
1474optimization options, use:
1478@end smallexample
1480The @option{--help=} option can be repeated on the command line. Each
1481successive use displays its requested class of options, skipping
1482those that have already been displayed.
1484If the @option{-Q} option appears on the command line before the
1485@option{--help=} option, then the descriptive text displayed by
1486@option{--help=} is changed. Instead of describing the displayed
1487options, an indication is given as to whether the option is enabled,
1488disabled or set to a specific value (assuming that the compiler
1489knows this at the point where the @option{--help=} option is used).
1491Here is a truncated example from the ARM port of @command{gcc}:
1494 % gcc -Q -mabi=2 --help=target -c
1495 The following options are target specific:
1496 -mabi= 2
1497 -mabort-on-noreturn [disabled]
1498 -mapcs [disabled]
1499@end smallexample
1501The output is sensitive to the effects of previous command-line
1502options, so for example it is possible to find out which optimizations
1503are enabled at @option{-O2} by using:
1506-Q -O2 --help=optimizers
1507@end smallexample
1509Alternatively you can discover which binary optimizations are enabled
1510by @option{-O3} by using:
1513gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1514gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1515diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1516@end smallexample
1518@item -no-canonical-prefixes
1519@opindex no-canonical-prefixes
1520Do not expand any symbolic links, resolve references to @samp{/../}
1521or @samp{/./}, or make the path absolute when generating a relative
1524@item --version
1525@opindex version
1526Display the version number and copyrights of the invoked GCC@.
1528@item -wrapper
1529@opindex wrapper
1530Invoke all subcommands under a wrapper program. The name of the
1531wrapper program and its parameters are passed as a comma separated
1535gcc -c t.c -wrapper gdb,--args
1536@end smallexample
1539This invokes all subprograms of @command{gcc} under
1540@samp{gdb --args}, thus the invocation of @command{cc1} is
1541@samp{gdb --args cc1 @dots{}}.
1543@item -fplugin=@var{name}.so
1544@opindex fplugin
1545Load the plugin code in file @var{name}.so, assumed to be a
1546shared object to be dlopen'd by the compiler. The base name of
1547the shared object file is used to identify the plugin for the
1548purposes of argument parsing (See
1549@option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1550Each plugin should define the callback functions specified in the
1551Plugins API.
1553@item -fplugin-arg-@var{name}-@var{key}=@var{value}
1554@opindex fplugin-arg
1555Define an argument called @var{key} with a value of @var{value}
1556for the plugin called @var{name}.
1558@item -fdump-ada-spec@r{[}-slim@r{]}
1559@opindex fdump-ada-spec
1560For C and C++ source and include files, generate corresponding Ada specs.
1561@xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1562GNAT User's Guide}, which provides detailed documentation on this feature.
1564@item -fada-spec-parent=@var{unit}
1565@opindex fada-spec-parent
1566In conjunction with @option{-fdump-ada-spec@r{[}-slim@r{]}} above, generate
1567Ada specs as child units of parent @var{unit}.
1569@item -fdump-go-spec=@var{file}
1570@opindex fdump-go-spec
1571For input files in any language, generate corresponding Go
1572declarations in @var{file}. This generates Go @code{const},
1573@code{type}, @code{var}, and @code{func} declarations which may be a
1574useful way to start writing a Go interface to code written in some
1575other language.
1577@include @value{srcdir}/../libiberty/at-file.texi
1578@end table
1580@node Invoking G++
1581@section Compiling C++ Programs
1583@cindex suffixes for C++ source
1584@cindex C++ source file suffixes
1585C++ source files conventionally use one of the suffixes @samp{.C},
1586@samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1587@samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1588@samp{.H}, or (for shared template code) @samp{.tcc}; and
1589preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1590files with these names and compiles them as C++ programs even if you
1591call the compiler the same way as for compiling C programs (usually
1592with the name @command{gcc}).
1594@findex g++
1595@findex c++
1596However, the use of @command{gcc} does not add the C++ library.
1597@command{g++} is a program that calls GCC and automatically specifies linking
1598against the C++ library. It treats @samp{.c},
1599@samp{.h} and @samp{.i} files as C++ source files instead of C source
1600files unless @option{-x} is used. This program is also useful when
1601precompiling a C header file with a @samp{.h} extension for use in C++
1602compilations. On many systems, @command{g++} is also installed with
1603the name @command{c++}.
1605@cindex invoking @command{g++}
1606When you compile C++ programs, you may specify many of the same
1607command-line options that you use for compiling programs in any
1608language; or command-line options meaningful for C and related
1609languages; or options that are meaningful only for C++ programs.
1610@xref{C Dialect Options,,Options Controlling C Dialect}, for
1611explanations of options for languages related to C@.
1612@xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1613explanations of options that are meaningful only for C++ programs.
1615@node C Dialect Options
1616@section Options Controlling C Dialect
1617@cindex dialect options
1618@cindex language dialect options
1619@cindex options, dialect
1621The following options control the dialect of C (or languages derived
1622from C, such as C++, Objective-C and Objective-C++) that the compiler
1625@table @gcctabopt
1626@cindex ANSI support
1627@cindex ISO support
1628@item -ansi
1629@opindex ansi
1630In C mode, this is equivalent to @option{-std=c90}. In C++ mode, it is
1631equivalent to @option{-std=c++98}.
1633This turns off certain features of GCC that are incompatible with ISO
1634C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1635such as the @code{asm} and @code{typeof} keywords, and
1636predefined macros such as @code{unix} and @code{vax} that identify the
1637type of system you are using. It also enables the undesirable and
1638rarely used ISO trigraph feature. For the C compiler,
1639it disables recognition of C++ style @samp{//} comments as well as
1640the @code{inline} keyword.
1642The alternate keywords @code{__asm__}, @code{__extension__},
1643@code{__inline__} and @code{__typeof__} continue to work despite
1644@option{-ansi}. You would not want to use them in an ISO C program, of
1645course, but it is useful to put them in header files that might be included
1646in compilations done with @option{-ansi}. Alternate predefined macros
1647such as @code{__unix__} and @code{__vax__} are also available, with or
1648without @option{-ansi}.
1650The @option{-ansi} option does not cause non-ISO programs to be
1651rejected gratuitously. For that, @option{-Wpedantic} is required in
1652addition to @option{-ansi}. @xref{Warning Options}.
1654The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1655option is used. Some header files may notice this macro and refrain
1656from declaring certain functions or defining certain macros that the
1657ISO standard doesn't call for; this is to avoid interfering with any
1658programs that might use these names for other things.
1660Functions that are normally built in but do not have semantics
1661defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1662functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1663built-in functions provided by GCC}, for details of the functions
1666@item -std=
1667@opindex std
1668Determine the language standard. @xref{Standards,,Language Standards
1669Supported by GCC}, for details of these standard versions. This option
1670is currently only supported when compiling C or C++.
1672The compiler can accept several base standards, such as @samp{c90} or
1673@samp{c++98}, and GNU dialects of those standards, such as
1674@samp{gnu90} or @samp{gnu++98}. When a base standard is specified, the
1675compiler accepts all programs following that standard plus those
1676using GNU extensions that do not contradict it. For example,
1677@option{-std=c90} turns off certain features of GCC that are
1678incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1679keywords, but not other GNU extensions that do not have a meaning in
1680ISO C90, such as omitting the middle term of a @code{?:}
1681expression. On the other hand, when a GNU dialect of a standard is
1682specified, all features supported by the compiler are enabled, even when
1683those features change the meaning of the base standard. As a result, some
1684strict-conforming programs may be rejected. The particular standard
1685is used by @option{-Wpedantic} to identify which features are GNU
1686extensions given that version of the standard. For example
1687@option{-std=gnu90 -Wpedantic} warns about C++ style @samp{//}
1688comments, while @option{-std=gnu99 -Wpedantic} does not.
1690A value for this option must be provided; possible values are
1692@table @samp
1693@item c90
1694@itemx c89
1695@itemx iso9899:1990
1696Support all ISO C90 programs (certain GNU extensions that conflict
1697with ISO C90 are disabled). Same as @option{-ansi} for C code.
1699@item iso9899:199409
1700ISO C90 as modified in amendment 1.
1702@item c99
1703@itemx c9x
1704@itemx iso9899:1999
1705@itemx iso9899:199x
1706ISO C99. This standard is substantially completely supported, modulo
1707bugs and floating-point issues
1708(mainly but not entirely relating to optional C99 features from
1709Annexes F and G). See
1710@w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1711names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1713@item c11
1714@itemx c1x
1715@itemx iso9899:2011
1716ISO C11, the 2011 revision of the ISO C standard. This standard is
1717substantially completely supported, modulo bugs, floating-point issues
1718(mainly but not entirely relating to optional C11 features from
1719Annexes F and G) and the optional Annexes K (Bounds-checking
1720interfaces) and L (Analyzability). The name @samp{c1x} is deprecated.
1722@item gnu90
1723@itemx gnu89
1724GNU dialect of ISO C90 (including some C99 features).
1726@item gnu99
1727@itemx gnu9x
1728GNU dialect of ISO C99. The name @samp{gnu9x} is deprecated.
1730@item gnu11
1731@itemx gnu1x
1732GNU dialect of ISO C11. This is the default for C code.
1733The name @samp{gnu1x} is deprecated.
1735@item c++98
1736@itemx c++03
1737The 1998 ISO C++ standard plus the 2003 technical corrigendum and some
1738additional defect reports. Same as @option{-ansi} for C++ code.
1740@item gnu++98
1741@itemx gnu++03
1742GNU dialect of @option{-std=c++98}. This is the default for
1743C++ code.
1745@item c++11
1746@itemx c++0x
1747The 2011 ISO C++ standard plus amendments.
1748The name @samp{c++0x} is deprecated.
1750@item gnu++11
1751@itemx gnu++0x
1752GNU dialect of @option{-std=c++11}.
1753The name @samp{gnu++0x} is deprecated.
1755@item c++14
1756@itemx c++1y
1757The 2014 ISO C++ standard plus amendments.
1758The name @samp{c++1y} is deprecated.
1760@item gnu++14
1761@itemx gnu++1y
1762GNU dialect of @option{-std=c++14}.
1763The name @samp{gnu++1y} is deprecated.
1765@item c++1z
1766The next revision of the ISO C++ standard, tentatively planned for
17672017. Support is highly experimental, and will almost certainly
1768change in incompatible ways in future releases.
1770@item gnu++1z
1771GNU dialect of @option{-std=c++1z}. Support is highly experimental,
1772and will almost certainly change in incompatible ways in future
1774@end table
1776@item -fgnu89-inline
1777@opindex fgnu89-inline
1778The option @option{-fgnu89-inline} tells GCC to use the traditional
1779GNU semantics for @code{inline} functions when in C99 mode.
1780@xref{Inline,,An Inline Function is As Fast As a Macro}.
1781Using this option is roughly equivalent to adding the
1782@code{gnu_inline} function attribute to all inline functions
1783(@pxref{Function Attributes}).
1785The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1786C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1787specifies the default behavior).
1788This option is not supported in @option{-std=c90} or
1789@option{-std=gnu90} mode.
1791The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1792@code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1793in effect for @code{inline} functions. @xref{Common Predefined
1794Macros,,,cpp,The C Preprocessor}.
1796@item -aux-info @var{filename}
1797@opindex aux-info
1798Output to the given filename prototyped declarations for all functions
1799declared and/or defined in a translation unit, including those in header
1800files. This option is silently ignored in any language other than C@.
1802Besides declarations, the file indicates, in comments, the origin of
1803each declaration (source file and line), whether the declaration was
1804implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1805@samp{O} for old, respectively, in the first character after the line
1806number and the colon), and whether it came from a declaration or a
1807definition (@samp{C} or @samp{F}, respectively, in the following
1808character). In the case of function definitions, a K&R-style list of
1809arguments followed by their declarations is also provided, inside
1810comments, after the declaration.
1812@item -fallow-parameterless-variadic-functions
1813@opindex fallow-parameterless-variadic-functions
1814Accept variadic functions without named parameters.
1816Although it is possible to define such a function, this is not very
1817useful as it is not possible to read the arguments. This is only
1818supported for C as this construct is allowed by C++.
1820@item -fno-asm
1821@opindex fno-asm
1822Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1823keyword, so that code can use these words as identifiers. You can use
1824the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1825instead. @option{-ansi} implies @option{-fno-asm}.
1827In C++, this switch only affects the @code{typeof} keyword, since
1828@code{asm} and @code{inline} are standard keywords. You may want to
1829use the @option{-fno-gnu-keywords} flag instead, which has the same
1830effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1831switch only affects the @code{asm} and @code{typeof} keywords, since
1832@code{inline} is a standard keyword in ISO C99.
1834@item -fno-builtin
1835@itemx -fno-builtin-@var{function}
1836@opindex fno-builtin
1837@cindex built-in functions
1838Don't recognize built-in functions that do not begin with
1839@samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1840functions provided by GCC}, for details of the functions affected,
1841including those which are not built-in functions when @option{-ansi} or
1842@option{-std} options for strict ISO C conformance are used because they
1843do not have an ISO standard meaning.
1845GCC normally generates special code to handle certain built-in functions
1846more efficiently; for instance, calls to @code{alloca} may become single
1847instructions which adjust the stack directly, and calls to @code{memcpy}
1848may become inline copy loops. The resulting code is often both smaller
1849and faster, but since the function calls no longer appear as such, you
1850cannot set a breakpoint on those calls, nor can you change the behavior
1851of the functions by linking with a different library. In addition,
1852when a function is recognized as a built-in function, GCC may use
1853information about that function to warn about problems with calls to
1854that function, or to generate more efficient code, even if the
1855resulting code still contains calls to that function. For example,
1856warnings are given with @option{-Wformat} for bad calls to
1857@code{printf} when @code{printf} is built in and @code{strlen} is
1858known not to modify global memory.
1860With the @option{-fno-builtin-@var{function}} option
1861only the built-in function @var{function} is
1862disabled. @var{function} must not begin with @samp{__builtin_}. If a
1863function is named that is not built-in in this version of GCC, this
1864option is ignored. There is no corresponding
1865@option{-fbuiltin-@var{function}} option; if you wish to enable
1866built-in functions selectively when using @option{-fno-builtin} or
1867@option{-ffreestanding}, you may define macros such as:
1870#define abs(n) __builtin_abs ((n))
1871#define strcpy(d, s) __builtin_strcpy ((d), (s))
1872@end smallexample
1874@item -fhosted
1875@opindex fhosted
1876@cindex hosted environment
1878Assert that compilation targets a hosted environment. This implies
1879@option{-fbuiltin}. A hosted environment is one in which the
1880entire standard library is available, and in which @code{main} has a return
1881type of @code{int}. Examples are nearly everything except a kernel.
1882This is equivalent to @option{-fno-freestanding}.
1884@item -ffreestanding
1885@opindex ffreestanding
1886@cindex hosted environment
1888Assert that compilation targets a freestanding environment. This
1889implies @option{-fno-builtin}. A freestanding environment
1890is one in which the standard library may not exist, and program startup may
1891not necessarily be at @code{main}. The most obvious example is an OS kernel.
1892This is equivalent to @option{-fno-hosted}.
1894@xref{Standards,,Language Standards Supported by GCC}, for details of
1895freestanding and hosted environments.
1897@item -fopenacc
1898@opindex fopenacc
1899@cindex OpenACC accelerator programming
1900Enable handling of OpenACC directives @code{#pragma acc} in C/C++ and
1901@code{!$acc} in Fortran. When @option{-fopenacc} is specified, the
1902compiler generates accelerated code according to the OpenACC Application
1903Programming Interface v2.0 @w{@uref{http://www.openacc.org/}}. This option
1904implies @option{-pthread}, and thus is only supported on targets that
1905have support for @option{-pthread}.
1907Note that this is an experimental feature, incomplete, and subject to
1908change in future versions of GCC. See
1909@w{@uref{https://gcc.gnu.org/wiki/OpenACC}} for more information.
1911@item -fopenmp
1912@opindex fopenmp
1913@cindex OpenMP parallel
1914Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1915@code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1916compiler generates parallel code according to the OpenMP Application
1917Program Interface v4.0 @w{@uref{http://www.openmp.org/}}. This option
1918implies @option{-pthread}, and thus is only supported on targets that
1919have support for @option{-pthread}. @option{-fopenmp} implies
1922@item -fopenmp-simd
1923@opindex fopenmp-simd
1924@cindex OpenMP SIMD
1925@cindex SIMD
1926Enable handling of OpenMP's SIMD directives with @code{#pragma omp}
1927in C/C++ and @code{!$omp} in Fortran. Other OpenMP directives
1928are ignored.
1930@item -fcilkplus
1931@opindex fcilkplus
1932@cindex Enable Cilk Plus
1933Enable the usage of Cilk Plus language extension features for C/C++.
1934When the option @option{-fcilkplus} is specified, enable the usage of
1935the Cilk Plus Language extension features for C/C++. The present
1936implementation follows ABI version 1.2. This is an experimental
1937feature that is only partially complete, and whose interface may
1938change in future versions of GCC as the official specification
1939changes. Currently, all features but @code{_Cilk_for} have been
1942@item -fgnu-tm
1943@opindex fgnu-tm
1944When the option @option{-fgnu-tm} is specified, the compiler
1945generates code for the Linux variant of Intel's current Transactional
1946Memory ABI specification document (Revision 1.1, May 6 2009). This is
1947an experimental feature whose interface may change in future versions
1948of GCC, as the official specification changes. Please note that not
1949all architectures are supported for this feature.
1951For more information on GCC's support for transactional memory,
1952@xref{Enabling libitm,,The GNU Transactional Memory Library,libitm,GNU
1953Transactional Memory Library}.
1955Note that the transactional memory feature is not supported with
1956non-call exceptions (@option{-fnon-call-exceptions}).
1958@item -fms-extensions
1959@opindex fms-extensions
1960Accept some non-standard constructs used in Microsoft header files.
1962In C++ code, this allows member names in structures to be similar
1963to previous types declarations.
1966typedef int UOW;
1967struct ABC @{
1968 UOW UOW;
1970@end smallexample
1972Some cases of unnamed fields in structures and unions are only
1973accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1974fields within structs/unions}, for details.
1976Note that this option is off for all targets but x86
1977targets using ms-abi.
1979@item -fplan9-extensions
1980@opindex fplan9-extensions
1981Accept some non-standard constructs used in Plan 9 code.
1983This enables @option{-fms-extensions}, permits passing pointers to
1984structures with anonymous fields to functions that expect pointers to
1985elements of the type of the field, and permits referring to anonymous
1986fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1987struct/union fields within structs/unions}, for details. This is only
1988supported for C, not C++.
1990@item -trigraphs
1991@opindex trigraphs
1992Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1993options for strict ISO C conformance) implies @option{-trigraphs}.
1995@cindex traditional C language
1996@cindex C language, traditional
1997@item -traditional
1998@itemx -traditional-cpp
1999@opindex traditional-cpp
2000@opindex traditional
2001Formerly, these options caused GCC to attempt to emulate a pre-standard
2002C compiler. They are now only supported with the @option{-E} switch.
2003The preprocessor continues to support a pre-standard mode. See the GNU
2004CPP manual for details.
2006@item -fcond-mismatch
2007@opindex fcond-mismatch
2008Allow conditional expressions with mismatched types in the second and
2009third arguments. The value of such an expression is void. This option
2010is not supported for C++.
2012@item -flax-vector-conversions
2013@opindex flax-vector-conversions
2014Allow implicit conversions between vectors with differing numbers of
2015elements and/or incompatible element types. This option should not be
2016used for new code.
2018@item -funsigned-char
2019@opindex funsigned-char
2020Let the type @code{char} be unsigned, like @code{unsigned char}.
2022Each kind of machine has a default for what @code{char} should
2023be. It is either like @code{unsigned char} by default or like
2024@code{signed char} by default.
2026Ideally, a portable program should always use @code{signed char} or
2027@code{unsigned char} when it depends on the signedness of an object.
2028But many programs have been written to use plain @code{char} and
2029expect it to be signed, or expect it to be unsigned, depending on the
2030machines they were written for. This option, and its inverse, let you
2031make such a program work with the opposite default.
2033The type @code{char} is always a distinct type from each of
2034@code{signed char} or @code{unsigned char}, even though its behavior
2035is always just like one of those two.
2037@item -fsigned-char
2038@opindex fsigned-char
2039Let the type @code{char} be signed, like @code{signed char}.
2041Note that this is equivalent to @option{-fno-unsigned-char}, which is
2042the negative form of @option{-funsigned-char}. Likewise, the option
2043@option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
2045@item -fsigned-bitfields
2046@itemx -funsigned-bitfields
2047@itemx -fno-signed-bitfields
2048@itemx -fno-unsigned-bitfields
2049@opindex fsigned-bitfields
2050@opindex funsigned-bitfields
2051@opindex fno-signed-bitfields
2052@opindex fno-unsigned-bitfields
2053These options control whether a bit-field is signed or unsigned, when the
2054declaration does not use either @code{signed} or @code{unsigned}. By
2055default, such a bit-field is signed, because this is consistent: the
2056basic integer types such as @code{int} are signed types.
2057@end table
2059@node C++ Dialect Options
2060@section Options Controlling C++ Dialect
2062@cindex compiler options, C++
2063@cindex C++ options, command-line
2064@cindex options, C++
2065This section describes the command-line options that are only meaningful
2066for C++ programs. You can also use most of the GNU compiler options
2067regardless of what language your program is in. For example, you
2068might compile a file @file{firstClass.C} like this:
2071g++ -g -frepo -O -c firstClass.C
2072@end smallexample
2075In this example, only @option{-frepo} is an option meant
2076only for C++ programs; you can use the other options with any
2077language supported by GCC@.
2079Here is a list of options that are @emph{only} for compiling C++ programs:
2081@table @gcctabopt
2083@item -fabi-version=@var{n}
2084@opindex fabi-version
2085Use version @var{n} of the C++ ABI@. The default is version 0.
2087Version 0 refers to the version conforming most closely to
2088the C++ ABI specification. Therefore, the ABI obtained using version 0
2089will change in different versions of G++ as ABI bugs are fixed.
2091Version 1 is the version of the C++ ABI that first appeared in G++ 3.2.
2093Version 2 is the version of the C++ ABI that first appeared in G++
20943.4, and was the default through G++ 4.9.
2096Version 3 corrects an error in mangling a constant address as a
2097template argument.
2099Version 4, which first appeared in G++ 4.5, implements a standard
2100mangling for vector types.
2102Version 5, which first appeared in G++ 4.6, corrects the mangling of
2103attribute const/volatile on function pointer types, decltype of a
2104plain decl, and use of a function parameter in the declaration of
2105another parameter.
2107Version 6, which first appeared in G++ 4.7, corrects the promotion
2108behavior of C++11 scoped enums and the mangling of template argument
2109packs, const/static_cast, prefix ++ and --, and a class scope function
2110used as a template argument.
2112Version 7, which first appeared in G++ 4.8, that treats nullptr_t as a
2113builtin type and corrects the mangling of lambdas in default argument
2116Version 8, which first appeared in G++ 4.9, corrects the substitution
2117behavior of function types with function-cv-qualifiers.
2119See also @option{-Wabi}.
2121@item -fabi-compat-version=@var{n}
2122@opindex fabi-compat-version
f09a3553 2123On targets that support strong aliases, G++
2124works around mangling changes by creating an alias with the correct
2125mangled name when defining a symbol with an incorrect mangled name.
2126This switch specifies which ABI version to use for the alias.
2128With @option{-fabi-version=0} (the default), this defaults to 2. If
2129another ABI version is explicitly selected, this defaults to 0.
2131The compatibility version is also set by @option{-Wabi=@var{n}}.
2133@item -fno-access-control
2134@opindex fno-access-control
2135Turn off all access checking. This switch is mainly useful for working
2136around bugs in the access control code.
2138@item -fcheck-new
2139@opindex fcheck-new
2140Check that the pointer returned by @code{operator new} is non-null
2141before attempting to modify the storage allocated. This check is
2142normally unnecessary because the C++ standard specifies that
2143@code{operator new} only returns @code{0} if it is declared
2144@code{throw()}, in which case the compiler always checks the
2145return value even without this option. In all other cases, when
2146@code{operator new} has a non-empty exception specification, memory
2147exhaustion is signalled by throwing @code{std::bad_alloc}. See also
2148@samp{new (nothrow)}.
2150@item -fconstexpr-depth=@var{n}
2151@opindex fconstexpr-depth
2152Set the maximum nested evaluation depth for C++11 constexpr functions
2153to @var{n}. A limit is needed to detect endless recursion during
2154constant expression evaluation. The minimum specified by the standard
2155is 512.
2157@item -fdeduce-init-list
2158@opindex fdeduce-init-list
2159Enable deduction of a template type parameter as
2160@code{std::initializer_list} from a brace-enclosed initializer list, i.e.@:
2163template <class T> auto forward(T t) -> decltype (realfn (t))
2165 return realfn (t);
2168void f()
2170 forward(@{1,2@}); // call forward<std::initializer_list<int>>
2172@end smallexample
2174This deduction was implemented as a possible extension to the
2175originally proposed semantics for the C++11 standard, but was not part
2176of the final standard, so it is disabled by default. This option is
2177deprecated, and may be removed in a future version of G++.
2179@item -ffriend-injection
2180@opindex ffriend-injection
2181Inject friend functions into the enclosing namespace, so that they are
2182visible outside the scope of the class in which they are declared.
2183Friend functions were documented to work this way in the old Annotated
2184C++ Reference Manual.
2185However, in ISO C++ a friend function that is not declared
dda118e3 2186in an enclosing scope can only be found using argument dependent
f09a3553 2187lookup. GCC defaults to the standard behavior.
2189This option is for compatibility, and may be removed in a future
2190release of G++.
2192@item -fno-elide-constructors
2193@opindex fno-elide-constructors
2194The C++ standard allows an implementation to omit creating a temporary
2195that is only used to initialize another object of the same type.
2196Specifying this option disables that optimization, and forces G++ to
2197call the copy constructor in all cases.
2199@item -fno-enforce-eh-specs
2200@opindex fno-enforce-eh-specs
2201Don't generate code to check for violation of exception specifications
2202at run time. This option violates the C++ standard, but may be useful
2203for reducing code size in production builds, much like defining
2204@code{NDEBUG}. This does not give user code permission to throw
2205exceptions in violation of the exception specifications; the compiler
2206still optimizes based on the specifications, so throwing an
2207unexpected exception results in undefined behavior at run time.
2209@item -fextern-tls-init
2210@itemx -fno-extern-tls-init
2211@opindex fextern-tls-init
2212@opindex fno-extern-tls-init
2213The C++11 and OpenMP standards allow @code{thread_local} and
2214@code{threadprivate} variables to have dynamic (runtime)
2215initialization. To support this, any use of such a variable goes
2216through a wrapper function that performs any necessary initialization.
2217When the use and definition of the variable are in the same
2218translation unit, this overhead can be optimized away, but when the
2219use is in a different translation unit there is significant overhead
2220even if the variable doesn't actually need dynamic initialization. If
2221the programmer can be sure that no use of the variable in a
2222non-defining TU needs to trigger dynamic initialization (either
2223because the variable is statically initialized, or a use of the
2224variable in the defining TU will be executed before any uses in
2225another TU), they can avoid this overhead with the
2226@option{-fno-extern-tls-init} option.
2228On targets that support symbol aliases, the default is
2229@option{-fextern-tls-init}. On targets that do not support symbol
2230aliases, the default is @option{-fno-extern-tls-init}.
2232@item -ffor-scope
2233@itemx -fno-for-scope
2234@opindex ffor-scope
2235@opindex fno-for-scope
2236If @option{-ffor-scope} is specified, the scope of variables declared in
2237a @i{for-init-statement} is limited to the @code{for} loop itself,
2238as specified by the C++ standard.
2239If @option{-fno-for-scope} is specified, the scope of variables declared in
2240a @i{for-init-statement} extends to the end of the enclosing scope,
2241as was the case in old versions of G++, and other (traditional)
2242implementations of C++.
2244If neither flag is given, the default is to follow the standard,
2245but to allow and give a warning for old-style code that would
2246otherwise be invalid, or have different behavior.
2248@item -fno-gnu-keywords
2249@opindex fno-gnu-keywords
2250Do not recognize @code{typeof} as a keyword, so that code can use this
2251word as an identifier. You can use the keyword @code{__typeof__} instead.
2252@option{-ansi} implies @option{-fno-gnu-keywords}.
2254@item -fno-implicit-templates
2255@opindex fno-implicit-templates
2256Never emit code for non-inline templates that are instantiated
2257implicitly (i.e.@: by use); only emit code for explicit instantiations.
2258@xref{Template Instantiation}, for more information.
2260@item -fno-implicit-inline-templates
2261@opindex fno-implicit-inline-templates
2262Don't emit code for implicit instantiations of inline templates, either.
2263The default is to handle inlines differently so that compiles with and
2264without optimization need the same set of explicit instantiations.
2266@item -fno-implement-inlines
2267@opindex fno-implement-inlines
2268To save space, do not emit out-of-line copies of inline functions
2269controlled by @code{#pragma implementation}. This causes linker
2270errors if these functions are not inlined everywhere they are called.
2272@item -fms-extensions
2273@opindex fms-extensions
2274Disable Wpedantic warnings about constructs used in MFC, such as implicit
2275int and getting a pointer to member function via non-standard syntax.
2277@item -fno-nonansi-builtins
2278@opindex fno-nonansi-builtins
2279Disable built-in declarations of functions that are not mandated by
2280ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
2281@code{index}, @code{bzero}, @code{conjf}, and other related functions.
2283@item -fnothrow-opt
2284@opindex fnothrow-opt
2285Treat a @code{throw()} exception specification as if it were a
2286@code{noexcept} specification to reduce or eliminate the text size
2287overhead relative to a function with no exception specification. If
2288the function has local variables of types with non-trivial
2289destructors, the exception specification actually makes the
2290function smaller because the EH cleanups for those variables can be
2291optimized away. The semantic effect is that an exception thrown out of
2292a function with such an exception specification results in a call
2293to @code{terminate} rather than @code{unexpected}.
2295@item -fno-operator-names
2296@opindex fno-operator-names
2297Do not treat the operator name keywords @code{and}, @code{bitand},
2298@code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2299synonyms as keywords.
2301@item -fno-optional-diags
2302@opindex fno-optional-diags
2303Disable diagnostics that the standard says a compiler does not need to
2304issue. Currently, the only such diagnostic issued by G++ is the one for
2305a name having multiple meanings within a class.
2307@item -fpermissive
2308@opindex fpermissive
2309Downgrade some diagnostics about nonconformant code from errors to
2310warnings. Thus, using @option{-fpermissive} allows some
2311nonconforming code to compile.
2313@item -fno-pretty-templates
2314@opindex fno-pretty-templates
2315When an error message refers to a specialization of a function
2316template, the compiler normally prints the signature of the
2317template followed by the template arguments and any typedefs or
2318typenames in the signature (e.g. @code{void f(T) [with T = int]}
2319rather than @code{void f(int)}) so that it's clear which template is
2320involved. When an error message refers to a specialization of a class
2321template, the compiler omits any template arguments that match
2322the default template arguments for that template. If either of these
2323behaviors make it harder to understand the error message rather than
2324easier, you can use @option{-fno-pretty-templates} to disable them.
2326@item -frepo
2327@opindex frepo
2328Enable automatic template instantiation at link time. This option also
2329implies @option{-fno-implicit-templates}. @xref{Template
2330Instantiation}, for more information.
2332@item -fno-rtti
2333@opindex fno-rtti
2334Disable generation of information about every class with virtual
2335functions for use by the C++ run-time type identification features
2336(@code{dynamic_cast} and @code{typeid}). If you don't use those parts
2337of the language, you can save some space by using this flag. Note that
2338exception handling uses the same information, but G++ generates it as
2339needed. The @code{dynamic_cast} operator can still be used for casts that
2340do not require run-time type information, i.e.@: casts to @code{void *} or to
2341unambiguous base classes.
2343@item -fsized-deallocation
2344@opindex fsized-deallocation
2345Enable the built-in global declarations
2347void operator delete (void *, std::size_t) noexcept;
2348void operator delete[] (void *, std::size_t) noexcept;
2349@end smallexample
2350as introduced in C++14. This is useful for user-defined replacement
2351deallocation functions that, for example, use the size of the object
2352to make deallocation faster. Enabled by default under
2353@option{-std=c++14} and above. The flag @option{-Wsized-deallocation}
2354warns about places that might want to add a definition.
2356@item -fstats
2357@opindex fstats
2358Emit statistics about front-end processing at the end of the compilation.
2359This information is generally only useful to the G++ development team.
2361@item -fstrict-enums
2362@opindex fstrict-enums
2363Allow the compiler to optimize using the assumption that a value of
2364enumerated type can only be one of the values of the enumeration (as
2365defined in the C++ standard; basically, a value that can be
2366represented in the minimum number of bits needed to represent all the
2367enumerators). This assumption may not be valid if the program uses a
2368cast to convert an arbitrary integer value to the enumerated type.
2370@item -ftemplate-backtrace-limit=@var{n}
2371@opindex ftemplate-backtrace-limit
2372Set the maximum number of template instantiation notes for a single
2373warning or error to @var{n}. The default value is 10.
2375@item -ftemplate-depth=@var{n}
2376@opindex ftemplate-depth
2377Set the maximum instantiation depth for template classes to @var{n}.
2378A limit on the template instantiation depth is needed to detect
2379endless recursions during template class instantiation. ANSI/ISO C++
2380conforming programs must not rely on a maximum depth greater than 17
2381(changed to 1024 in C++11). The default value is 900, as the compiler
2382can run out of stack space before hitting 1024 in some situations.
2384@item -fno-threadsafe-statics
2385@opindex fno-threadsafe-statics
2386Do not emit the extra code to use the routines specified in the C++
2387ABI for thread-safe initialization of local statics. You can use this
2388option to reduce code size slightly in code that doesn't need to be
2391@item -fuse-cxa-atexit
2392@opindex fuse-cxa-atexit
2393Register destructors for objects with static storage duration with the
2394@code{__cxa_atexit} function rather than the @code{atexit} function.
2395This option is required for fully standards-compliant handling of static
2396destructors, but only works if your C library supports
2399@item -fno-use-cxa-get-exception-ptr
2400@opindex fno-use-cxa-get-exception-ptr
2401Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2402causes @code{std::uncaught_exception} to be incorrect, but is necessary
2403if the runtime routine is not available.
2405@item -fvisibility-inlines-hidden
2406@opindex fvisibility-inlines-hidden
2407This switch declares that the user does not attempt to compare
2408pointers to inline functions or methods where the addresses of the two functions
2409are taken in different shared objects.
2411The effect of this is that GCC may, effectively, mark inline methods with
2412@code{__attribute__ ((visibility ("hidden")))} so that they do not
2413appear in the export table of a DSO and do not require a PLT indirection
2414when used within the DSO@. Enabling this option can have a dramatic effect
2415on load and link times of a DSO as it massively reduces the size of the
2416dynamic export table when the library makes heavy use of templates.
2418The behavior of this switch is not quite the same as marking the
2419methods as hidden directly, because it does not affect static variables
2420local to the function or cause the compiler to deduce that
2421the function is defined in only one shared object.
2423You may mark a method as having a visibility explicitly to negate the
2424effect of the switch for that method. For example, if you do want to
2425compare pointers to a particular inline method, you might mark it as
2426having default visibility. Marking the enclosing class with explicit
2427visibility has no effect.
2429Explicitly instantiated inline methods are unaffected by this option
2430as their linkage might otherwise cross a shared library boundary.
2431@xref{Template Instantiation}.
2433@item -fvisibility-ms-compat
2434@opindex fvisibility-ms-compat
2435This flag attempts to use visibility settings to make GCC's C++
2436linkage model compatible with that of Microsoft Visual Studio.
2438The flag makes these changes to GCC's linkage model:
2442It sets the default visibility to @code{hidden}, like
2446Types, but not their members, are not hidden by default.
2449The One Definition Rule is relaxed for types without explicit
2450visibility specifications that are defined in more than one
2451shared object: those declarations are permitted if they are
2452permitted when this option is not used.
2453@end enumerate
2455In new code it is better to use @option{-fvisibility=hidden} and
2456export those classes that are intended to be externally visible.
2457Unfortunately it is possible for code to rely, perhaps accidentally,
2458on the Visual Studio behavior.
2460Among the consequences of these changes are that static data members
2461of the same type with the same name but defined in different shared
2462objects are different, so changing one does not change the other;
2463and that pointers to function members defined in different shared
2464objects may not compare equal. When this flag is given, it is a
2465violation of the ODR to define types with the same name differently.
2467@item -fvtable-verify=@r{[}std@r{|}preinit@r{|}none@r{]}
2468@opindex fvtable-verify
2469Turn on (or off, if using @option{-fvtable-verify=none}) the security
2470feature that verifies at run time, for every virtual call, that
2471the vtable pointer through which the call is made is valid for the type of
2472the object, and has not been corrupted or overwritten. If an invalid vtable
2473pointer is detected at run time, an error is reported and execution of the
2474program is immediately halted.
2476This option causes run-time data structures to be built at program startup,
2477which are used for verifying the vtable pointers.
2478The options @samp{std} and @samp{preinit}
2479control the timing of when these data structures are built. In both cases the
2480data structures are built before execution reaches @code{main}. Using
2481@option{-fvtable-verify=std} causes the data structures to be built after
2482shared libraries have been loaded and initialized.
2483@option{-fvtable-verify=preinit} causes them to be built before shared
2484libraries have been loaded and initialized.
2486If this option appears multiple times in the command line with different
2487values specified, @samp{none} takes highest priority over both @samp{std} and
2488@samp{preinit}; @samp{preinit} takes priority over @samp{std}.
2490@item -fvtv-debug
2491@opindex fvtv-debug
2492When used in conjunction with @option{-fvtable-verify=std} or
2493@option{-fvtable-verify=preinit}, causes debug versions of the
2494runtime functions for the vtable verification feature to be called.
2495This flag also causes the compiler to log information about which
2496vtable pointers it finds for each class.
2497This information is written to a file named @file{vtv_set_ptr_data.log}
2498in the directory named by the environment variable @env{VTV_LOGS_DIR}
2499if that is defined or the current working directory otherwise.
2501Note: This feature @emph{appends} data to the log file. If you want a fresh log
2502file, be sure to delete any existing one.
2504@item -fvtv-counts
2505@opindex fvtv-counts
2506This is a debugging flag. When used in conjunction with
2507@option{-fvtable-verify=std} or @option{-fvtable-verify=preinit}, this
2508causes the compiler to keep track of the total number of virtual calls
2509it encounters and the number of verifications it inserts. It also
2510counts the number of calls to certain run-time library functions
2511that it inserts and logs this information for each compilation unit.
2512The compiler writes this information to a file named
2513@file{vtv_count_data.log} in the directory named by the environment
2514variable @env{VTV_LOGS_DIR} if that is defined or the current working
2515directory otherwise. It also counts the size of the vtable pointer sets
2516for each class, and writes this information to @file{vtv_class_set_sizes.log}
2517in the same directory.
2519Note: This feature @emph{appends} data to the log files. To get fresh log
2520files, be sure to delete any existing ones.
2522@item -fno-weak
2523@opindex fno-weak
2524Do not use weak symbol support, even if it is provided by the linker.
2525By default, G++ uses weak symbols if they are available. This
2526option exists only for testing, and should not be used by end-users;
2527it results in inferior code and has no benefits. This option may
2528be removed in a future release of G++.
2530@item -nostdinc++
2531@opindex nostdinc++
2532Do not search for header files in the standard directories specific to
2533C++, but do still search the other standard directories. (This option
2534is used when building the C++ library.)
2535@end table
2537In addition, these optimization, warning, and code generation options
2538have meanings only for C++ programs:
2540@table @gcctabopt
2541@item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2542@opindex Wabi
2543@opindex Wno-abi
2544When an explicit @option{-fabi-version=@var{n}} option is used, causes
2545G++ to warn when it generates code that is probably not compatible with the
2546vendor-neutral C++ ABI@. Since G++ now defaults to
2547@option{-fabi-version=0}, @option{-Wabi} has no effect unless either
2548an older ABI version is selected (with @option{-fabi-version=@var{n}})
2549or an older compatibility version is selected (with
2550@option{-Wabi=@var{n}} or @option{-fabi-compat-version=@var{n}}).
2552Although an effort has been made to warn about
2553all such cases, there are probably some cases that are not warned about,
2554even though G++ is generating incompatible code. There may also be
2555cases where warnings are emitted even though the code that is generated
2556is compatible.
2558You should rewrite your code to avoid these warnings if you are
2559concerned about the fact that code generated by G++ may not be binary
2560compatible with code generated by other compilers.
2562@option{-Wabi} can also be used with an explicit version number to
2563warn about compatibility with a particular @option{-fabi-version}
2564level, e.g. @option{-Wabi=2} to warn about changes relative to
2565@option{-fabi-version=2}. Specifying a version number also sets
2568The known incompatibilities in @option{-fabi-version=2} (which was the
2569default from GCC 3.4 to 4.9) include:
2571@itemize @bullet
2574A template with a non-type template parameter of reference type was
2575mangled incorrectly:
2577extern int N;
2578template <int &> struct S @{@};
2579void n (S<N>) @{2@}
2580@end smallexample
2582This was fixed in @option{-fabi-version=3}.
2585SIMD vector types declared using @code{__attribute ((vector_size))} were
2586mangled in a non-standard way that does not allow for overloading of
2587functions taking vectors of different sizes.
2589The mangling was changed in @option{-fabi-version=4}.
2592@code{__attribute ((const))} and @code{noreturn} were mangled as type
2593qualifiers, and @code{decltype} of a plain declaration was folded away.
2595These mangling issues were fixed in @option{-fabi-version=5}.
2598Scoped enumerators passed as arguments to a variadic function are
2599promoted like unscoped enumerators, causing @code{va_arg} to complain.
2600On most targets this does not actually affect the parameter passing
2601ABI, as there is no way to pass an argument smaller than @code{int}.
2603Also, the ABI changed the mangling of template argument packs,
2604@code{const_cast}, @code{static_cast}, prefix increment/decrement, and
2605a class scope function used as a template argument.
2607These issues were corrected in @option{-fabi-version=6}.
2610Lambdas in default argument scope were mangled incorrectly, and the
2611ABI changed the mangling of @code{nullptr_t}.
2613These issues were corrected in @option{-fabi-version=7}.
2616When mangling a function type with function-cv-qualifiers, the
2617un-qualified function type was incorrectly treated as a substitution
2620This was fixed in @option{-fabi-version=8}.
2621@end itemize
2623It also warns about psABI-related changes. The known psABI changes at this
2624point include:
2626@itemize @bullet
2629For SysV/x86-64, unions with @code{long double} members are
2630passed in memory as specified in psABI. For example:
2633union U @{
2634 long double ld;
2635 int i;
2637@end smallexample
2640@code{union U} is always passed in memory.
2642@end itemize
2644@item -Wabi-tag @r{(C++ and Objective-C++ only)}
2645@opindex Wabi-tag
2646@opindex -Wabi-tag
2647Warn when a type with an ABI tag is used in a context that does not
2648have that ABI tag. See @ref{C++ Attributes} for more information
2649about ABI tags.
2651@item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2652@opindex Wctor-dtor-privacy
2653@opindex Wno-ctor-dtor-privacy
2654Warn when a class seems unusable because all the constructors or
2655destructors in that class are private, and it has neither friends nor
2656public static member functions. Also warn if there are no non-private
2657methods, and there's at least one private member function that isn't
2658a constructor or destructor.
2660@item -Wdelete-non-virtual-dtor @r{(C++ and Objective-C++ only)}
2661@opindex Wdelete-non-virtual-dtor
2662@opindex Wno-delete-non-virtual-dtor
2663Warn when @code{delete} is used to destroy an instance of a class that
2664has virtual functions and non-virtual destructor. It is unsafe to delete
2665an instance of a derived class through a pointer to a base class if the
2666base class does not have a virtual destructor. This warning is enabled
2667by @option{-Wall}.
2669@item -Wliteral-suffix @r{(C++ and Objective-C++ only)}
2670@opindex Wliteral-suffix
2671@opindex Wno-literal-suffix
2672Warn when a string or character literal is followed by a ud-suffix which does
2673not begin with an underscore. As a conforming extension, GCC treats such
2674suffixes as separate preprocessing tokens in order to maintain backwards
2675compatibility with code that uses formatting macros from @code{<inttypes.h>}.
2676For example:
2679#define __STDC_FORMAT_MACROS
2680#include <inttypes.h>
2681#include <stdio.h>
2683int main() @{
2684 int64_t i64 = 123;
2685 printf("My int64: %"PRId64"\n", i64);
2687@end smallexample
2689In this case, @code{PRId64} is treated as a separate preprocessing token.
2691This warning is enabled by default.
2693@item -Wnarrowing @r{(C++ and Objective-C++ only)}
2694@opindex Wnarrowing
2695@opindex Wno-narrowing
2696Warn when a narrowing conversion prohibited by C++11 occurs within
2697@samp{@{ @}}, e.g.
2700int i = @{ 2.2 @}; // error: narrowing from double to int
2701@end smallexample
2703This flag is included in @option{-Wall} and @option{-Wc++11-compat}.
2705With @option{-std=c++11}, @option{-Wno-narrowing} suppresses for
2706non-constants the diagnostic required by the standard. Note that this
2707does not affect the meaning of well-formed code; narrowing conversions
2708are still considered ill-formed in SFINAE context.
2710@item -Wnoexcept @r{(C++ and Objective-C++ only)}
2711@opindex Wnoexcept
2712@opindex Wno-noexcept
2713Warn when a noexcept-expression evaluates to false because of a call
2714to a function that does not have a non-throwing exception
2715specification (i.e. @code{throw()} or @code{noexcept}) but is known by
2716the compiler to never throw an exception.
2718@item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2719@opindex Wnon-virtual-dtor
2720@opindex Wno-non-virtual-dtor
2721Warn when a class has virtual functions and an accessible non-virtual
2722destructor itself or in an accessible polymorphic base class, in which
2723case it is possible but unsafe to delete an instance of a derived
2724class through a pointer to the class itself or base class. This
2725warning is automatically enabled if @option{-Weffc++} is specified.
2727@item -Wreorder @r{(C++ and Objective-C++ only)}
2728@opindex Wreorder
2729@opindex Wno-reorder
2730@cindex reordering, warning
2731@cindex warning for reordering of member initializers
2732Warn when the order of member initializers given in the code does not
2733match the order in which they must be executed. For instance:
2736struct A @{
2737 int i;
2738 int j;
2739 A(): j (0), i (1) @{ @}
2741@end smallexample
2744The compiler rearranges the member initializers for @code{i}
2745and @code{j} to match the declaration order of the members, emitting
2746a warning to that effect. This warning is enabled by @option{-Wall}.
2748@item -fext-numeric-literals @r{(C++ and Objective-C++ only)}
2749@opindex fext-numeric-literals
2750@opindex fno-ext-numeric-literals
2751Accept imaginary, fixed-point, or machine-defined
2752literal number suffixes as GNU extensions.
2753When this option is turned off these suffixes are treated
2754as C++11 user-defined literal numeric suffixes.
2755This is on by default for all pre-C++11 dialects and all GNU dialects:
2756@option{-std=c++98}, @option{-std=gnu++98}, @option{-std=gnu++11},
2758This option is off by default
2759for ISO C++11 onwards (@option{-std=c++11}, ...).
2760@end table
2762The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2764@table @gcctabopt
2765@item -Weffc++ @r{(C++ and Objective-C++ only)}
2766@opindex Weffc++
2767@opindex Wno-effc++
2768Warn about violations of the following style guidelines from Scott Meyers'
2769@cite{Effective C++} series of books:
2771@itemize @bullet
2773Define a copy constructor and an assignment operator for classes
2774with dynamically-allocated memory.
2777Prefer initialization to assignment in constructors.
2780Have @code{operator=} return a reference to @code{*this}.
2783Don't try to return a reference when you must return an object.
2786Distinguish between prefix and postfix forms of increment and
2787decrement operators.
2790Never overload @code{&&}, @code{||}, or @code{,}.
2792@end itemize
2794This option also enables @option{-Wnon-virtual-dtor}, which is also
2795one of the effective C++ recommendations. However, the check is
2796extended to warn about the lack of virtual destructor in accessible
2797non-polymorphic bases classes too.
2799When selecting this option, be aware that the standard library
2800headers do not obey all of these guidelines; use @samp{grep -v}
2801to filter out those warnings.
2803@item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2804@opindex Wstrict-null-sentinel
2805@opindex Wno-strict-null-sentinel
2806Warn about the use of an uncasted @code{NULL} as sentinel. When
2807compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2808to @code{__null}. Although it is a null pointer constant rather than a
2809null pointer, it is guaranteed to be of the same size as a pointer.
2810But this use is not portable across different compilers.
2812@item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2813@opindex Wno-non-template-friend
2814@opindex Wnon-template-friend
2815Disable warnings when non-templatized friend functions are declared
2816within a template. Since the advent of explicit template specification
2817support in G++, if the name of the friend is an unqualified-id (i.e.,
2818@samp{friend foo(int)}), the C++ language specification demands that the
2819friend declare or define an ordinary, nontemplate function. (Section
282014.5.3). Before G++ implemented explicit specification, unqualified-ids
2821could be interpreted as a particular specialization of a templatized
2822function. Because this non-conforming behavior is no longer the default
2823behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2824check existing code for potential trouble spots and is on by default.
2825This new compiler behavior can be turned off with
2826@option{-Wno-non-template-friend}, which keeps the conformant compiler code
2827but disables the helpful warning.
2829@item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2830@opindex Wold-style-cast
2831@opindex Wno-old-style-cast
2832Warn if an old-style (C-style) cast to a non-void type is used within
2833a C++ program. The new-style casts (@code{dynamic_cast},
2834@code{static_cast}, @code{reinterpret_cast}, and @code{const_cast}) are
2835less vulnerable to unintended effects and much easier to search for.
2837@item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2838@opindex Woverloaded-virtual
2839@opindex Wno-overloaded-virtual
2840@cindex overloaded virtual function, warning
2841@cindex warning for overloaded virtual function
2842Warn when a function declaration hides virtual functions from a
2843base class. For example, in:
2846struct A @{
2847 virtual void f();
2850struct B: public A @{
2851 void f(int);
2853@end smallexample
2855the @code{A} class version of @code{f} is hidden in @code{B}, and code
2859B* b;
2861@end smallexample
2864fails to compile.
2866@item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2867@opindex Wno-pmf-conversions
2868@opindex Wpmf-conversions
2869Disable the diagnostic for converting a bound pointer to member function
2870to a plain pointer.
2872@item -Wsign-promo @r{(C++ and Objective-C++ only)}
2873@opindex Wsign-promo
2874@opindex Wno-sign-promo
2875Warn when overload resolution chooses a promotion from unsigned or
2876enumerated type to a signed type, over a conversion to an unsigned type of
2877the same size. Previous versions of G++ tried to preserve
2878unsignedness, but the standard mandates the current behavior.
2879@end table
2881@node Objective-C and Objective-C++ Dialect Options
2882@section Options Controlling Objective-C and Objective-C++ Dialects
2884@cindex compiler options, Objective-C and Objective-C++
2885@cindex Objective-C and Objective-C++ options, command-line
2886@cindex options, Objective-C and Objective-C++
2887(NOTE: This manual does not describe the Objective-C and Objective-C++
2888languages themselves. @xref{Standards,,Language Standards
2889Supported by GCC}, for references.)
2891This section describes the command-line options that are only meaningful
2892for Objective-C and Objective-C++ programs. You can also use most of
2893the language-independent GNU compiler options.
2894For example, you might compile a file @file{some_class.m} like this:
2897gcc -g -fgnu-runtime -O -c some_class.m
2898@end smallexample
2901In this example, @option{-fgnu-runtime} is an option meant only for
2902Objective-C and Objective-C++ programs; you can use the other options with
2903any language supported by GCC@.
2905Note that since Objective-C is an extension of the C language, Objective-C
2906compilations may also use options specific to the C front-end (e.g.,
2907@option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2908C++-specific options (e.g., @option{-Wabi}).
2910Here is a list of options that are @emph{only} for compiling Objective-C
2911and Objective-C++ programs:
2913@table @gcctabopt
2914@item -fconstant-string-class=@var{class-name}
2915@opindex fconstant-string-class
2916Use @var{class-name} as the name of the class to instantiate for each
2917literal string specified with the syntax @code{@@"@dots{}"}. The default
2918class name is @code{NXConstantString} if the GNU runtime is being used, and
2919@code{NSConstantString} if the NeXT runtime is being used (see below). The
2920@option{-fconstant-cfstrings} option, if also present, overrides the
2921@option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2922to be laid out as constant CoreFoundation strings.
2924@item -fgnu-runtime
2925@opindex fgnu-runtime
2926Generate object code compatible with the standard GNU Objective-C
2927runtime. This is the default for most types of systems.
2929@item -fnext-runtime
2930@opindex fnext-runtime
2931Generate output compatible with the NeXT runtime. This is the default
2932for NeXT-based systems, including Darwin and Mac OS X@. The macro
2933@code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2936@item -fno-nil-receivers
2937@opindex fno-nil-receivers
2938Assume that all Objective-C message dispatches (@code{[receiver
2939message:arg]}) in this translation unit ensure that the receiver is
2940not @code{nil}. This allows for more efficient entry points in the
2941runtime to be used. This option is only available in conjunction with
2942the NeXT runtime and ABI version 0 or 1.
2944@item -fobjc-abi-version=@var{n}
2945@opindex fobjc-abi-version
2946Use version @var{n} of the Objective-C ABI for the selected runtime.
2947This option is currently supported only for the NeXT runtime. In that
2948case, Version 0 is the traditional (32-bit) ABI without support for
2949properties and other Objective-C 2.0 additions. Version 1 is the
2950traditional (32-bit) ABI with support for properties and other
2951Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2952nothing is specified, the default is Version 0 on 32-bit target
2953machines, and Version 2 on 64-bit target machines.
2955@item -fobjc-call-cxx-cdtors
2956@opindex fobjc-call-cxx-cdtors
2957For each Objective-C class, check if any of its instance variables is a
2958C++ object with a non-trivial default constructor. If so, synthesize a
2959special @code{- (id) .cxx_construct} instance method which runs
2960non-trivial default constructors on any such instance variables, in order,
2961and then return @code{self}. Similarly, check if any instance variable
2962is a C++ object with a non-trivial destructor, and if so, synthesize a
2963special @code{- (void) .cxx_destruct} method which runs
2964all such default destructors, in reverse order.
2966The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2967methods thusly generated only operate on instance variables
2968declared in the current Objective-C class, and not those inherited
2969from superclasses. It is the responsibility of the Objective-C
2970runtime to invoke all such methods in an object's inheritance
2971hierarchy. The @code{- (id) .cxx_construct} methods are invoked
2972by the runtime immediately after a new object instance is allocated;
2973the @code{- (void) .cxx_destruct} methods are invoked immediately
2974before the runtime deallocates an object instance.
2976As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2977support for invoking the @code{- (id) .cxx_construct} and
2978@code{- (void) .cxx_destruct} methods.
2980@item -fobjc-direct-dispatch
2981@opindex fobjc-direct-dispatch
2982Allow fast jumps to the message dispatcher. On Darwin this is
2983accomplished via the comm page.
2985@item -fobjc-exceptions
2986@opindex fobjc-exceptions
2987Enable syntactic support for structured exception handling in
2988Objective-C, similar to what is offered by C++ and Java. This option
2989is required to use the Objective-C keywords @code{@@try},
2990@code{@@throw}, @code{@@catch}, @code{@@finally} and
2991@code{@@synchronized}. This option is available with both the GNU
2992runtime and the NeXT runtime (but not available in conjunction with
2993the NeXT runtime on Mac OS X 10.2 and earlier).
2995@item -fobjc-gc
2996@opindex fobjc-gc
2997Enable garbage collection (GC) in Objective-C and Objective-C++
2998programs. This option is only available with the NeXT runtime; the
2999GNU runtime has a different garbage collection implementation that
3000does not require special compiler flags.
3002@item -fobjc-nilcheck
3003@opindex fobjc-nilcheck
3004For the NeXT runtime with version 2 of the ABI, check for a nil
3005receiver in method invocations before doing the actual method call.
3006This is the default and can be disabled using
3007@option{-fno-objc-nilcheck}. Class methods and super calls are never
3008checked for nil in this way no matter what this flag is set to.
3009Currently this flag does nothing when the GNU runtime, or an older
3010version of the NeXT runtime ABI, is used.
3012@item -fobjc-std=objc1
3013@opindex fobjc-std
3014Conform to the language syntax of Objective-C 1.0, the language
3015recognized by GCC 4.0. This only affects the Objective-C additions to
3016the C/C++ language; it does not affect conformance to C/C++ standards,
3017which is controlled by the separate C/C++ dialect option flags. When
3018this option is used with the Objective-C or Objective-C++ compiler,
3019any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
3020This is useful if you need to make sure that your Objective-C code can
3021be compiled with older versions of GCC@.
3023@item -freplace-objc-classes
3024@opindex freplace-objc-classes
3025Emit a special marker instructing @command{ld(1)} not to statically link in
3026the resulting object file, and allow @command{dyld(1)} to load it in at
3027run time instead. This is used in conjunction with the Fix-and-Continue
3028debugging mode, where the object file in question may be recompiled and
3029dynamically reloaded in the course of program execution, without the need
3030to restart the program itself. Currently, Fix-and-Continue functionality
3031is only available in conjunction with the NeXT runtime on Mac OS X 10.3
3032and later.
3034@item -fzero-link
3035@opindex fzero-link
3036When compiling for the NeXT runtime, the compiler ordinarily replaces calls
3037to @code{objc_getClass("@dots{}")} (when the name of the class is known at
3038compile time) with static class references that get initialized at load time,
3039which improves run-time performance. Specifying the @option{-fzero-link} flag
3040suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
3041to be retained. This is useful in Zero-Link debugging mode, since it allows
3042for individual class implementations to be modified during program execution.
3043The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
3044regardless of command-line options.
3046@item -fno-local-ivars
3047@opindex fno-local-ivars
3048@opindex flocal-ivars
3049By default instance variables in Objective-C can be accessed as if
3050they were local variables from within the methods of the class they're
3051declared in. This can lead to shadowing between instance variables
3052and other variables declared either locally inside a class method or
3053globally with the same name. Specifying the @option{-fno-local-ivars}
3054flag disables this behavior thus avoiding variable shadowing issues.
3056@item -fivar-visibility=@r{[}public@r{|}protected@r{|}private@r{|}package@r{]}
3057@opindex fivar-visibility
3058Set the default instance variable visibility to the specified option
3059so that instance variables declared outside the scope of any access
3060modifier directives default to the specified visibility.
3062@item -gen-decls
3063@opindex gen-decls
3064Dump interface declarations for all classes seen in the source file to a
3065file named @file{@var{sourcename}.decl}.
3067@item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
3068@opindex Wassign-intercept
3069@opindex Wno-assign-intercept
3070Warn whenever an Objective-C assignment is being intercepted by the
3071garbage collector.
3073@item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
3074@opindex Wno-protocol
3075@opindex Wprotocol
3076If a class is declared to implement a protocol, a warning is issued for
3077every method in the protocol that is not implemented by the class. The
3078default behavior is to issue a warning for every method not explicitly
3079implemented in the class, even if a method implementation is inherited
3080from the superclass. If you use the @option{-Wno-protocol} option, then
3081methods inherited from the superclass are considered to be implemented,
3082and no warning is issued for them.
3084@item -Wselector @r{(Objective-C and Objective-C++ only)}
3085@opindex Wselector
3086@opindex Wno-selector
3087Warn if multiple methods of different types for the same selector are
3088found during compilation. The check is performed on the list of methods
3089in the final stage of compilation. Additionally, a check is performed
3090for each selector appearing in a @code{@@selector(@dots{})}
3091expression, and a corresponding method for that selector has been found
3092during compilation. Because these checks scan the method table only at
3093the end of compilation, these warnings are not produced if the final
3094stage of compilation is not reached, for example because an error is
3095found during compilation, or because the @option{-fsyntax-only} option is
3096being used.
3098@item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
3099@opindex Wstrict-selector-match
3100@opindex Wno-strict-selector-match
3101Warn if multiple methods with differing argument and/or return types are
3102found for a given selector when attempting to send a message using this
3103selector to a receiver of type @code{id} or @code{Class}. When this flag
3104is off (which is the default behavior), the compiler omits such warnings
3105if any differences found are confined to types that share the same size
3106and alignment.
3108@item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
3109@opindex Wundeclared-selector
3110@opindex Wno-undeclared-selector
3111Warn if a @code{@@selector(@dots{})} expression referring to an
3112undeclared selector is found. A selector is considered undeclared if no
3113method with that name has been declared before the
3114@code{@@selector(@dots{})} expression, either explicitly in an
3115@code{@@interface} or @code{@@protocol} declaration, or implicitly in
3116an @code{@@implementation} section. This option always performs its
3117checks as soon as a @code{@@selector(@dots{})} expression is found,
3118while @option{-Wselector} only performs its checks in the final stage of
3119compilation. This also enforces the coding style convention
3120that methods and selectors must be declared before being used.
3122@item -print-objc-runtime-info
3123@opindex print-objc-runtime-info
3124Generate C header describing the largest structure that is passed by
3125value, if any.
3127@end table
3129@node Language Independent Options
3130@section Options to Control Diagnostic Messages Formatting
3131@cindex options to control diagnostics formatting
3132@cindex diagnostic messages
3133@cindex message formatting
3135Traditionally, diagnostic messages have been formatted irrespective of
3136the output device's aspect (e.g.@: its width, @dots{}). You can use the
3137options described below
3138to control the formatting algorithm for diagnostic messages,
3139e.g.@: how many characters per line, how often source location
3140information should be reported. Note that some language front ends may not
3141honor these options.
3143@table @gcctabopt
3144@item -fmessage-length=@var{n}
3145@opindex fmessage-length
3146Try to format error messages so that they fit on lines of about
3147@var{n} characters. If @var{n} is zero, then no line-wrapping is
3148done; each error message appears on a single line. This is the
3149default for all front ends.
3151@item -fdiagnostics-show-location=once
3152@opindex fdiagnostics-show-location
3153Only meaningful in line-wrapping mode. Instructs the diagnostic messages
3154reporter to emit source location information @emph{once}; that is, in
3155case the message is too long to fit on a single physical line and has to
3156be wrapped, the source location won't be emitted (as prefix) again,
3157over and over, in subsequent continuation lines. This is the default
3160@item -fdiagnostics-show-location=every-line
3161Only meaningful in line-wrapping mode. Instructs the diagnostic
3162messages reporter to emit the same source location information (as
3163prefix) for physical lines that result from the process of breaking
3164a message which is too long to fit on a single line.
3166@item -fdiagnostics-color[=@var{WHEN}]
3167@itemx -fno-diagnostics-color
3168@opindex fdiagnostics-color
3169@cindex highlight, color, colour
3170@vindex GCC_COLORS @r{environment variable}
3171Use color in diagnostics. @var{WHEN} is @samp{never}, @samp{always},
3172or @samp{auto}. The default depends on how the compiler has been configured,
3173it can be any of the above @var{WHEN} options or also @samp{never}
3174if @env{GCC_COLORS} environment variable isn't present in the environment,
3175and @samp{auto} otherwise.
3176@samp{auto} means to use color only when the standard error is a terminal.
3177The forms @option{-fdiagnostics-color} and @option{-fno-diagnostics-color} are
3178aliases for @option{-fdiagnostics-color=always} and
3179@option{-fdiagnostics-color=never}, respectively.
3181The colors are defined by the environment variable @env{GCC_COLORS}.
3182Its value is a colon-separated list of capabilities and Select Graphic
3183Rendition (SGR) substrings. SGR commands are interpreted by the
3184terminal or terminal emulator. (See the section in the documentation
3185of your text terminal for permitted values and their meanings as
3186character attributes.) These substring values are integers in decimal
3187representation and can be concatenated with semicolons.
3188Common values to concatenate include
3189@samp{1} for bold,
3190@samp{4} for underline,
3191@samp{5} for blink,
3192@samp{7} for inverse,
3193@samp{39} for default foreground color,
3194@samp{30} to @samp{37} for foreground colors,
3195@samp{90} to @samp{97} for 16-color mode foreground colors,
3196@samp{38;5;0} to @samp{38;5;255}
3197for 88-color and 256-color modes foreground colors,
3198@samp{49} for default background color,
3199@samp{40} to @samp{47} for background colors,
3200@samp{100} to @samp{107} for 16-color mode background colors,
3201and @samp{48;5;0} to @samp{48;5;255}
3202for 88-color and 256-color modes background colors.
3204The default @env{GCC_COLORS} is
3207@end smallexample
3209where @samp{01;31} is bold red, @samp{01;35} is bold magenta,
3210@samp{01;36} is bold cyan, @samp{01;32} is bold green and
3211@samp{01} is bold. Setting @env{GCC_COLORS} to the empty
3212string disables colors.
3213Supported capabilities are as follows.
3215@table @code
3216@item error=
3217@vindex error GCC_COLORS @r{capability}
3218SGR substring for error: markers.
3220@item warning=
3221@vindex warning GCC_COLORS @r{capability}
3222SGR substring for warning: markers.
3224@item note=
3225@vindex note GCC_COLORS @r{capability}
3226SGR substring for note: markers.
3228@item caret=
3229@vindex caret GCC_COLORS @r{capability}
3230SGR substring for caret line.
3232@item locus=
3233@vindex locus GCC_COLORS @r{capability}
3234SGR substring for location information, @samp{file:line} or
3235@samp{file:line:column} etc.
3237@item quote=
3238@vindex quote GCC_COLORS @r{capability}
3239SGR substring for information printed within quotes.
3240@end table
3242@item -fno-diagnostics-show-option
3243@opindex fno-diagnostics-show-option
3244@opindex fdiagnostics-show-option
3245By default, each diagnostic emitted includes text indicating the
3246command-line option that directly controls the diagnostic (if such an
3247option is known to the diagnostic machinery). Specifying the
3248@option{-fno-diagnostics-show-option} flag suppresses that behavior.
3250@item -fno-diagnostics-show-caret
3251@opindex fno-diagnostics-show-caret
3252@opindex fdiagnostics-show-caret
3253By default, each diagnostic emitted includes the original source line
3254and a caret '^' indicating the column. This option suppresses this
3255information. The source line is truncated to @var{n} characters, if
38c0c85b 3256the @option{-fmessage-length=n} option is given. When the output is done
3257to the terminal, the width is limited to the width given by the
3258@env{COLUMNS} environment variable or, if not set, to the terminal width.
3260@end table
3262@node Warning Options
3263@section Options to Request or Suppress Warnings
3264@cindex options to control warnings
3265@cindex warning messages
3266@cindex messages, warning
3267@cindex suppressing warnings
3269Warnings are diagnostic messages that report constructions that
3270are not inherently erroneous but that are risky or suggest there
3271may have been an error.
3273The following language-independent options do not enable specific
3274warnings but control the kinds of diagnostics produced by GCC@.
3276@table @gcctabopt
3277@cindex syntax checking
3278@item -fsyntax-only
3279@opindex fsyntax-only
3280Check the code for syntax errors, but don't do anything beyond that.
3282@item -fmax-errors=@var{n}
3283@opindex fmax-errors
3284Limits the maximum number of error messages to @var{n}, at which point
3285GCC bails out rather than attempting to continue processing the source
3286code. If @var{n} is 0 (the default), there is no limit on the number
3287of error messages produced. If @option{-Wfatal-errors} is also
3288specified, then @option{-Wfatal-errors} takes precedence over this
3291@item -w
3292@opindex w
3293Inhibit all warning messages.
3295@item -Werror
3296@opindex Werror
3297@opindex Wno-error
3298Make all warnings into errors.
3300@item -Werror=
3301@opindex Werror=
3302@opindex Wno-error=
3303Make the specified warning into an error. The specifier for a warning
3304is appended; for example @option{-Werror=switch} turns the warnings
3305controlled by @option{-Wswitch} into errors. This switch takes a
3306negative form, to be used to negate @option{-Werror} for specific
3307warnings; for example @option{-Wno-error=switch} makes
3308@option{-Wswitch} warnings not be errors, even when @option{-Werror}
3309is in effect.
3311The warning message for each controllable warning includes the
3312option that controls the warning. That option can then be used with
3313@option{-Werror=} and @option{-Wno-error=} as described above.
3314(Printing of the option in the warning message can be disabled using the
3315@option{-fno-diagnostics-show-option} flag.)
3317Note that specifying @option{-Werror=}@var{foo} automatically implies
3318@option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
3319imply anything.
3321@item -Wfatal-errors
3322@opindex Wfatal-errors
3323@opindex Wno-fatal-errors
3324This option causes the compiler to abort compilation on the first error
3325occurred rather than trying to keep going and printing further error
3328@end table
3330You can request many specific warnings with options beginning with
3331@samp{-W}, for example @option{-Wimplicit} to request warnings on
3332implicit declarations. Each of these specific warning options also
3333has a negative form beginning @samp{-Wno-} to turn off warnings; for
3334example, @option{-Wno-implicit}. This manual lists only one of the
3335two forms, whichever is not the default. For further
3336language-specific options also refer to @ref{C++ Dialect Options} and
3337@ref{Objective-C and Objective-C++ Dialect Options}.
3339Some options, such as @option{-Wall} and @option{-Wextra}, turn on other
3340options, such as @option{-Wunused}, which may turn on further options,
3341such as @option{-Wunused-value}. The combined effect of positive and
3342negative forms is that more specific options have priority over less
3343specific ones, independently of their position in the command-line. For
3344options of the same specificity, the last one takes effect. Options
3345enabled or disabled via pragmas (@pxref{Diagnostic Pragmas}) take effect
3346as if they appeared at the end of the command-line.
3348When an unrecognized warning option is requested (e.g.,
3349@option{-Wunknown-warning}), GCC emits a diagnostic stating
3350that the option is not recognized. However, if the @option{-Wno-} form
3351is used, the behavior is slightly different: no diagnostic is
3352produced for @option{-Wno-unknown-warning} unless other diagnostics
3353are being produced. This allows the use of new @option{-Wno-} options
3354with old compilers, but if something goes wrong, the compiler
3355warns that an unrecognized option is present.
3357@table @gcctabopt
3358@item -Wpedantic
3359@itemx -pedantic
3360@opindex pedantic
3361@opindex Wpedantic
3362Issue all the warnings demanded by strict ISO C and ISO C++;
3363reject all programs that use forbidden extensions, and some other
3364programs that do not follow ISO C and ISO C++. For ISO C, follows the
3365version of the ISO C standard specified by any @option{-std} option used.
3367Valid ISO C and ISO C++ programs should compile properly with or without
3368this option (though a rare few require @option{-ansi} or a
3369@option{-std} option specifying the required version of ISO C)@. However,
3370without this option, certain GNU extensions and traditional C and C++
3371features are supported as well. With this option, they are rejected.
3373@option{-Wpedantic} does not cause warning messages for use of the
3374alternate keywords whose names begin and end with @samp{__}. Pedantic
3375warnings are also disabled in the expression that follows
3376@code{__extension__}. However, only system header files should use
3377these escape routes; application programs should avoid them.
3378@xref{Alternate Keywords}.
3380Some users try to use @option{-Wpedantic} to check programs for strict ISO
3381C conformance. They soon find that it does not do quite what they want:
3382it finds some non-ISO practices, but not all---only those for which
3383ISO C @emph{requires} a diagnostic, and some others for which
3384diagnostics have been added.
3386A feature to report any failure to conform to ISO C might be useful in
3387some instances, but would require considerable additional work and would
3388be quite different from @option{-Wpedantic}. We don't have plans to
3389support such a feature in the near future.
3391Where the standard specified with @option{-std} represents a GNU
3392extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
3393corresponding @dfn{base standard}, the version of ISO C on which the GNU
3394extended dialect is based. Warnings from @option{-Wpedantic} are given
3395where they are required by the base standard. (It does not make sense
3396for such warnings to be given only for features not in the specified GNU
3397C dialect, since by definition the GNU dialects of C include all
3398features the compiler supports with the given option, and there would be
3399nothing to warn about.)
3401@item -pedantic-errors
3402@opindex pedantic-errors
3403Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
3404requires a diagnostic, in some cases where there is undefined behavior
3405at compile-time and in some other cases that do not prevent compilation
3406of programs that are valid according to the standard. This is not
3407equivalent to @option{-Werror=pedantic}, since there are errors enabled
3408by this option and not enabled by the latter and vice versa.
3410@item -Wall
3411@opindex Wall
3412@opindex Wno-all
3413This enables all the warnings about constructions that some users
3414consider questionable, and that are easy to avoid (or modify to
3415prevent the warning), even in conjunction with macros. This also
3416enables some language-specific warnings described in @ref{C++ Dialect
3417Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
3419@option{-Wall} turns on the following warning flags:
3421@gccoptlist{-Waddress @gol
3422-Warray-bounds=1 @r{(only with} @option{-O2}@r{)} @gol
3423-Wc++11-compat -Wc++14-compat@gol
3424-Wchar-subscripts @gol
3425-Wenum-compare @r{(in C/ObjC; this is on by default in C++)} @gol
3426-Wimplicit-int @r{(C and Objective-C only)} @gol
3427-Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
3428-Wcomment @gol
3429-Wformat @gol
3430-Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
3431-Wmaybe-uninitialized @gol
3432-Wmissing-braces @r{(only for C/ObjC)} @gol
3433-Wnonnull @gol
3434-Wopenmp-simd @gol
3435-Wparentheses @gol
3436-Wpointer-sign @gol
3437-Wreorder @gol
3438-Wreturn-type @gol
3439-Wsequence-point @gol
3440-Wsign-compare @r{(only in C++)} @gol
3441-Wstrict-aliasing @gol
3442-Wstrict-overflow=1 @gol
3443-Wswitch @gol
3444-Wtrigraphs @gol
3445-Wuninitialized @gol
3446-Wunknown-pragmas @gol
3447-Wunused-function @gol
3448-Wunused-label @gol
3449-Wunused-value @gol
3450-Wunused-variable @gol
3451-Wvolatile-register-var @gol
3454Note that some warning flags are not implied by @option{-Wall}. Some of
3455them warn about constructions that users generally do not consider
3456questionable, but which occasionally you might wish to check for;
3457others warn about constructions that are necessary or hard to avoid in
3458some cases, and there is no simple way to modify the code to suppress
3459the warning. Some of them are enabled by @option{-Wextra} but many of
3460them must be enabled individually.
3462@item -Wextra
3463@opindex W
3464@opindex Wextra
3465@opindex Wno-extra
3466This enables some extra warning flags that are not enabled by
3467@option{-Wall}. (This option used to be called @option{-W}. The older
3468name is still supported, but the newer name is more descriptive.)
3470@gccoptlist{-Wclobbered @gol
3471-Wempty-body @gol
3472-Wignored-qualifiers @gol
3473-Wmissing-field-initializers @gol
3474-Wmissing-parameter-type @r{(C only)} @gol
3475-Wold-style-declaration @r{(C only)} @gol
3476-Woverride-init @gol
3477-Wsign-compare @gol
3478-Wtype-limits @gol
3479-Wuninitialized @gol
3480-Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3481-Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3484The option @option{-Wextra} also prints warning messages for the
3485following cases:
3487@itemize @bullet
3490A pointer is compared against integer zero with @code{<}, @code{<=},
3491@code{>}, or @code{>=}.
3494(C++ only) An enumerator and a non-enumerator both appear in a
3495conditional expression.
3498(C++ only) Ambiguous virtual bases.
3501(C++ only) Subscripting an array that has been declared @code{register}.
3504(C++ only) Taking the address of a variable that has been declared
3508(C++ only) A base class is not initialized in a derived class's copy
3511@end itemize
3513@item -Wchar-subscripts
3514@opindex Wchar-subscripts
3515@opindex Wno-char-subscripts
3516Warn if an array subscript has type @code{char}. This is a common cause
3517of error, as programmers often forget that this type is signed on some
3519This warning is enabled by @option{-Wall}.
3521@item -Wcomment
3522@opindex Wcomment
3523@opindex Wno-comment
3524Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3525comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3526This warning is enabled by @option{-Wall}.
3528@item -Wno-coverage-mismatch
3529@opindex Wno-coverage-mismatch
3530Warn if feedback profiles do not match when using the
3531@option{-fprofile-use} option.
3532If a source file is changed between compiling with @option{-fprofile-gen} and
3533with @option{-fprofile-use}, the files with the profile feedback can fail
3534to match the source file and GCC cannot use the profile feedback
3535information. By default, this warning is enabled and is treated as an
3536error. @option{-Wno-coverage-mismatch} can be used to disable the
3537warning or @option{-Wno-error=coverage-mismatch} can be used to
3538disable the error. Disabling the error for this warning can result in
3539poorly optimized code and is useful only in the
3540case of very minor changes such as bug fixes to an existing code-base.
3541Completely disabling the warning is not recommended.
3543@item -Wno-cpp
3544@r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3546Suppress warning messages emitted by @code{#warning} directives.
3548@item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3549@opindex Wdouble-promotion
3550@opindex Wno-double-promotion
3551Give a warning when a value of type @code{float} is implicitly
3552promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3553floating-point unit implement @code{float} in hardware, but emulate
3554@code{double} in software. On such a machine, doing computations
3555using @code{double} values is much more expensive because of the
3556overhead required for software emulation.
3558It is easy to accidentally do computations with @code{double} because
3559floating-point literals are implicitly of type @code{double}. For
3560example, in:
3563float area(float radius)
3565 return 3.14159 * radius * radius;
3567@end group
3568@end smallexample
3569the compiler performs the entire computation with @code{double}
3570because the floating-point literal is a @code{double}.
3572@item -Wformat
3573@itemx -Wformat=@var{n}
3574@opindex Wformat
3575@opindex Wno-format
3576@opindex ffreestanding
3577@opindex fno-builtin
3578@opindex Wformat=
3579Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3580the arguments supplied have types appropriate to the format string
3581specified, and that the conversions specified in the format string make
3582sense. This includes standard functions, and others specified by format
3583attributes (@pxref{Function Attributes}), in the @code{printf},
3584@code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3585not in the C standard) families (or other target-specific families).
3586Which functions are checked without format attributes having been
3587specified depends on the standard version selected, and such checks of
3588functions without the attribute specified are disabled by
3589@option{-ffreestanding} or @option{-fno-builtin}.
3591The formats are checked against the format features supported by GNU
3592libc version 2.2. These include all ISO C90 and C99 features, as well