Merge branch 'vendor/GCC47'
[dragonfly.git] / contrib / gcc-4.7 / gcc / doc / gcc.1
5ce9237c 1.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05)
3.\" Standard preamble:
4.\" ========================================================================
JM Sh \" Subsection heading
7.if t .Sp 5
JM Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16.. Vb \" Begin verbatim text
18.ft CW \\$1
21.. Ve \" End verbatim text
23.ft R
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. \*(C+ will
29.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
30.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
31.\" nothing in troff, for use with C<>. \(*W-
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
51.\" Escape single quotes in literal strings from groff's Unicode transform. \n(.g .ds Aq \(aq
53.el .ds Aq '
55.\" If the F register is turned on, we'll generate index entries on stderr for
5ce9237c 56.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
57.\" entries marked with X<> in POD. Of course, you'll have to process the
58.\" output yourself in some meaningful fashion. \nF \{\
60. de IX
61. tm Index:\\$1\t\\n%\t"\\$2"
63. nr % 0
64. rr F
66.el \{\
67. de IX
71.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
72.\" Fear. Run. Save yourself. No user-serviceable parts.
73. \" fudge factors for nroff and troff
74.if n \{\
75. ds #H 0
76. ds #V .8m
77. ds #F .3m
78. ds #[ \f1
79. ds #] \fP
81.if t \{\
82. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
83. ds #V .6m
84. ds #F 0
85. ds #[ \&
86. ds #] \&
88. \" simple accents for nroff and troff
89.if n \{\
90. ds ' \&
91. ds ` \&
92. ds ^ \&
93. ds , \&
94. ds ~ ~
95. ds /
97.if t \{\
98. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
99. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
100. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
101. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
102. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
103. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105. \" troff and (daisy-wheel) nroff accents
106.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
107.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
108.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
109.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
110.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
111.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
112.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
113.ds ae a\h'-(\w'a'u*4/10)'e
114.ds Ae A\h'-(\w'A'u*4/10)'E
115. \" corrections for vroff
116.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
117.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
118. \" for low resolution devices (crt and lpr)
119.if \n(.H>23 .if \n(.V>19 \
121. ds : e
122. ds 8 ss
123. ds o a
124. ds d- d\h'-1'\(ga
125. ds D- D\h'-1'\(hy
126. ds th \o'bp'
127. ds Th \o'LP'
128. ds ae ae
129. ds Ae AE
131.rm #[ #] #H #V #F C
132.\" ========================================================================
134.IX Title "GCC 1"
95d28233 135.TH GCC 1 "2014-06-12" "gcc-4.7.4" "GNU"
136.\" For nroff, turn off justification. Always turn off hyphenation; it makes
137.\" way too many mistakes in technical documents.
138.if n .ad l
140.SH "NAME"
141gcc \- GNU project C and C++ compiler
143.IX Header "SYNOPSIS"
144gcc [\fB\-c\fR|\fB\-S\fR|\fB\-E\fR] [\fB\-std=\fR\fIstandard\fR]
145 [\fB\-g\fR] [\fB\-pg\fR] [\fB\-O\fR\fIlevel\fR]
146 [\fB\-W\fR\fIwarn\fR...] [\fB\-pedantic\fR]
147 [\fB\-I\fR\fIdir\fR...] [\fB\-L\fR\fIdir\fR...]
148 [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR]
149 [\fB\-f\fR\fIoption\fR...] [\fB\-m\fR\fImachine-option\fR...]
150 [\fB\-o\fR \fIoutfile\fR] [@\fIfile\fR] \fIinfile\fR...
152Only the most useful options are listed here; see below for the
153remainder. \fBg++\fR accepts mostly the same options as \fBgcc\fR.
156When you invoke \s-1GCC\s0, it normally does preprocessing, compilation,
157assembly and linking. The \*(L"overall options\*(R" allow you to stop this
158process at an intermediate stage. For example, the \fB\-c\fR option
159says not to run the linker. Then the output consists of object files
160output by the assembler.
162Other options are passed on to one stage of processing. Some options
163control the preprocessor and others the compiler itself. Yet other
164options control the assembler and linker; most of these are not
165documented here, since you rarely need to use any of them.
167Most of the command-line options that you can use with \s-1GCC\s0 are useful
168for C programs; when an option is only useful with another language
169(usually \*(C+), the explanation says so explicitly. If the description
170for a particular option does not mention a source language, you can use
171that option with all supported languages.
173The \fBgcc\fR program accepts options and file names as operands. Many
174options have multi-letter names; therefore multiple single-letter options
175may \fInot\fR be grouped: \fB\-dv\fR is very different from \fB\-d\ \-v\fR.
177You can mix options and other arguments. For the most part, the order
178you use doesn't matter. Order does matter when you use several
179options of the same kind; for example, if you specify \fB\-L\fR more
180than once, the directories are searched in the order specified. Also,
181the placement of the \fB\-l\fR option is significant.
183Many options have long names starting with \fB\-f\fR or with
184\&\fB\-W\fR\-\-\-for example,
185\&\fB\-fmove\-loop\-invariants\fR, \fB\-Wformat\fR and so on. Most of
186these have both positive and negative forms; the negative form of
187\&\fB\-ffoo\fR would be \fB\-fno\-foo\fR. This manual documents
188only one of these two forms, whichever one is not the default.
190.IX Header "OPTIONS"
5ce9237c 191.Sh "Option Summary"
192.IX Subsection "Option Summary"
193Here is a summary of all the options, grouped by type. Explanations are
194in the following sections.
195.IP "\fIOverall Options\fR" 4
196.IX Item "Overall Options"
197\&\fB\-c \-S \-E \-o\fR \fIfile\fR \fB\-no\-canonical\-prefixes
198\&\-pipe \-pass\-exit\-codes
199\&\-x\fR \fIlanguage\fR \fB\-v \-### \-\-help\fR[\fB=\fR\fIclass\fR[\fB,...\fR]] \fB\-\-target\-help
200\&\-\-version \-wrapper @\fR\fIfile\fR \fB\-fplugin=\fR\fIfile\fR \fB\-fplugin\-arg\-\fR\fIname\fR\fB=\fR\fIarg\fR
201\&\fB\-fdump\-ada\-spec\fR[\fB\-slim\fR] \fB\-fdump\-go\-spec=\fR\fIfile\fR
202.IP "\fIC Language Options\fR" 4
203.IX Item "C Language Options"
204\&\fB\-ansi \-std=\fR\fIstandard\fR \fB\-fgnu89\-inline
205\&\-aux\-info\fR \fIfilename\fR \fB\-fallow\-parameterless\-variadic\-functions
206\&\-fno\-asm \-fno\-builtin \-fno\-builtin\-\fR\fIfunction\fR
207\&\fB\-fhosted \-ffreestanding \-fopenmp \-fms\-extensions \-fplan9\-extensions
208\&\-trigraphs \-no\-integrated\-cpp \-traditional \-traditional\-cpp
209\&\-fallow\-single\-precision \-fcond\-mismatch \-flax\-vector\-conversions
210\&\-fsigned\-bitfields \-fsigned\-char
211\&\-funsigned\-bitfields \-funsigned\-char\fR
212.IP "\fI\*(C+ Language Options\fR" 4
213.IX Item " Language Options"
214\&\fB\-fabi\-version=\fR\fIn\fR \fB\-fno\-access\-control \-fcheck\-new
215\&\-fconserve\-space \-fconstexpr\-depth=\fR\fIn\fR \fB\-ffriend\-injection
218\&\-ffor\-scope \-fno\-for\-scope \-fno\-gnu\-keywords
221\&\-fno\-implement\-inlines \-fms\-extensions
222\&\-fno\-nonansi\-builtins \-fnothrow\-opt \-fno\-operator\-names
223\&\-fno\-optional\-diags \-fpermissive
225\&\-frepo \-fno\-rtti \-fstats \-ftemplate\-depth=\fR\fIn\fR
226\&\fB\-fno\-threadsafe\-statics \-fuse\-cxa\-atexit \-fno\-weak \-nostdinc++
227\&\-fno\-default\-inline \-fvisibility\-inlines\-hidden
229\&\-Wabi \-Wconversion\-null \-Wctor\-dtor\-privacy
230\&\-Wdelete\-non\-virtual\-dtor \-Wnarrowing \-Wnoexcept
231\&\-Wnon\-virtual\-dtor \-Wreorder
232\&\-Weffc++ \-Wstrict\-null\-sentinel
233\&\-Wno\-non\-template\-friend \-Wold\-style\-cast
234\&\-Woverloaded\-virtual \-Wno\-pmf\-conversions
236.IP "\fIObjective-C and Objective\-\*(C+ Language Options\fR" 4
237.IX Item "Objective-C and Objective- Language Options"
239\&\fB\-fgnu\-runtime \-fnext\-runtime
252\&\-Wno\-protocol \-Wselector
255.IP "\fILanguage Independent Options\fR" 4
256.IX Item "Language Independent Options"
260.IP "\fIWarning Options\fR" 4
261.IX Item "Warning Options"
262\&\fB\-fsyntax\-only \-fmax\-errors=\fR\fIn\fR \fB\-pedantic
264\&\-w \-Wextra \-Wall \-Waddress \-Waggregate\-return \-Warray\-bounds
265\&\-Wno\-attributes \-Wno\-builtin\-macro\-redefined
266\&\-Wc++\-compat \-Wc++11\-compat \-Wcast\-align \-Wcast\-qual
267\&\-Wchar\-subscripts \-Wclobbered \-Wcomment
268\&\-Wconversion \-Wcoverage\-mismatch \-Wno\-cpp \-Wno\-deprecated
269\&\-Wno\-deprecated\-declarations \-Wdisabled\-optimization
270\&\-Wno\-div\-by\-zero \-Wdouble\-promotion \-Wempty\-body \-Wenum\-compare
271\&\-Wno\-endif\-labels \-Werror \-Werror=*
272\&\-Wfatal\-errors \-Wfloat\-equal \-Wformat \-Wformat=2
273\&\-Wno\-format\-contains\-nul \-Wno\-format\-extra\-args \-Wformat\-nonliteral
274\&\-Wformat\-security \-Wformat\-y2k
275\&\-Wframe\-larger\-than=\fR\fIlen\fR \fB\-Wno\-free\-nonheap\-object \-Wjump\-misses\-init
277\&\-Wimplicit \-Wimplicit\-function\-declaration \-Wimplicit\-int
278\&\-Winit\-self \-Winline \-Wmaybe\-uninitialized
279\&\-Wno\-int\-to\-pointer\-cast \-Wno\-invalid\-offsetof
280\&\-Winvalid\-pch \-Wlarger\-than=\fR\fIlen\fR \fB\-Wunsafe\-loop\-optimizations
281\&\-Wlogical\-op \-Wlong\-long
282\&\-Wmain \-Wmaybe\-uninitialized \-Wmissing\-braces \-Wmissing\-field\-initializers
283\&\-Wmissing\-format\-attribute \-Wmissing\-include\-dirs
285\&\-Wno\-multichar \-Wnonnull \-Wno\-overflow
286\&\-Woverlength\-strings \-Wpacked \-Wpacked\-bitfield\-compat \-Wpadded
287\&\-Wparentheses \-Wpedantic\-ms\-format \-Wno\-pedantic\-ms\-format
288\&\-Wpointer\-arith \-Wno\-pointer\-to\-int\-cast
290\&\-Wreturn\-type \-Wsequence\-point \-Wshadow
291\&\-Wsign\-compare \-Wsign\-conversion \-Wstack\-protector
292\&\-Wstack\-usage=\fR\fIlen\fR \fB\-Wstrict\-aliasing \-Wstrict\-aliasing=n
293\&\-Wstrict\-overflow \-Wstrict\-overflow=\fR\fIn\fR
295\&\fB\-Wswitch \-Wswitch\-default \-Wswitch\-enum \-Wsync\-nand
296\&\-Wsystem\-headers \-Wtrampolines \-Wtrigraphs \-Wtype\-limits \-Wundef
297\&\-Wuninitialized \-Wunknown\-pragmas \-Wno\-pragmas
298\&\-Wunsuffixed\-float\-constants \-Wunused \-Wunused\-function
299\&\-Wunused\-label \-Wunused\-local\-typedefs \-Wunused\-parameter
300\&\-Wno\-unused\-result \-Wunused\-value \-Wunused\-variable
301\&\-Wunused\-but\-set\-parameter \-Wunused\-but\-set\-variable
302\&\-Wvariadic\-macros \-Wvector\-operation\-performance \-Wvla
303\&\-Wvolatile\-register\-var \-Wwrite\-strings \-Wzero\-as\-null\-pointer\-constant\fR
304.IP "\fIC and Objective-C-only Warning Options\fR" 4
305.IX Item "C and Objective-C-only Warning Options"
306\&\fB\-Wbad\-function\-cast \-Wmissing\-declarations
307\&\-Wmissing\-parameter\-type \-Wmissing\-prototypes \-Wnested\-externs
308\&\-Wold\-style\-declaration \-Wold\-style\-definition
309\&\-Wstrict\-prototypes \-Wtraditional \-Wtraditional\-conversion
310\&\-Wdeclaration\-after\-statement \-Wpointer\-sign\fR
311.IP "\fIDebugging Options\fR" 4
312.IX Item "Debugging Options"
313\&\fB\-d\fR\fIletters\fR \fB\-dumpspecs \-dumpmachine \-dumpversion
314\&\-fdbg\-cnt\-list \-fdbg\-cnt=\fR\fIcounter-value-list\fR
320\&\fB\-fdump\-noaddr \-fdump\-unnumbered \-fdump\-unnumbered\-links
323\&\fB\-fdump\-ipa\-all \-fdump\-ipa\-cgraph \-fdump\-ipa\-inline
329\&\fB\-fdump\-tree\-cfg \-fdump\-tree\-vcg \-fdump\-tree\-alias
331\&\-fdump\-tree\-ssa\fR[\fB\-\fR\fIn\fR] \fB\-fdump\-tree\-pre\fR[\fB\-\fR\fIn\fR]
332\&\fB\-fdump\-tree\-ccp\fR[\fB\-\fR\fIn\fR] \fB\-fdump\-tree\-dce\fR[\fB\-\fR\fIn\fR]
333\&\fB\-fdump\-tree\-gimple\fR[\fB\-raw\fR] \fB\-fdump\-tree\-mudflap\fR[\fB\-\fR\fIn\fR]
340\&\fB\-fdump\-tree\-nrv \-fdump\-tree\-vect
349\&\fB\-fcompare\-debug\fR[\fB=\fR\fIopts\fR] \fB\-fcompare\-debug\-second
350\&\-feliminate\-dwarf2\-dups \-feliminate\-unused\-debug\-types
351\&\-feliminate\-unused\-debug\-symbols \-femit\-class\-debug\-always
355\&\-fmem\-report \-fpre\-ipa\-mem\-report \-fpost\-ipa\-mem\-report \-fprofile\-arcs
356\&\-frandom\-seed=\fR\fIstring\fR \fB\-fsched\-verbose=\fR\fIn\fR
357\&\fB\-fsel\-sched\-verbose \-fsel\-sched\-dump\-cfg \-fsel\-sched\-pipelining\-verbose
358\&\-fstack\-usage \-ftest\-coverage \-ftime\-report \-fvar\-tracking
359\&\-fvar\-tracking\-assignments \-fvar\-tracking\-assignments\-toggle
360\&\-g \-g\fR\fIlevel\fR \fB\-gtoggle \-gcoff \-gdwarf\-\fR\fIversion\fR
361\&\fB\-ggdb \-grecord\-gcc\-switches \-gno\-record\-gcc\-switches
362\&\-gstabs \-gstabs+ \-gstrict\-dwarf \-gno\-strict\-dwarf
363\&\-gvms \-gxcoff \-gxcoff+
364\&\-fno\-merge\-debug\-strings \-fno\-dwarf2\-cfi\-asm
366\&\fB\-femit\-struct\-debug\-baseonly \-femit\-struct\-debug\-reduced
368\&\fB\-p \-pg \-print\-file\-name=\fR\fIlibrary\fR \fB\-print\-libgcc\-file\-name
369\&\-print\-multi\-directory \-print\-multi\-lib \-print\-multi\-os\-directory
370\&\-print\-prog\-name=\fR\fIprogram\fR \fB\-print\-search\-dirs \-Q
371\&\-print\-sysroot \-print\-sysroot\-headers\-suffix
372\&\-save\-temps \-save\-temps=cwd \-save\-temps=obj \-time\fR[\fB=\fR\fIfile\fR]
373.IP "\fIOptimization Options\fR" 4
374.IX Item "Optimization Options"
375\&\fB\-falign\-functions[=\fR\fIn\fR\fB] \-falign\-jumps[=\fR\fIn\fR\fB]
376\&\-falign\-labels[=\fR\fIn\fR\fB] \-falign\-loops[=\fR\fIn\fR\fB] \-fassociative\-math
377\&\-fauto\-inc\-dec \-fbranch\-probabilities \-fbranch\-target\-load\-optimize
378\&\-fbranch\-target\-load\-optimize2 \-fbtr\-bb\-exclusive \-fcaller\-saves
379\&\-fcheck\-data\-deps \-fcombine\-stack\-adjustments \-fconserve\-stack
380\&\-fcompare\-elim \-fcprop\-registers \-fcrossjumping
381\&\-fcse\-follow\-jumps \-fcse\-skip\-blocks \-fcx\-fortran\-rules
383\&\-fdata\-sections \-fdce \-fdelayed\-branch
384\&\-fdelete\-null\-pointer\-checks \-fdevirtualize \-fdse
385\&\-fearly\-inlining \-fipa\-sra \-fexpensive\-optimizations \-ffat\-lto\-objects
386\&\-ffast\-math \-ffinite\-math\-only \-ffloat\-store \-fexcess\-precision=\fR\fIstyle\fR
387\&\fB\-fforward\-propagate \-ffp\-contract=\fR\fIstyle\fR \fB\-ffunction\-sections
388\&\-fgcse \-fgcse\-after\-reload \-fgcse\-las \-fgcse\-lm \-fgraphite\-identity
389\&\-fgcse\-sm \-fif\-conversion \-fif\-conversion2 \-findirect\-inlining
390\&\-finline\-functions \-finline\-functions\-called\-once \-finline\-limit=\fR\fIn\fR
391\&\fB\-finline\-small\-functions \-fipa\-cp \-fipa\-cp\-clone \-fipa\-matrix\-reorg
392\&\-fipa\-pta \-fipa\-profile \-fipa\-pure\-const \-fipa\-reference
395\&\fB\-fira\-loop\-pressure \-fno\-ira\-share\-save\-slots
396\&\-fno\-ira\-share\-spill\-slots \-fira\-verbose=\fR\fIn\fR
397\&\fB\-fivopts \-fkeep\-inline\-functions \-fkeep\-static\-consts
398\&\-floop\-block \-floop\-flatten \-floop\-interchange \-floop\-strip\-mine
399\&\-floop\-parallelize\-all \-flto \-flto\-compression\-level
400\&\-flto\-partition=\fR\fIalg\fR \fB\-flto\-report \-fmerge\-all\-constants
401\&\-fmerge\-constants \-fmodulo\-sched \-fmodulo\-sched\-allow\-regmoves
402\&\-fmove\-loop\-invariants fmudflap \-fmudflapir \-fmudflapth \-fno\-branch\-count\-reg
404\&\-fno\-defer\-pop \-fno\-function\-cse \-fno\-guess\-branch\-probability
405\&\-fno\-inline \-fno\-math\-errno \-fno\-peephole \-fno\-peephole2
406\&\-fno\-sched\-interblock \-fno\-sched\-spec \-fno\-signed\-zeros
407\&\-fno\-toplevel\-reorder \-fno\-trapping\-math \-fno\-zero\-initialized\-in\-bss
408\&\-fomit\-frame\-pointer \-foptimize\-register\-move \-foptimize\-sibling\-calls
409\&\-fpartial\-inlining \-fpeel\-loops \-fpredictive\-commoning
411\&\-fprofile\-correction \-fprofile\-dir=\fR\fIpath\fR \fB\-fprofile\-generate
413\&\fB\-fprofile\-use \-fprofile\-use=\fR\fIpath\fR \fB\-fprofile\-values
414\&\-freciprocal\-math \-free \-fregmove \-frename\-registers \-freorder\-blocks
415\&\-freorder\-blocks\-and\-partition \-freorder\-functions
416\&\-frerun\-cse\-after\-loop \-freschedule\-modulo\-scheduled\-loops
417\&\-frounding\-math \-fsched2\-use\-superblocks \-fsched\-pressure
418\&\-fsched\-spec\-load \-fsched\-spec\-load\-dangerous
419\&\-fsched\-stalled\-insns\-dep[=\fR\fIn\fR\fB] \-fsched\-stalled\-insns[=\fR\fIn\fR\fB]
420\&\-fsched\-group\-heuristic \-fsched\-critical\-path\-heuristic
421\&\-fsched\-spec\-insn\-heuristic \-fsched\-rank\-heuristic
422\&\-fsched\-last\-insn\-heuristic \-fsched\-dep\-count\-heuristic
423\&\-fschedule\-insns \-fschedule\-insns2 \-fsection\-anchors
424\&\-fselective\-scheduling \-fselective\-scheduling2
425\&\-fsel\-sched\-pipelining \-fsel\-sched\-pipelining\-outer\-loops
426\&\-fshrink\-wrap \-fsignaling\-nans \-fsingle\-precision\-constant
427\&\-fsplit\-ivs\-in\-unroller \-fsplit\-wide\-types \-fstack\-protector
428\&\-fstack\-protector\-all \-fstrict\-aliasing \-fstrict\-overflow
429\&\-fthread\-jumps \-ftracer \-ftree\-bit\-ccp
430\&\-ftree\-builtin\-call\-dce \-ftree\-ccp \-ftree\-ch \-ftree\-copy\-prop
431\&\-ftree\-copyrename \-ftree\-dce \-ftree\-dominator\-opts \-ftree\-dse
432\&\-ftree\-forwprop \-ftree\-fre \-ftree\-loop\-if\-convert
433\&\-ftree\-loop\-if\-convert\-stores \-ftree\-loop\-im
434\&\-ftree\-phiprop \-ftree\-loop\-distribution \-ftree\-loop\-distribute\-patterns
435\&\-ftree\-loop\-ivcanon \-ftree\-loop\-linear \-ftree\-loop\-optimize
436\&\-ftree\-parallelize\-loops=\fR\fIn\fR \fB\-ftree\-pre \-ftree\-pta \-ftree\-reassoc
437\&\-ftree\-sink \-ftree\-sra \-ftree\-switch\-conversion \-ftree\-tail\-merge
438\&\-ftree\-ter \-ftree\-vect\-loop\-version \-ftree\-vectorize \-ftree\-vrp
439\&\-funit\-at\-a\-time \-funroll\-all\-loops \-funroll\-loops
440\&\-funsafe\-loop\-optimizations \-funsafe\-math\-optimizations \-funswitch\-loops
441\&\-fvariable\-expansion\-in\-unroller \-fvect\-cost\-model \-fvpt \-fweb
442\&\-fwhole\-program \-fwpa \-fuse\-linker\-plugin
443\&\-\-param\fR \fIname\fR\fB=\fR\fIvalue\fR
444\&\fB\-O \-O0 \-O1 \-O2 \-O3 \-Os \-Ofast\fR
445.IP "\fIPreprocessor Options\fR" 4
446.IX Item "Preprocessor Options"
449\&\fB\-C \-dD \-dI \-dM \-dN
450\&\-D\fR\fImacro\fR[\fB=\fR\fIdefn\fR] \fB\-E \-H
451\&\-idirafter\fR \fIdir\fR
452\&\fB\-include\fR \fIfile\fR \fB\-imacros\fR \fIfile\fR
453\&\fB\-iprefix\fR \fIfile\fR \fB\-iwithprefix\fR \fIdir\fR
454\&\fB\-iwithprefixbefore\fR \fIdir\fR \fB\-isystem\fR \fIdir\fR
455\&\fB\-imultilib\fR \fIdir\fR \fB\-isysroot\fR \fIdir\fR
456\&\fB\-M \-MM \-MF \-MG \-MP \-MQ \-MT \-nostdinc
457\&\-P \-fdebug\-cpp \-ftrack\-macro\-expansion \-fworking\-directory
458\&\-remap \-trigraphs \-undef \-U\fR\fImacro\fR
459\&\fB\-Wp,\fR\fIoption\fR \fB\-Xpreprocessor\fR \fIoption\fR
460.IP "\fIAssembler Option\fR" 4
461.IX Item "Assembler Option"
462\&\fB\-Wa,\fR\fIoption\fR \fB\-Xassembler\fR \fIoption\fR
463.IP "\fILinker Options\fR" 4
464.IX Item "Linker Options"
465\&\fIobject-file-name\fR \fB\-l\fR\fIlibrary\fR
466\&\fB\-nostartfiles \-nodefaultlibs \-nostdlib \-pie \-rdynamic
467\&\-s \-static \-static\-libgcc \-static\-libstdc++ \-shared
468\&\-shared\-libgcc \-symbolic
469\&\-T\fR \fIscript\fR \fB\-Wl,\fR\fIoption\fR \fB\-Xlinker\fR \fIoption\fR
470\&\fB\-u\fR \fIsymbol\fR
471.IP "\fIDirectory Options\fR" 4
472.IX Item "Directory Options"
473\&\fB\-B\fR\fIprefix\fR \fB\-I\fR\fIdir\fR \fB\-iplugindir=\fR\fIdir\fR
474\&\fB\-iquote\fR\fIdir\fR \fB\-L\fR\fIdir\fR \fB\-specs=\fR\fIfile\fR \fB\-I\-
476.IP "\fIMachine Dependent Options\fR" 4
477.IX Item "Machine Dependent Options"
478\&\fIAdapteva Epiphany Options\fR
479\&\fB\-mhalf\-reg\-file \-mprefer\-short\-insn\-regs
480\&\-mbranch\-cost=\fR\fInum\fR \fB\-mcmove \-mnops=\fR\fInum\fR \fB\-msoft\-cmpsf
481\&\-msplit\-lohi \-mpost\-inc \-mpost\-modify \-mstack\-offset=\fR\fInum\fR
482\&\fB\-mround\-nearest \-mlong\-calls \-mshort\-calls \-msmall16
483\&\-mfp\-mode=\fR\fImode\fR \fB\-mvect\-double \-max\-vect\-align=\fR\fInum\fR
484\&\fB\-msplit\-vecmove\-early \-m1reg\-\fR\fIreg\fR
486\&\fI\s-1ARM\s0 Options\fR
487\&\fB\-mapcs\-frame \-mno\-apcs\-frame
489\&\fB\-mapcs\-stack\-check \-mno\-apcs\-stack\-check
490\&\-mapcs\-float \-mno\-apcs\-float
491\&\-mapcs\-reentrant \-mno\-apcs\-reentrant
492\&\-msched\-prolog \-mno\-sched\-prolog
493\&\-mlittle\-endian \-mbig\-endian \-mwords\-little\-endian
494\&\-mfloat\-abi=\fR\fIname\fR \fB\-mfpe
496\&\fB\-mthumb\-interwork \-mno\-thumb\-interwork
497\&\-mcpu=\fR\fIname\fR \fB\-march=\fR\fIname\fR \fB\-mfpu=\fR\fIname\fR
500\&\-mlong\-calls \-mno\-long\-calls
501\&\-msingle\-pic\-base \-mno\-single\-pic\-base
504\&\-mcirrus\-fix\-invalid\-insns \-mno\-cirrus\-fix\-invalid\-insns
506\&\-mthumb \-marm
507\&\-mtpcs\-frame \-mtpcs\-leaf\-frame
508\&\-mcaller\-super\-interworking \-mcallee\-super\-interworking
509\&\-mtp=\fR\fIname\fR \fB\-mtls\-dialect=\fR\fIdialect\fR
514\&\fI\s-1AVR\s0 Options\fR
515\&\fB\-mmcu=\fR\fImcu\fR \fB\-maccumulate\-args \-mbranch\-cost=\fR\fIcost\fR
516\&\fB\-mcall\-prologues \-mint8 \-mno\-interrupts \-mrelax \-mshort\-calls
517\&\-mstrict\-X \-mtiny\-stack\fR
519\&\fIBlackfin Options\fR
521\&\fB\-msim \-momit\-leaf\-frame\-pointer \-mno\-omit\-leaf\-frame\-pointer
522\&\-mspecld\-anomaly \-mno\-specld\-anomaly \-mcsync\-anomaly \-mno\-csync\-anomaly
523\&\-mlow\-64k \-mno\-low64k \-mstack\-check\-l1 \-mid\-shared\-library
524\&\-mno\-id\-shared\-library \-mshared\-library\-id=\fR\fIn\fR
525\&\fB\-mleaf\-id\-shared\-library \-mno\-leaf\-id\-shared\-library
526\&\-msep\-data \-mno\-sep\-data \-mlong\-calls \-mno\-long\-calls
527\&\-mfast\-fp \-minline\-plt \-mmulticore \-mcorea \-mcoreb \-msdram
530\&\fIC6X Options\fR
531\&\fB\-mbig\-endian \-mlittle\-endian \-march=\fR\fIcpu\fR
532\&\fB\-msim \-msdata=\fR\fIsdata-type\fR
534\&\fI\s-1CRIS\s0 Options\fR
535\&\fB\-mcpu=\fR\fIcpu\fR \fB\-march=\fR\fIcpu\fR \fB\-mtune=\fR\fIcpu\fR
536\&\fB\-mmax\-stack\-frame=\fR\fIn\fR \fB\-melinux\-stacksize=\fR\fIn\fR
537\&\fB\-metrax4 \-metrax100 \-mpdebug \-mcc\-init \-mno\-side\-effects
538\&\-mstack\-align \-mdata\-align \-mconst\-align
539\&\-m32\-bit \-m16\-bit \-m8\-bit \-mno\-prologue\-epilogue \-mno\-gotplt
540\&\-melf \-maout \-melinux \-mlinux \-sim \-sim2
541\&\-mmul\-bug\-workaround \-mno\-mul\-bug\-workaround\fR
543\&\fI\s-1CR16\s0 Options\fR
545\&\-mcr16cplus \-mcr16c
546\&\-msim \-mint32 \-mbit\-ops
549\&\fIDarwin Options\fR
550\&\fB\-all_load \-allowable_client \-arch \-arch_errors_fatal
551\&\-arch_only \-bind_at_load \-bundle \-bundle_loader
552\&\-client_name \-compatibility_version \-current_version
554\&\-dependency\-file \-dylib_file \-dylinker_install_name
555\&\-dynamic \-dynamiclib \-exported_symbols_list
556\&\-filelist \-flat_namespace \-force_cpusubtype_ALL
557\&\-force_flat_namespace \-headerpad_max_install_names
559\&\-image_base \-init \-install_name \-keep_private_externs
560\&\-multi_module \-multiply_defined \-multiply_defined_unused
561\&\-noall_load \-no_dead_strip_inits_and_terms
562\&\-nofixprebinding \-nomultidefs \-noprebind \-noseglinkedit
563\&\-pagezero_size \-prebind \-prebind_all_twolevel_modules
564\&\-private_bundle \-read_only_relocs \-sectalign
565\&\-sectobjectsymbols \-whyload \-seg1addr
566\&\-sectcreate \-sectobjectsymbols \-sectorder
567\&\-segaddr \-segs_read_only_addr \-segs_read_write_addr
568\&\-seg_addr_table \-seg_addr_table_filename \-seglinkedit
569\&\-segprot \-segs_read_only_addr \-segs_read_write_addr
570\&\-single_module \-static \-sub_library \-sub_umbrella
571\&\-twolevel_namespace \-umbrella \-undefined
572\&\-unexported_symbols_list \-weak_reference_mismatches
573\&\-whatsloaded \-F \-gused \-gfull \-mmacosx\-version\-min=\fR\fIversion\fR
574\&\fB\-mkernel \-mone\-byte\-bool\fR
576\&\fI\s-1DEC\s0 Alpha Options\fR
577\&\fB\-mno\-fp\-regs \-msoft\-float \-malpha\-as \-mgas
578\&\-mieee \-mieee\-with\-inexact \-mieee\-conformant
579\&\-mfp\-trap\-mode=\fR\fImode\fR \fB\-mfp\-rounding\-mode=\fR\fImode\fR
580\&\fB\-mtrap\-precision=\fR\fImode\fR \fB\-mbuild\-constants
581\&\-mcpu=\fR\fIcpu-type\fR \fB\-mtune=\fR\fIcpu-type\fR
582\&\fB\-mbwx \-mmax \-mfix \-mcix
583\&\-mfloat\-vax \-mfloat\-ieee
584\&\-mexplicit\-relocs \-msmall\-data \-mlarge\-data
585\&\-msmall\-text \-mlarge\-text
588\&\fI\s-1DEC\s0 Alpha/VMS Options\fR
589\&\fB\-mvms\-return\-codes \-mdebug\-main=\fR\fIprefix\fR \fB\-mmalloc64\fR
591\&\fI\s-1FR30\s0 Options\fR
592\&\fB\-msmall\-model \-mno\-lsim\fR
594\&\fI\s-1FRV\s0 Options\fR
595\&\fB\-mgpr\-32 \-mgpr\-64 \-mfpr\-32 \-mfpr\-64
596\&\-mhard\-float \-msoft\-float
597\&\-malloc\-cc \-mfixed\-cc \-mdword \-mno\-dword
598\&\-mdouble \-mno\-double
599\&\-mmedia \-mno\-media \-mmuladd \-mno\-muladd
600\&\-mfdpic \-minline\-plt \-mgprel\-ro \-multilib\-library\-pic
601\&\-mlinked\-fp \-mlong\-calls \-malign\-labels
602\&\-mlibrary\-pic \-macc\-4 \-macc\-8
603\&\-mpack \-mno\-pack \-mno\-eflags \-mcond\-move \-mno\-cond\-move
604\&\-moptimize\-membar \-mno\-optimize\-membar
605\&\-mscc \-mno\-scc \-mcond\-exec \-mno\-cond\-exec
606\&\-mvliw\-branch \-mno\-vliw\-branch
607\&\-mmulti\-cond\-exec \-mno\-multi\-cond\-exec \-mnested\-cond\-exec
608\&\-mno\-nested\-cond\-exec \-mtomcat\-stats
609\&\-mTLS \-mtls
612\&\fIGNU/Linux Options\fR
613\&\fB\-mglibc \-muclibc \-mbionic \-mandroid
614\&\-tno\-android\-cc \-tno\-android\-ld\fR
616\&\fIH8/300 Options\fR
617\&\fB\-mrelax \-mh \-ms \-mn \-mint32 \-malign\-300\fR
619\&\fI\s-1HPPA\s0 Options\fR
621\&\fB\-mbig\-switch \-mdisable\-fpregs \-mdisable\-indexing
622\&\-mfast\-indirect\-calls \-mgas \-mgnu\-ld \-mhp\-ld
624\&\fB\-mjump\-in\-delay \-mlinker\-opt \-mlong\-calls
625\&\-mlong\-load\-store \-mno\-big\-switch \-mno\-disable\-fpregs
626\&\-mno\-disable\-indexing \-mno\-fast\-indirect\-calls \-mno\-gas
627\&\-mno\-jump\-in\-delay \-mno\-long\-load\-store
628\&\-mno\-portable\-runtime \-mno\-soft\-float
629\&\-mno\-space\-regs \-msoft\-float \-mpa\-risc\-1\-0
630\&\-mpa\-risc\-1\-1 \-mpa\-risc\-2\-0 \-mportable\-runtime
631\&\-mschedule=\fR\fIcpu-type\fR \fB\-mspace\-regs \-msio \-mwsio
632\&\-munix=\fR\fIunix-std\fR \fB\-nolibdld \-static \-threads\fR
634\&\fIi386 and x86\-64 Options\fR
635\&\fB\-mtune=\fR\fIcpu-type\fR \fB\-march=\fR\fIcpu-type\fR
637\&\fB\-masm=\fR\fIdialect\fR \fB\-mno\-fancy\-math\-387
638\&\-mno\-fp\-ret\-in\-387 \-msoft\-float
639\&\-mno\-wide\-multiply \-mrtd \-malign\-double
642\&\fB\-mcld \-mcx16 \-msahf \-mmovbe \-mcrc32
643\&\-mrecip \-mrecip=\fR\fIopt\fR
5ce9237c 644\&\fB\-mvzeroupper \-mprefer\-avx128
645\&\-mmmx \-msse \-msse2 \-msse3 \-mssse3 \-msse4.1 \-msse4.2 \-msse4 \-mavx
646\&\-mavx2 \-maes \-mpclmul \-mfsgsbase \-mrdrnd \-mf16c \-mfma
647\&\-msse4a \-m3dnow \-mpopcnt \-mabm \-mbmi \-mtbm \-mfma4 \-mxop \-mlzcnt
648\&\-mbmi2 \-mlwp \-mthreads \-mno\-align\-stringops \-minline\-all\-stringops
649\&\-minline\-stringops\-dynamically \-mstringop\-strategy=\fR\fIalg\fR
650\&\fB\-mpush\-args \-maccumulate\-outgoing\-args \-m128bit\-long\-double
651\&\-m96bit\-long\-double \-mregparm=\fR\fInum\fR \fB\-msseregparm
652\&\-mveclibabi=\fR\fItype\fR \fB\-mvect8\-ret\-in\-mem
653\&\-mpc32 \-mpc64 \-mpc80 \-mstackrealign
654\&\-momit\-leaf\-frame\-pointer \-mno\-red\-zone \-mno\-tls\-direct\-seg\-refs
655\&\-mcmodel=\fR\fIcode-model\fR \fB\-mabi=\fR\fIname\fR
656\&\fB\-m32 \-m64 \-mx32 \-mlarge\-data\-threshold=\fR\fInum\fR
657\&\fB\-msse2avx \-mfentry \-m8bit\-idiv
658\&\-mavx256\-split\-unaligned\-load \-mavx256\-split\-unaligned\-store\fR
660\&\fIi386 and x86\-64 Windows Options\fR
661\&\fB\-mconsole \-mcygwin \-mno\-cygwin \-mdll
662\&\-mnop\-fun\-dllimport \-mthread
663\&\-municode \-mwin32 \-mwindows \-fno\-set\-stack\-executable\fR
665\&\fI\s-1IA\-64\s0 Options\fR
666\&\fB\-mbig\-endian \-mlittle\-endian \-mgnu\-as \-mgnu\-ld \-mno\-pic
667\&\-mvolatile\-asm\-stop \-mregister\-names \-msdata \-mno\-sdata
668\&\-mconstant\-gp \-mauto\-pic \-mfused\-madd
675\&\-minline\-sqrt\-min\-latency \-minline\-sqrt\-max\-throughput
677\&\-mdwarf2\-asm \-mearly\-stop\-bits
678\&\-mfixed\-range=\fR\fIregister-range\fR \fB\-mtls\-size=\fR\fItls-size\fR
679\&\fB\-mtune=\fR\fIcpu-type\fR \fB\-milp32 \-mlp64
680\&\-msched\-br\-data\-spec \-msched\-ar\-data\-spec \-msched\-control\-spec
681\&\-msched\-br\-in\-data\-spec \-msched\-ar\-in\-data\-spec \-msched\-in\-control\-spec
682\&\-msched\-spec\-ldc \-msched\-spec\-control\-ldc
683\&\-msched\-prefer\-non\-data\-spec\-insns \-msched\-prefer\-non\-control\-spec\-insns
684\&\-msched\-stop\-bits\-after\-every\-cycle \-msched\-count\-spec\-in\-critical\-path
685\&\-msel\-sched\-dont\-check\-control\-spec \-msched\-fp\-mem\-deps\-zero\-cost
686\&\-msched\-max\-memory\-insns\-hard\-limit \-msched\-max\-memory\-insns=\fR\fImax-insns\fR
688\&\fI\s-1IA\-64/VMS\s0 Options\fR
689\&\fB\-mvms\-return\-codes \-mdebug\-main=\fR\fIprefix\fR \fB\-mmalloc64\fR
691\&\fI\s-1LM32\s0 Options\fR
692\&\fB\-mbarrel\-shift\-enabled \-mdivide\-enabled \-mmultiply\-enabled
693\&\-msign\-extend\-enabled \-muser\-enabled\fR
695\&\fIM32R/D Options\fR
696\&\fB\-m32r2 \-m32rx \-m32r
698\&\-malign\-loops \-mno\-align\-loops
703\&\fB\-mno\-flush\-func \-mflush\-func=\fR\fIname\fR
704\&\fB\-mno\-flush\-trap \-mflush\-trap=\fR\fInumber\fR
705\&\fB\-G\fR \fInum\fR
707\&\fIM32C Options\fR
708\&\fB\-mcpu=\fR\fIcpu\fR \fB\-msim \-memregs=\fR\fInumber\fR
710\&\fIM680x0 Options\fR
711\&\fB\-march=\fR\fIarch\fR \fB\-mcpu=\fR\fIcpu\fR \fB\-mtune=\fR\fItune\fR
712\&\fB\-m68000 \-m68020 \-m68020\-40 \-m68020\-60 \-m68030 \-m68040
713\&\-m68060 \-mcpu32 \-m5200 \-m5206e \-m528x \-m5307 \-m5407
714\&\-mcfv4e \-mbitfield \-mno\-bitfield \-mc68000 \-mc68020
715\&\-mnobitfield \-mrtd \-mno\-rtd \-mdiv \-mno\-div \-mshort
716\&\-mno\-short \-mhard\-float \-m68881 \-msoft\-float \-mpcrel
717\&\-malign\-int \-mstrict\-align \-msep\-data \-mno\-sep\-data
718\&\-mshared\-library\-id=n \-mid\-shared\-library \-mno\-id\-shared\-library
719\&\-mxgot \-mno\-xgot\fR
721\&\fIMCore Options\fR
722\&\fB\-mhardlit \-mno\-hardlit \-mdiv \-mno\-div \-mrelax\-immediates
723\&\-mno\-relax\-immediates \-mwide\-bitfields \-mno\-wide\-bitfields
724\&\-m4byte\-functions \-mno\-4byte\-functions \-mcallgraph\-data
725\&\-mno\-callgraph\-data \-mslow\-bytes \-mno\-slow\-bytes \-mno\-lsim
726\&\-mlittle\-endian \-mbig\-endian \-m210 \-m340 \-mstack\-increment\fR
728\&\fIMeP Options\fR
729\&\fB\-mabsdiff \-mall\-opts \-maverage \-mbased=\fR\fIn\fR \fB\-mbitops
730\&\-mc=\fR\fIn\fR \fB\-mclip \-mconfig=\fR\fIname\fR \fB\-mcop \-mcop32 \-mcop64 \-mivc2
731\&\-mdc \-mdiv \-meb \-mel \-mio\-volatile \-ml \-mleadz \-mm \-mminmax
732\&\-mmult \-mno\-opts \-mrepeat \-ms \-msatur \-msdram \-msim \-msimnovec \-mtf
735\&\fIMicroBlaze Options\fR
736\&\fB\-msoft\-float \-mhard\-float \-msmall\-divides \-mcpu=\fR\fIcpu\fR
737\&\fB\-mmemcpy \-mxl\-soft\-mul \-mxl\-soft\-div \-mxl\-barrel\-shift
738\&\-mxl\-pattern\-compare \-mxl\-stack\-check \-mxl\-gp\-opt \-mno\-clearbss
739\&\-mxl\-multiply\-high \-mxl\-float\-convert \-mxl\-float\-sqrt
742\&\fI\s-1MIPS\s0 Options\fR
743\&\fB\-EL \-EB \-march=\fR\fIarch\fR \fB\-mtune=\fR\fIarch\fR
744\&\fB\-mips1 \-mips2 \-mips3 \-mips4 \-mips32 \-mips32r2
745\&\-mips64 \-mips64r2
746\&\-mips16 \-mno\-mips16 \-mflip\-mips16
747\&\-minterlink\-mips16 \-mno\-interlink\-mips16
748\&\-mabi=\fR\fIabi\fR \fB\-mabicalls \-mno\-abicalls
749\&\-mshared \-mno\-shared \-mplt \-mno\-plt \-mxgot \-mno\-xgot
750\&\-mgp32 \-mgp64 \-mfp32 \-mfp64 \-mhard\-float \-msoft\-float
751\&\-msingle\-float \-mdouble\-float \-mdsp \-mno\-dsp \-mdspr2 \-mno\-dspr2
753\&\fB\-msmartmips \-mno\-smartmips
754\&\-mpaired\-single \-mno\-paired\-single \-mdmx \-mno\-mdmx
755\&\-mips3d \-mno\-mips3d \-mmt \-mno\-mt \-mllsc \-mno\-llsc
756\&\-mlong64 \-mlong32 \-msym32 \-mno\-sym32
757\&\-G\fR\fInum\fR \fB\-mlocal\-sdata \-mno\-local\-sdata
758\&\-mextern\-sdata \-mno\-extern\-sdata \-mgpopt \-mno\-gopt
759\&\-membedded\-data \-mno\-embedded\-data
760\&\-muninit\-const\-in\-rodata \-mno\-uninit\-const\-in\-rodata
762\&\fB\-msplit\-addresses \-mno\-split\-addresses
763\&\-mexplicit\-relocs \-mno\-explicit\-relocs
764\&\-mcheck\-zero\-division \-mno\-check\-zero\-division
765\&\-mdivide\-traps \-mdivide\-breaks
766\&\-mmemcpy \-mno\-memcpy \-mlong\-calls \-mno\-long\-calls
767\&\-mmad \-mno\-mad \-mfused\-madd \-mno\-fused\-madd \-nocpp
768\&\-mfix\-24k \-mno\-fix\-24k
769\&\-mfix\-r4000 \-mno\-fix\-r4000 \-mfix\-r4400 \-mno\-fix\-r4400
770\&\-mfix\-r10000 \-mno\-fix\-r10000 \-mfix\-vr4120 \-mno\-fix\-vr4120
771\&\-mfix\-vr4130 \-mno\-fix\-vr4130 \-mfix\-sb1 \-mno\-fix\-sb1
772\&\-mflush\-func=\fR\fIfunc\fR \fB\-mno\-flush\-func
773\&\-mbranch\-cost=\fR\fInum\fR \fB\-mbranch\-likely \-mno\-branch\-likely
774\&\-mfp\-exceptions \-mno\-fp\-exceptions
775\&\-mvr4130\-align \-mno\-vr4130\-align \-msynci \-mno\-synci
776\&\-mrelax\-pic\-calls \-mno\-relax\-pic\-calls \-mmcount\-ra\-address\fR
778\&\fI\s-1MMIX\s0 Options\fR
779\&\fB\-mlibfuncs \-mno\-libfuncs \-mepsilon \-mno\-epsilon \-mabi=gnu
780\&\-mabi=mmixware \-mzero\-extend \-mknuthdiv \-mtoplevel\-symbols
781\&\-melf \-mbranch\-predict \-mno\-branch\-predict \-mbase\-addresses
782\&\-mno\-base\-addresses \-msingle\-exit \-mno\-single\-exit\fR
784\&\fI\s-1MN10300\s0 Options\fR
785\&\fB\-mmult\-bug \-mno\-mult\-bug
786\&\-mno\-am33 \-mam33 \-mam33\-2 \-mam34
789\&\-mno\-crt0 \-mrelax \-mliw \-msetlb\fR
791\&\fI\s-1PDP\-11\s0 Options\fR
792\&\fB\-mfpu \-msoft\-float \-mac0 \-mno\-ac0 \-m40 \-m45 \-m10
793\&\-mbcopy \-mbcopy\-builtin \-mint32 \-mno\-int16
794\&\-mint16 \-mno\-int32 \-mfloat32 \-mno\-float64
795\&\-mfloat64 \-mno\-float32 \-mabshi \-mno\-abshi
796\&\-mbranch\-expensive \-mbranch\-cheap
797\&\-munix\-asm \-mdec\-asm\fR
799\&\fIpicoChip Options\fR
800\&\fB\-mae=\fR\fIae_type\fR \fB\-mvliw\-lookahead=\fR\fIN\fR
801\&\fB\-msymbol\-as\-address \-mno\-inefficient\-warnings\fR
803\&\fIPowerPC Options\fR
804See \s-1RS/6000\s0 and PowerPC Options.
806\&\fI\s-1RL78\s0 Options\fR
807\&\fB\-msim \-mmul=none \-mmul=g13 \-mmul=rl78\fR
809\&\fI\s-1RS/6000\s0 and PowerPC Options\fR
813\&\fB\-mpower \-mno\-power \-mpower2 \-mno\-power2
814\&\-mpowerpc \-mpowerpc64 \-mno\-powerpc
815\&\-maltivec \-mno\-altivec
816\&\-mpowerpc\-gpopt \-mno\-powerpc\-gpopt
817\&\-mpowerpc\-gfxopt \-mno\-powerpc\-gfxopt
818\&\-mmfcrf \-mno\-mfcrf \-mpopcntb \-mno\-popcntb \-mpopcntd \-mno\-popcntd
819\&\-mfprnd \-mno\-fprnd
820\&\-mcmpb \-mno\-cmpb \-mmfpgpr \-mno\-mfpgpr \-mhard\-dfp \-mno\-hard\-dfp
821\&\-mnew\-mnemonics \-mold\-mnemonics
822\&\-mfull\-toc \-mminimal\-toc \-mno\-fp\-in\-toc \-mno\-sum\-in\-toc
823\&\-m64 \-m32 \-mxl\-compat \-mno\-xl\-compat \-mpe
824\&\-malign\-power \-malign\-natural
825\&\-msoft\-float \-mhard\-float \-mmultiple \-mno\-multiple
826\&\-msingle\-float \-mdouble\-float \-msimple\-fpu
827\&\-mstring \-mno\-string \-mupdate \-mno\-update
828\&\-mavoid\-indexed\-addresses \-mno\-avoid\-indexed\-addresses
829\&\-mfused\-madd \-mno\-fused\-madd \-mbit\-align \-mno\-bit\-align
830\&\-mstrict\-align \-mno\-strict\-align \-mrelocatable
831\&\-mno\-relocatable \-mrelocatable\-lib \-mno\-relocatable\-lib
832\&\-mtoc \-mno\-toc \-mlittle \-mlittle\-endian \-mbig \-mbig\-endian
833\&\-mdynamic\-no\-pic \-maltivec \-mswdiv \-msingle\-pic\-base
837\&\fB\-mcall\-sysv \-mcall\-netbsd
838\&\-maix\-struct\-return \-msvr4\-struct\-return
839\&\-mabi=\fR\fIabi-type\fR \fB\-msecure\-plt \-mbss\-plt
841\&\fB\-misel \-mno\-isel
842\&\-misel=yes \-misel=no
843\&\-mspe \-mno\-spe
844\&\-mspe=yes \-mspe=no
846\&\-mgen\-cell\-microcode \-mwarn\-cell\-microcode
847\&\-mvrsave \-mno\-vrsave
848\&\-mmulhw \-mno\-mulhw
849\&\-mdlmzb \-mno\-dlmzb
850\&\-mfloat\-gprs=yes \-mfloat\-gprs=no \-mfloat\-gprs=single \-mfloat\-gprs=double
851\&\-mprototype \-mno\-prototype
852\&\-msim \-mmvme \-mads \-myellowknife \-memb \-msdata
853\&\-msdata=\fR\fIopt\fR \fB\-mvxworks \-G\fR \fInum\fR \fB\-pthread
854\&\-mrecip \-mrecip=\fR\fIopt\fR \fB\-mno\-recip \-mrecip\-precision
856\&\-mveclibabi=\fR\fItype\fR \fB\-mfriz \-mno\-friz
857\&\-mpointers\-to\-nested\-functions \-mno\-pointers\-to\-nested\-functions
858\&\-msave\-toc\-indirect \-mno\-save\-toc\-indirect\fR
860\&\fI\s-1RX\s0 Options\fR
861\&\fB\-m64bit\-doubles \-m32bit\-doubles \-fpu \-nofpu
863\&\-mbig\-endian\-data \-mlittle\-endian\-data
865\&\-msim \-mno\-sim
866\&\-mas100\-syntax \-mno\-as100\-syntax
873\&\fIS/390 and zSeries Options\fR
874\&\fB\-mtune=\fR\fIcpu-type\fR \fB\-march=\fR\fIcpu-type\fR
875\&\fB\-mhard\-float \-msoft\-float \-mhard\-dfp \-mno\-hard\-dfp
876\&\-mlong\-double\-64 \-mlong\-double\-128
877\&\-mbackchain \-mno\-backchain \-mpacked\-stack \-mno\-packed\-stack
878\&\-msmall\-exec \-mno\-small\-exec \-mmvcle \-mno\-mvcle
879\&\-m64 \-m31 \-mdebug \-mno\-debug \-mesa \-mzarch
880\&\-mtpf\-trace \-mno\-tpf\-trace \-mfused\-madd \-mno\-fused\-madd
881\&\-mwarn\-framesize \-mwarn\-dynamicstack \-mstack\-size \-mstack\-guard\fR
883\&\fIScore Options\fR
884\&\fB\-meb \-mel
888\&\-mscore5 \-mscore5u \-mscore7 \-mscore7d\fR
890\&\fI\s-1SH\s0 Options\fR
891\&\fB\-m1 \-m2 \-m2e
892\&\-m2a\-nofpu \-m2a\-single\-only \-m2a\-single \-m2a
893\&\-m3 \-m3e
894\&\-m4\-nofpu \-m4\-single\-only \-m4\-single \-m4
895\&\-m4a\-nofpu \-m4a\-single\-only \-m4a\-single \-m4a \-m4al
896\&\-m5\-64media \-m5\-64media\-nofpu
897\&\-m5\-32media \-m5\-32media\-nofpu
898\&\-m5\-compact \-m5\-compact\-nofpu
899\&\-mb \-ml \-mdalign \-mrelax
900\&\-mbigtable \-mfmovd \-mhitachi \-mrenesas \-mno\-renesas \-mnomacsave
901\&\-mieee \-mno\-ieee \-mbitops \-misize \-minline\-ic_invalidate \-mpadstruct
902\&\-mspace \-mprefergot \-musermode \-multcost=\fR\fInumber\fR \fB\-mdiv=\fR\fIstrategy\fR
903\&\fB\-mdivsi3_libfunc=\fR\fIname\fR \fB\-mfixed\-range=\fR\fIregister-range\fR
904\&\fB\-madjust\-unroll \-mindexed\-addressing \-mgettrcost=\fR\fInumber\fR \fB\-mpt\-fixed
905\&\-maccumulate\-outgoing\-args \-minvalid\-symbols \-msoft\-atomic
906\&\-mbranch\-cost=\fR\fInum\fR \fB\-mcbranchdi \-mcmpeqdi \-mfused\-madd \-mpretend\-cmove\fR
908\&\fISolaris 2 Options\fR
909\&\fB\-mimpure\-text \-mno\-impure\-text
910\&\-pthreads \-pthread\fR
912\&\fI\s-1SPARC\s0 Options\fR
917\&\fB\-m32 \-m64 \-mapp\-regs \-mno\-app\-regs
918\&\-mfaster\-structs \-mno\-faster\-structs \-mflat \-mno\-flat
919\&\-mfpu \-mno\-fpu \-mhard\-float \-msoft\-float
920\&\-mhard\-quad\-float \-msoft\-quad\-float
921\&\-mstack\-bias \-mno\-stack\-bias
922\&\-munaligned\-doubles \-mno\-unaligned\-doubles
923\&\-mv8plus \-mno\-v8plus \-mvis \-mno\-vis
924\&\-mvis2 \-mno\-vis2 \-mvis3 \-mno\-vis3
925\&\-mfmaf \-mno\-fmaf \-mpopc \-mno\-popc
928\&\fI\s-1SPU\s0 Options\fR
929\&\fB\-mwarn\-reloc \-merror\-reloc
930\&\-msafe\-dma \-munsafe\-dma
932\&\-msmall\-mem \-mlarge\-mem \-mstdmain
934\&\fB\-mea32 \-mea64
935\&\-maddress\-space\-conversion \-mno\-address\-space\-conversion
937\&\fB\-matomic\-updates \-mno\-atomic\-updates\fR
939\&\fISystem V Options\fR
940\&\fB\-Qy \-Qn \-YP,\fR\fIpaths\fR \fB\-Ym,\fR\fIdir\fR
942\&\fITILE-Gx Options\fR
943\&\fB\-mcpu=\fR\fIcpu\fR \fB\-m32 \-m64\fR
945\&\fITILEPro Options\fR
946\&\fB\-mcpu=\fR\fIcpu\fR \fB\-m32\fR
948\&\fIV850 Options\fR
949\&\fB\-mlong\-calls \-mno\-long\-calls \-mep \-mno\-ep
950\&\-mprolog\-function \-mno\-prolog\-function \-mspace
951\&\-mtda=\fR\fIn\fR \fB\-msda=\fR\fIn\fR \fB\-mzda=\fR\fIn\fR
952\&\fB\-mapp\-regs \-mno\-app\-regs
953\&\-mdisable\-callt \-mno\-disable\-callt
956\&\-mv850e1 \-mv850es
958\&\-mv850 \-mbig\-switch\fR
960\&\fI\s-1VAX\s0 Options\fR
961\&\fB\-mg \-mgnu \-munix\fR
963\&\fIVxWorks Options\fR
964\&\fB\-mrtp \-non\-static \-Bstatic \-Bdynamic
965\&\-Xbind\-lazy \-Xbind\-now\fR
967\&\fIx86\-64 Options\fR
968See i386 and x86\-64 Options.
970\&\fIXstormy16 Options\fR
973\&\fIXtensa Options\fR
974\&\fB\-mconst16 \-mno\-const16
975\&\-mfused\-madd \-mno\-fused\-madd
977\&\-mserialize\-volatile \-mno\-serialize\-volatile
978\&\-mtext\-section\-literals \-mno\-text\-section\-literals
979\&\-mtarget\-align \-mno\-target\-align
980\&\-mlongcalls \-mno\-longcalls\fR
982\&\fIzSeries Options\fR
983See S/390 and zSeries Options.
984.IP "\fICode Generation Options\fR" 4
985.IX Item "Code Generation Options"
986\&\fB\-fcall\-saved\-\fR\fIreg\fR \fB\-fcall\-used\-\fR\fIreg\fR
987\&\fB\-ffixed\-\fR\fIreg\fR \fB\-fexceptions
988\&\-fnon\-call\-exceptions \-funwind\-tables
990\&\-finhibit\-size\-directive \-finstrument\-functions
993\&\-fno\-common \-fno\-ident
994\&\-fpcc\-struct\-return \-fpic \-fPIC \-fpie \-fPIE
997\&\-freg\-struct\-return \-fshort\-enums
998\&\-fshort\-double \-fshort\-wchar
999\&\-fverbose\-asm \-fpack\-struct[=\fR\fIn\fR\fB] \-fstack\-check
1000\&\-fstack\-limit\-register=\fR\fIreg\fR \fB\-fstack\-limit\-symbol=\fR\fIsym\fR
1001\&\fB\-fno\-stack\-limit \-fsplit\-stack
1002\&\-fleading\-underscore \-ftls\-model=\fR\fImodel\fR
1003\&\fB\-ftrapv \-fwrapv \-fbounds\-check
1004\&\-fvisibility \-fstrict\-volatile\-bitfields\fR
5ce9237c 1005.Sh "Options Controlling the Kind of Output"
1006.IX Subsection "Options Controlling the Kind of Output"
1007Compilation can involve up to four stages: preprocessing, compilation
1008proper, assembly and linking, always in that order. \s-1GCC\s0 is capable of
1009preprocessing and compiling several files either into several
1010assembler input files, or into one assembler input file; then each
1011assembler input file produces an object file, and linking combines all
1012the object files (those newly compiled, and those specified as input)
1013into an executable file.
1015For any given input file, the file name suffix determines what kind of
1016compilation is done:
1017.IP "\fIfile\fR\fB.c\fR" 4
1018.IX Item "file.c"
1019C source code that must be preprocessed.
1020.IP "\fIfile\fR\fB.i\fR" 4
1021.IX Item "file.i"
1022C source code that should not be preprocessed.
1023.IP "\fIfile\fR\fB.ii\fR" 4
1024.IX Item "file.ii"
1025\&\*(C+ source code that should not be preprocessed.
1026.IP "\fIfile\fR\fB.m\fR" 4
1027.IX Item "file.m"
1028Objective-C source code. Note that you must link with the \fIlibobjc\fR
1029library to make an Objective-C program work.
1030.IP "\fIfile\fR\fB.mi\fR" 4
1031.IX Item "file.mi"
1032Objective-C source code that should not be preprocessed.
1033.IP "\fIfile\fR\\fR" 4
1034.IX Item ""
1035.PD 0
1036.IP "\fIfile\fR\fB.M\fR" 4
1037.IX Item "file.M"
1039Objective\-\*(C+ source code. Note that you must link with the \fIlibobjc\fR
1040library to make an Objective\-\*(C+ program work. Note that \fB.M\fR refers
1041to a literal capital M.
1042.IP "\fIfile\fR\fB.mii\fR" 4
1043.IX Item "file.mii"
1044Objective\-\*(C+ source code that should not be preprocessed.
1045.IP "\fIfile\fR\fB.h\fR" 4
1046.IX Item "file.h"
1047C, \*(C+, Objective-C or Objective\-\*(C+ header file to be turned into a
1048precompiled header (default), or C, \*(C+ header file to be turned into an
1049Ada spec (via the \fB\-fdump\-ada\-spec\fR switch).
1050.IP "\fIfile\fR\\fR" 4
1051.IX Item ""
1052.PD 0
1053.IP "\fIfile\fR\fB.cp\fR" 4
1054.IX Item "file.cp"
1055.IP "\fIfile\fR\fB.cxx\fR" 4
1056.IX Item "file.cxx"
1057.IP "\fIfile\fR\fB.cpp\fR" 4
1058.IX Item "file.cpp"
1059.IP "\fIfile\fR\fB.CPP\fR" 4
1060.IX Item "file.CPP"
1061.IP "\fIfile\fR\fB.c++\fR" 4
1062.IX Item "file.c++"
1063.IP "\fIfile\fR\fB.C\fR" 4
1064.IX Item "file.C"
1066\&\*(C+ source code that must be preprocessed. Note that in \fB.cxx\fR,
1067the last two letters must both be literally \fBx\fR. Likewise,
1068\&\fB.C\fR refers to a literal capital C.
1069.IP "\fIfile\fR\\fR" 4
1070.IX Item ""
1071.PD 0
1072.IP "\fIfile\fR\fB.M\fR" 4
1073.IX Item "file.M"
1075Objective\-\*(C+ source code that must be preprocessed.
1076.IP "\fIfile\fR\fB.mii\fR" 4
1077.IX Item "file.mii"
1078Objective\-\*(C+ source code that should not be preprocessed.
1079.IP "\fIfile\fR\fB.hh\fR" 4
1080.IX Item "file.hh"
1081.PD 0
1082.IP "\fIfile\fR\fB.H\fR" 4
1083.IX Item "file.H"
1084.IP "\fIfile\fR\fB.hp\fR" 4
1085.IX Item "file.hp"
1086.IP "\fIfile\fR\fB.hxx\fR" 4
1087.IX Item "file.hxx"
1088.IP "\fIfile\fR\fB.hpp\fR" 4
1089.IX Item "file.hpp"
1090.IP "\fIfile\fR\fB.HPP\fR" 4
1091.IX Item "file.HPP"
1092.IP "\fIfile\fR\fB.h++\fR" 4
1093.IX Item "file.h++"
1094.IP "\fIfile\fR\fB.tcc\fR" 4
1095.IX Item "file.tcc"
1097\&\*(C+ header file to be turned into a precompiled header or Ada spec.
1098.IP "\fIfile\fR\fB.f\fR" 4
1099.IX Item "file.f"
1100.PD 0
1101.IP "\fIfile\fR\fB.for\fR" 4
1102.IX Item "file.for"
1103.IP "\fIfile\fR\fB.ftn\fR" 4
1104.IX Item "file.ftn"
1106Fixed form Fortran source code that should not be preprocessed.
1107.IP "\fIfile\fR\fB.F\fR" 4
1108.IX Item "file.F"
1109.PD 0
1110.IP "\fIfile\fR\fB.FOR\fR" 4
1111.IX Item "file.FOR"
1112.IP "\fIfile\fR\fB.fpp\fR" 4
1113.IX Item "file.fpp"
1114.IP "\fIfile\fR\fB.FPP\fR" 4
1115.IX Item "file.FPP"
1116.IP "\fIfile\fR\fB.FTN\fR" 4
1117.IX Item "file.FTN"
1119Fixed form Fortran source code that must be preprocessed (with the traditional
1121.IP "\fIfile\fR\fB.f90\fR" 4
1122.IX Item "file.f90"
1123.PD 0
1124.IP "\fIfile\fR\fB.f95\fR" 4
1125.IX Item "file.f95"
1126.IP "\fIfile\fR\fB.f03\fR" 4
1127.IX Item "file.f03"
1128.IP "\fIfile\fR\fB.f08\fR" 4
1129.IX Item "file.f08"
1131Free form Fortran source code that should not be preprocessed.
1132.IP "\fIfile\fR\fB.F90\fR" 4
1133.IX Item "file.F90"
1134.PD 0
1135.IP "\fIfile\fR\fB.F95\fR" 4
1136.IX Item "file.F95"
1137.IP "\fIfile\fR\fB.F03\fR" 4
1138.IX Item "file.F03"
1139.IP "\fIfile\fR\fB.F08\fR" 4
1140.IX Item "file.F08"
1142Free form Fortran source code that must be preprocessed (with the
1143traditional preprocessor).
1144.IP "\fIfile\fR\fB.go\fR" 4
1145.IX Item "file.go"
1146Go source code.
1147.IP "\fIfile\fR\\fR" 4
1148.IX Item ""
1149Ada source code file that contains a library unit declaration (a
1150declaration of a package, subprogram, or generic, or a generic
1151instantiation), or a library unit renaming declaration (a package,
1152generic, or subprogram renaming declaration). Such files are also
1153called \fIspecs\fR.
1154.IP "\fIfile\fR\fB.adb\fR" 4
1155.IX Item "file.adb"
1156Ada source code file containing a library unit body (a subprogram or
1157package body). Such files are also called \fIbodies\fR.
1158.IP "\fIfile\fR\fB.s\fR" 4
1159.IX Item "file.s"
1160Assembler code.
1161.IP "\fIfile\fR\fB.S\fR" 4
1162.IX Item "file.S"
1163.PD 0
1164.IP "\fIfile\fR\\fR" 4
1165.IX Item ""
1167Assembler code that must be preprocessed.
1168.IP "\fIother\fR" 4
1169.IX Item "other"
1170An object file to be fed straight into linking.
1171Any file name with no recognized suffix is treated this way.
1173You can specify the input language explicitly with the \fB\-x\fR option:
1174.IP "\fB\-x\fR \fIlanguage\fR" 4
1175.IX Item "-x language"
1176Specify explicitly the \fIlanguage\fR for the following input files
1177(rather than letting the compiler choose a default based on the file
1178name suffix). This option applies to all following input files until
1179the next \fB\-x\fR option. Possible values for \fIlanguage\fR are:
1181.Vb 9
1182\& c c\-header cpp\-output
1183\& c++ c++\-header c++\-cpp\-output
1184\& objective\-c objective\-c\-header objective\-c\-cpp\-output
1185\& objective\-c++ objective\-c++\-header objective\-c++\-cpp\-output
1186\& assembler assembler\-with\-cpp
1187\& ada
1188\& f77 f77\-cpp\-input f95 f95\-cpp\-input
1189\& go
1190\& java
1192.IP "\fB\-x none\fR" 4
1193.IX Item "-x none"
1194Turn off any specification of a language, so that subsequent files are
1195handled according to their file name suffixes (as they are if \fB\-x\fR
1196has not been used at all).
1197.IP "\fB\-pass\-exit\-codes\fR" 4
1198.IX Item "-pass-exit-codes"
1199Normally the \fBgcc\fR program will exit with the code of 1 if any
1200phase of the compiler returns a non-success return code. If you specify
1201\&\fB\-pass\-exit\-codes\fR, the \fBgcc\fR program will instead return with
1202numerically highest error produced by any phase that returned an error
1203indication. The C, \*(C+, and Fortran frontends return 4, if an internal
1204compiler error is encountered.
1206If you only want some of the stages of compilation, you can use
1207\&\fB\-x\fR (or filename suffixes) to tell \fBgcc\fR where to start, and
1208one of the options \fB\-c\fR, \fB\-S\fR, or \fB\-E\fR to say where
1209\&\fBgcc\fR is to stop. Note that some combinations (for example,
1210\&\fB\-x cpp-output \-E\fR) instruct \fBgcc\fR to do nothing at all.
1211.IP "\fB\-c\fR" 4
1212.IX Item "-c"
1213Compile or assemble the source files, but do not link. The linking
1214stage simply is not done. The ultimate output is in the form of an
1215object file for each source file.
1217By default, the object file name for a source file is made by replacing
1218the suffix \fB.c\fR, \fB.i\fR, \fB.s\fR, etc., with \fB.o\fR.
1220Unrecognized input files, not requiring compilation or assembly, are
1222.IP "\fB\-S\fR" 4
1223.IX Item "-S"
1224Stop after the stage of compilation proper; do not assemble. The output
1225is in the form of an assembler code file for each non-assembler input
1226file specified.
1228By default, the assembler file name for a source file is made by
1229replacing the suffix \fB.c\fR, \fB.i\fR, etc., with \fB.s\fR.
1231Input files that don't require compilation are ignored.
1232.IP "\fB\-E\fR" 4
1233.IX Item "-E"
1234Stop after the preprocessing stage; do not run the compiler proper. The
1235output is in the form of preprocessed source code, which is sent to the
1236standard output.
1238Input files that don't require preprocessing are ignored.
1239.IP "\fB\-o\fR \fIfile\fR" 4
1240.IX Item "-o file"
1241Place output in file \fIfile\fR. This applies regardless to whatever
1242sort of output is being produced, whether it be an executable file,
1243an object file, an assembler file or preprocessed C code.
1245If \fB\-o\fR is not specified, the default is to put an executable
1246file in \fIa.out\fR, the object file for
1247\&\fI\fIsource\fI.\fIsuffix\fI\fR in \fI\fIsource\fI.o\fR, its
1248assembler file in \fI\fIsource\fI.s\fR, a precompiled header file in
1249\&\fI\fIsource\fI.\fIsuffix\fI.gch\fR, and all preprocessed C source on
1250standard output.
1251.IP "\fB\-v\fR" 4
1252.IX Item "-v"
1253Print (on standard error output) the commands executed to run the stages
1254of compilation. Also print the version number of the compiler driver
1255program and of the preprocessor and the compiler proper.
1256.IP "\fB\-###\fR" 4
1257.IX Item "-###"
1258Like \fB\-v\fR except the commands are not executed and arguments
1259are quoted unless they contain only alphanumeric characters or \f(CW\*(C`./\-_\*(C'\fR.
1260This is useful for shell scripts to capture the driver-generated command lines.
1261.IP "\fB\-pipe\fR" 4
1262.IX Item "-pipe"
1263Use pipes rather than temporary files for communication between the
1264various stages of compilation. This fails to work on some systems where
1265the assembler is unable to read from a pipe; but the \s-1GNU\s0 assembler has
1266no trouble.
1267.IP "\fB\-\-help\fR" 4
1268.IX Item "--help"
1269Print (on the standard output) a description of the command-line options
1270understood by \fBgcc\fR. If the \fB\-v\fR option is also specified
1271then \fB\-\-help\fR will also be passed on to the various processes
1272invoked by \fBgcc\fR, so that they can display the command-line options
1273they accept. If the \fB\-Wextra\fR option has also been specified
1274(prior to the \fB\-\-help\fR option), then command-line options that
1275have no documentation associated with them will also be displayed.
1276.IP "\fB\-\-target\-help\fR" 4
1277.IX Item "--target-help"
1278Print (on the standard output) a description of target-specific command-line
1279options for each tool. For some targets extra target-specific
1280information may also be printed.
1281.IP "\fB\-\-help={\fR\fIclass\fR|[\fB^\fR]\fIqualifier\fR\fB}\fR[\fB,...\fR]" 4
1282.IX Item "--help={class|[^]qualifier}[,...]"
1283Print (on the standard output) a description of the command-line
1284options understood by the compiler that fit into all specified classes
1285and qualifiers. These are the supported classes:
1286.RS 4
1287.IP "\fBoptimizers\fR" 4
1288.IX Item "optimizers"
1289This will display all of the optimization options supported by the
1291.IP "\fBwarnings\fR" 4
1292.IX Item "warnings"
1293This will display all of the options controlling warning messages
1294produced by the compiler.
1295.IP "\fBtarget\fR" 4
1296.IX Item "target"
1297This will display target-specific options. Unlike the
1298\&\fB\-\-target\-help\fR option however, target-specific options of the
1299linker and assembler will not be displayed. This is because those
1300tools do not currently support the extended \fB\-\-help=\fR syntax.
1301.IP "\fBparams\fR" 4
1302.IX Item "params"
1303This will display the values recognized by the \fB\-\-param\fR
1305.IP "\fIlanguage\fR" 4
1306.IX Item "language"
1307This will display the options supported for \fIlanguage\fR, where
1308\&\fIlanguage\fR is the name of one of the languages supported in this
1309version of \s-1GCC\s0.
1310.IP "\fBcommon\fR" 4
1311.IX Item "common"
1312This will display the options that are common to all languages.
1314.RS 4
1316These are the supported qualifiers:
1317.IP "\fBundocumented\fR" 4
1318.IX Item "undocumented"
1319Display only those options that are undocumented.
1320.IP "\fBjoined\fR" 4
1321.IX Item "joined"
1322Display options taking an argument that appears after an equal
1323sign in the same continuous piece of text, such as:
1325.IP "\fBseparate\fR" 4
1326.IX Item "separate"
1327Display options taking an argument that appears as a separate word
1328following the original option, such as: \fB\-o output-file\fR.
1330.RS 4
1332Thus for example to display all the undocumented target-specific
1333switches supported by the compiler the following can be used:
1335.Vb 1
1336\& \-\-help=target,undocumented
1339The sense of a qualifier can be inverted by prefixing it with the
1340\&\fB^\fR character, so for example to display all binary warning
1341options (i.e., ones that are either on or off and that do not take an
1342argument) that have a description, use:
1344.Vb 1
1345\& \-\-help=warnings,^joined,^undocumented
1348The argument to \fB\-\-help=\fR should not consist solely of inverted
1351Combining several classes is possible, although this usually
1352restricts the output by so much that there is nothing to display. One
1353case where it does work however is when one of the classes is
1354\&\fItarget\fR. So for example to display all the target-specific
1355optimization options the following can be used:
1357.Vb 1
1358\& \-\-help=target,optimizers
1361The \fB\-\-help=\fR option can be repeated on the command line. Each
1362successive use will display its requested class of options, skipping
1363those that have already been displayed.
1365If the \fB\-Q\fR option appears on the command line before the
1366\&\fB\-\-help=\fR option, then the descriptive text displayed by
1367\&\fB\-\-help=\fR is changed. Instead of describing the displayed
1368options, an indication is given as to whether the option is enabled,
1369disabled or set to a specific value (assuming that the compiler
1370knows this at the point where the \fB\-\-help=\fR option is used).
1372Here is a truncated example from the \s-1ARM\s0 port of \fBgcc\fR:
1374.Vb 5
1375\& % gcc \-Q \-mabi=2 \-\-help=target \-c
1376\& The following options are target specific:
1377\& \-mabi= 2
1378\& \-mabort\-on\-noreturn [disabled]
1379\& \-mapcs [disabled]
1382The output is sensitive to the effects of previous command-line
1383options, so for example it is possible to find out which optimizations
1384are enabled at \fB\-O2\fR by using:
1386.Vb 1
1387\& \-Q \-O2 \-\-help=optimizers
1390Alternatively you can discover which binary optimizations are enabled
1391by \fB\-O3\fR by using:
1393.Vb 3
1394\& gcc \-c \-Q \-O3 \-\-help=optimizers > /tmp/O3\-opts
1395\& gcc \-c \-Q \-O2 \-\-help=optimizers > /tmp/O2\-opts
1396\& diff /tmp/O2\-opts /tmp/O3\-opts | grep enabled
1399.IP "\fB\-no\-canonical\-prefixes\fR" 4
1400.IX Item "-no-canonical-prefixes"
1401Do not expand any symbolic links, resolve references to \fB/../\fR
1402or \fB/./\fR, or make the path absolute when generating a relative
1404.IP "\fB\-\-version\fR" 4
1405.IX Item "--version"
1406Display the version number and copyrights of the invoked \s-1GCC\s0.
1407.IP "\fB\-wrapper\fR" 4
1408.IX Item "-wrapper"
1409Invoke all subcommands under a wrapper program. The name of the
1410wrapper program and its parameters are passed as a comma separated
1413.Vb 1
1414\& gcc \-c t.c \-wrapper gdb,\-\-args
1417This will invoke all subprograms of \fBgcc\fR under
1418\&\fBgdb \-\-args\fR, thus the invocation of \fBcc1\fR will be
1419\&\fBgdb \-\-args cc1 ...\fR.
1420.IP "\fB\-fplugin=\fR\fIname\fR\\fR" 4
1421.IX Item ""
1422Load the plugin code in file \fIname\, assumed to be a
1423shared object to be dlopen'd by the compiler. The base name of
1424the shared object file is used to identify the plugin for the
1425purposes of argument parsing (See
1426\&\fB\-fplugin\-arg\-\fR\fIname\fR\fB\-\fR\fIkey\fR\fB=\fR\fIvalue\fR below).
1427Each plugin should define the callback functions specified in the
1428Plugins \s-1API\s0.
1429.IP "\fB\-fplugin\-arg\-\fR\fIname\fR\fB\-\fR\fIkey\fR\fB=\fR\fIvalue\fR" 4
1430.IX Item "-fplugin-arg-name-key=value"
1431Define an argument called \fIkey\fR with a value of \fIvalue\fR
1432for the plugin called \fIname\fR.
1433.IP "\fB\-fdump\-ada\-spec\fR[\fB\-slim\fR]" 4
1434.IX Item "-fdump-ada-spec[-slim]"
95d28233 1435For C and \*(C+ source and include files, generate corresponding Ada specs.
1436.IP "\fB\-fdump\-go\-spec=\fR\fIfile\fR" 4
1437.IX Item "-fdump-go-spec=file"
1438For input files in any language, generate corresponding Go
1439declarations in \fIfile\fR. This generates Go \f(CW\*(C`const\*(C'\fR,
1440\&\f(CW\*(C`type\*(C'\fR, \f(CW\*(C`var\*(C'\fR, and \f(CW\*(C`func\*(C'\fR declarations which may be a
1441useful way to start writing a Go interface to code written in some
1442other language.
1443.IP "\fB@\fR\fIfile\fR" 4
1444.IX Item "@file"
1445Read command-line options from \fIfile\fR. The options read are
1446inserted in place of the original @\fIfile\fR option. If \fIfile\fR
1447does not exist, or cannot be read, then the option will be treated
1448literally, and not removed.
1450Options in \fIfile\fR are separated by whitespace. A whitespace
1451character may be included in an option by surrounding the entire
1452option in either single or double quotes. Any character (including a
1453backslash) may be included by prefixing the character to be included
1454with a backslash. The \fIfile\fR may itself contain additional
1455@\fIfile\fR options; any such options will be processed recursively.
5ce9237c 1456.Sh "Compiling \*(C+ Programs"
1457.IX Subsection "Compiling Programs"
1458\&\*(C+ source files conventionally use one of the suffixes \fB.C\fR,
1459\&\\fR, \fB.cpp\fR, \fB.CPP\fR, \fB.c++\fR, \fB.cp\fR, or
1460\&\fB.cxx\fR; \*(C+ header files often use \fB.hh\fR, \fB.hpp\fR,
1461\&\fB.H\fR, or (for shared template code) \fB.tcc\fR; and
1462preprocessed \*(C+ files use the suffix \fB.ii\fR. \s-1GCC\s0 recognizes
1463files with these names and compiles them as \*(C+ programs even if you
1464call the compiler the same way as for compiling C programs (usually
1465with the name \fBgcc\fR).
1467However, the use of \fBgcc\fR does not add the \*(C+ library.
1468\&\fBg++\fR is a program that calls \s-1GCC\s0 and treats \fB.c\fR,
1469\&\fB.h\fR and \fB.i\fR files as \*(C+ source files instead of C source
1470files unless \fB\-x\fR is used, and automatically specifies linking
1471against the \*(C+ library. This program is also useful when
1472precompiling a C header file with a \fB.h\fR extension for use in \*(C+
1473compilations. On many systems, \fBg++\fR is also installed with
1474the name \fBc++\fR.
1476When you compile \*(C+ programs, you may specify many of the same
1477command-line options that you use for compiling programs in any
1478language; or command-line options meaningful for C and related
1479languages; or options that are meaningful only for \*(C+ programs.
5ce9237c 1480.Sh "Options Controlling C Dialect"
1481.IX Subsection "Options Controlling C Dialect"
1482The following options control the dialect of C (or languages derived
1483from C, such as \*(C+, Objective-C and Objective\-\*(C+) that the compiler
1485.IP "\fB\-ansi\fR" 4
1486.IX Item "-ansi"
1487In C mode, this is equivalent to \fB\-std=c90\fR. In \*(C+ mode, it is
1488equivalent to \fB\-std=c++98\fR.
1490This turns off certain features of \s-1GCC\s0 that are incompatible with \s-1ISO\s0
1491C90 (when compiling C code), or of standard \*(C+ (when compiling \*(C+ code),
1492such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, and
1493predefined macros such as \f(CW\*(C`unix\*(C'\fR and \f(CW\*(C`vax\*(C'\fR that identify the
1494type of system you are using. It also enables the undesirable and
1495rarely used \s-1ISO\s0 trigraph feature. For the C compiler,
1496it disables recognition of \*(C+ style \fB//\fR comments as well as
1497the \f(CW\*(C`inline\*(C'\fR keyword.
1499The alternate keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_extension_\|_\*(C'\fR,
1500\&\f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR continue to work despite
1501\&\fB\-ansi\fR. You would not want to use them in an \s-1ISO\s0 C program, of
1502course, but it is useful to put them in header files that might be included
1503in compilations done with \fB\-ansi\fR. Alternate predefined macros
1504such as \f(CW\*(C`_\|_unix_\|_\*(C'\fR and \f(CW\*(C`_\|_vax_\|_\*(C'\fR are also available, with or
1505without \fB\-ansi\fR.
1507The \fB\-ansi\fR option does not cause non-ISO programs to be
1508rejected gratuitously. For that, \fB\-pedantic\fR is required in
1509addition to \fB\-ansi\fR.
1511The macro \f(CW\*(C`_\|_STRICT_ANSI_\|_\*(C'\fR is predefined when the \fB\-ansi\fR
1512option is used. Some header files may notice this macro and refrain
1513from declaring certain functions or defining certain macros that the
1514\&\s-1ISO\s0 standard doesn't call for; this is to avoid interfering with any
1515programs that might use these names for other things.
1517Functions that would normally be built in but do not have semantics
1518defined by \s-1ISO\s0 C (such as \f(CW\*(C`alloca\*(C'\fR and \f(CW\*(C`ffs\*(C'\fR) are not built-in
1519functions when \fB\-ansi\fR is used.
1520.IP "\fB\-std=\fR" 4
1521.IX Item "-std="
1522Determine the language standard. This option
1523is currently only supported when compiling C or \*(C+.
1525The compiler can accept several base standards, such as \fBc90\fR or
1526\&\fBc++98\fR, and \s-1GNU\s0 dialects of those standards, such as
1527\&\fBgnu90\fR or \fBgnu++98\fR. By specifying a base standard, the
1528compiler will accept all programs following that standard and those
1529using \s-1GNU\s0 extensions that do not contradict it. For example,
1530\&\fB\-std=c90\fR turns off certain features of \s-1GCC\s0 that are
1531incompatible with \s-1ISO\s0 C90, such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR
1532keywords, but not other \s-1GNU\s0 extensions that do not have a meaning in
1533\&\s-1ISO\s0 C90, such as omitting the middle term of a \f(CW\*(C`?:\*(C'\fR
1534expression. On the other hand, by specifying a \s-1GNU\s0 dialect of a
1535standard, all features the compiler support are enabled, even when
1536those features change the meaning of the base standard and some
1537strict-conforming programs may be rejected. The particular standard
1538is used by \fB\-pedantic\fR to identify which features are \s-1GNU\s0
1539extensions given that version of the standard. For example
1540\&\fB\-std=gnu90 \-pedantic\fR would warn about \*(C+ style \fB//\fR
1541comments, while \fB\-std=gnu99 \-pedantic\fR would not.
1543A value for this option must be provided; possible values are
1544.RS 4
1545.IP "\fBc90\fR" 4
1546.IX Item "c90"
1547.PD 0
1548.IP "\fBc89\fR" 4
1549.IX Item "c89"
1550.IP "\fBiso9899:1990\fR" 4
1551.IX Item "iso9899:1990"
1553Support all \s-1ISO\s0 C90 programs (certain \s-1GNU\s0 extensions that conflict
1554with \s-1ISO\s0 C90 are disabled). Same as \fB\-ansi\fR for C code.
1555.IP "\fBiso9899:199409\fR" 4
1556.IX Item "iso9899:199409"
1557\&\s-1ISO\s0 C90 as modified in amendment 1.
1558.IP "\fBc99\fR" 4
1559.IX Item "c99"
1560.PD 0
1561.IP "\fBc9x\fR" 4
1562.IX Item "c9x"
1563.IP "\fBiso9899:1999\fR" 4
1564.IX Item "iso9899:1999"
1565.IP "\fBiso9899:199x\fR" 4
1566.IX Item "iso9899:199x"
1568\&\s-1ISO\s0 C99. Note that this standard is not yet fully supported; see
1569<\fB\-4.7/c99status.html\fR> for more information. The
1570names \fBc9x\fR and \fBiso9899:199x\fR are deprecated.
1571.IP "\fBc11\fR" 4
1572.IX Item "c11"
1573.PD 0
1574.IP "\fBc1x\fR" 4
1575.IX Item "c1x"
1576.IP "\fBiso9899:2011\fR" 4
1577.IX Item "iso9899:2011"
1579\&\s-1ISO\s0 C11, the 2011 revision of the \s-1ISO\s0 C standard.
1580Support is incomplete and experimental. The name \fBc1x\fR is
1582.IP "\fBgnu90\fR" 4
1583.IX Item "gnu90"
1584.PD 0
1585.IP "\fBgnu89\fR" 4
1586.IX Item "gnu89"
1588\&\s-1GNU\s0 dialect of \s-1ISO\s0 C90 (including some C99 features). This
1589is the default for C code.
1590.IP "\fBgnu99\fR" 4
1591.IX Item "gnu99"
1592.PD 0
1593.IP "\fBgnu9x\fR" 4
1594.IX Item "gnu9x"
1596\&\s-1GNU\s0 dialect of \s-1ISO\s0 C99. When \s-1ISO\s0 C99 is fully implemented in \s-1GCC\s0,
1597this will become the default. The name \fBgnu9x\fR is deprecated.
1598.IP "\fBgnu11\fR" 4
1599.IX Item "gnu11"
1600.PD 0
1601.IP "\fBgnu1x\fR" 4
1602.IX Item "gnu1x"
1604\&\s-1GNU\s0 dialect of \s-1ISO\s0 C11. Support is incomplete and experimental. The
1605name \fBgnu1x\fR is deprecated.
1606.IP "\fBc++98\fR" 4
1607.IX Item "c++98"
1608The 1998 \s-1ISO\s0 \*(C+ standard plus amendments. Same as \fB\-ansi\fR for
1609\&\*(C+ code.
1610.IP "\fBgnu++98\fR" 4
1611.IX Item "gnu++98"
1612\&\s-1GNU\s0 dialect of \fB\-std=c++98\fR. This is the default for
1613\&\*(C+ code.
1614.IP "\fBc++11\fR" 4
1615.IX Item "c++11"
1616The 2011 \s-1ISO\s0 \*(C+ standard plus amendments. Support for \*(C+11 is still
1617experimental, and may change in incompatible ways in future releases.
1618.IP "\fBgnu++11\fR" 4
1619.IX Item "gnu++11"
1620\&\s-1GNU\s0 dialect of \fB\-std=c++11\fR. Support for \*(C+11 is still
1621experimental, and may change in incompatible ways in future releases.
1623.RS 4
1625.IP "\fB\-fgnu89\-inline\fR" 4
1626.IX Item "-fgnu89-inline"
1627The option \fB\-fgnu89\-inline\fR tells \s-1GCC\s0 to use the traditional
1628\&\s-1GNU\s0 semantics for \f(CW\*(C`inline\*(C'\fR functions when in C99 mode.
1629 This option
1630is accepted and ignored by \s-1GCC\s0 versions 4.1.3 up to but not including
16314.3. In \s-1GCC\s0 versions 4.3 and later it changes the behavior of \s-1GCC\s0 in
1632C99 mode. Using this option is roughly equivalent to adding the
1633\&\f(CW\*(C`gnu_inline\*(C'\fR function attribute to all inline functions.
1635The option \fB\-fno\-gnu89\-inline\fR explicitly tells \s-1GCC\s0 to use the
1636C99 semantics for \f(CW\*(C`inline\*(C'\fR when in C99 or gnu99 mode (i.e., it
1637specifies the default behavior). This option was first supported in
1638\&\s-1GCC\s0 4.3. This option is not supported in \fB\-std=c90\fR or
1639\&\fB\-std=gnu90\fR mode.
1641The preprocessor macros \f(CW\*(C`_\|_GNUC_GNU_INLINE_\|_\*(C'\fR and
1642\&\f(CW\*(C`_\|_GNUC_STDC_INLINE_\|_\*(C'\fR may be used to check which semantics are
1643in effect for \f(CW\*(C`inline\*(C'\fR functions.
1644.IP "\fB\-aux\-info\fR \fIfilename\fR" 4
1645.IX Item "-aux-info filename"
1646Output to the given filename prototyped declarations for all functions
1647declared and/or defined in a translation unit, including those in header
1648files. This option is silently ignored in any language other than C.
1650Besides declarations, the file indicates, in comments, the origin of
1651each declaration (source file and line), whether the declaration was
1652implicit, prototyped or unprototyped (\fBI\fR, \fBN\fR for new or
1653\&\fBO\fR for old, respectively, in the first character after the line
1654number and the colon), and whether it came from a declaration or a
1655definition (\fBC\fR or \fBF\fR, respectively, in the following
1656character). In the case of function definitions, a K&R\-style list of
1657arguments followed by their declarations is also provided, inside
1658comments, after the declaration.
1659.IP "\fB\-fallow\-parameterless\-variadic\-functions\fR" 4
1660.IX Item "-fallow-parameterless-variadic-functions"
1661Accept variadic functions without named parameters.
1663Although it is possible to define such a function, this is not very
1664useful as it is not possible to read the arguments. This is only
1665supported for C as this construct is allowed by \*(C+.
1666.IP "\fB\-fno\-asm\fR" 4
1667.IX Item "-fno-asm"
1668Do not recognize \f(CW\*(C`asm\*(C'\fR, \f(CW\*(C`inline\*(C'\fR or \f(CW\*(C`typeof\*(C'\fR as a
1669keyword, so that code can use these words as identifiers. You can use
1670the keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR
1671instead. \fB\-ansi\fR implies \fB\-fno\-asm\fR.
1673In \*(C+, this switch only affects the \f(CW\*(C`typeof\*(C'\fR keyword, since
1674\&\f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`inline\*(C'\fR are standard keywords. You may want to
1675use the \fB\-fno\-gnu\-keywords\fR flag instead, which has the same
1676effect. In C99 mode (\fB\-std=c99\fR or \fB\-std=gnu99\fR), this
1677switch only affects the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, since
1678\&\f(CW\*(C`inline\*(C'\fR is a standard keyword in \s-1ISO\s0 C99.
1679.IP "\fB\-fno\-builtin\fR" 4
1680.IX Item "-fno-builtin"
1681.PD 0
1682.IP "\fB\-fno\-builtin\-\fR\fIfunction\fR" 4
1683.IX Item "-fno-builtin-function"
1685Don't recognize built-in functions that do not begin with
1686\&\fB_\|_builtin_\fR as prefix.
1688\&\s-1GCC\s0 normally generates special code to handle certain built-in functions
1689more efficiently; for instance, calls to \f(CW\*(C`alloca\*(C'\fR may become single
1690instructions which adjust the stack directly, and calls to \f(CW\*(C`memcpy\*(C'\fR
1691may become inline copy loops. The resulting code is often both smaller
1692and faster, but since the function calls no longer appear as such, you
1693cannot set a breakpoint on those calls, nor can you change the behavior
1694of the functions by linking with a different library. In addition,
1695when a function is recognized as a built-in function, \s-1GCC\s0 may use
1696information about that function to warn about problems with calls to
1697that function, or to generate more efficient code, even if the
1698resulting code still contains calls to that function. For example,
1699warnings are given with \fB\-Wformat\fR for bad calls to
1700\&\f(CW\*(C`printf\*(C'\fR, when \f(CW\*(C`printf\*(C'\fR is built in, and \f(CW\*(C`strlen\*(C'\fR is
1701known not to modify global memory.
1703With the \fB\-fno\-builtin\-\fR\fIfunction\fR option
1704only the built-in function \fIfunction\fR is
1705disabled. \fIfunction\fR must not begin with \fB_\|_builtin_\fR. If a
1706function is named that is not built-in in this version of \s-1GCC\s0, this
1707option is ignored. There is no corresponding
1708\&\fB\-fbuiltin\-\fR\fIfunction\fR option; if you wish to enable
1709built-in functions selectively when using \fB\-fno\-builtin\fR or
1710\&\fB\-ffreestanding\fR, you may define macros such as:
1712.Vb 2
1713\& #define abs(n) _\|_builtin_abs ((n))
1714\& #define strcpy(d, s) _\|_builtin_strcpy ((d), (s))
1716.IP "\fB\-fhosted\fR" 4
1717.IX Item "-fhosted"
1718Assert that compilation takes place in a hosted environment. This implies
1719\&\fB\-fbuiltin\fR. A hosted environment is one in which the
1720entire standard library is available, and in which \f(CW\*(C`main\*(C'\fR has a return
1721type of \f(CW\*(C`int\*(C'\fR. Examples are nearly everything except a kernel.
1722This is equivalent to \fB\-fno\-freestanding\fR.
1723.IP "\fB\-ffreestanding\fR" 4
1724.IX Item "-ffreestanding"
1725Assert that compilation takes place in a freestanding environment. This
1726implies \fB\-fno\-builtin\fR. A freestanding environment
1727is one in which the standard library may not exist, and program startup may
1728not necessarily be at \f(CW\*(C`main\*(C'\fR. The most obvious example is an \s-1OS\s0 kernel.
1729This is equivalent to \fB\-fno\-hosted\fR.
1730.IP "\fB\-fopenmp\fR" 4
1731.IX Item "-fopenmp"
1732Enable handling of OpenMP directives \f(CW\*(C`#pragma omp\*(C'\fR in C/\*(C+ and
1733\&\f(CW\*(C`!$omp\*(C'\fR in Fortran. When \fB\-fopenmp\fR is specified, the
1734compiler generates parallel code according to the OpenMP Application
1735Program Interface v3.0 <\fB\fR>. This option
1736implies \fB\-pthread\fR, and thus is only supported on targets that
1737have support for \fB\-pthread\fR.
1738.IP "\fB\-fgnu\-tm\fR" 4
1739.IX Item "-fgnu-tm"
1740When the option \fB\-fgnu\-tm\fR is specified, the compiler will
1741generate code for the Linux variant of Intel's current Transactional
1742Memory \s-1ABI\s0 specification document (Revision 1.1, May 6 2009). This is
1743an experimental feature whose interface may change in future versions
1744of \s-1GCC\s0, as the official specification changes. Please note that not
1745all architectures are supported for this feature.
1747For more information on \s-1GCC\s0's support for transactional memory,
1749Note that the transactional memory feature is not supported with
1750non-call exceptions (\fB\-fnon\-call\-exceptions\fR).
1751.IP "\fB\-fms\-extensions\fR" 4
1752.IX Item "-fms-extensions"
1753Accept some non-standard constructs used in Microsoft header files.
1755In \*(C+ code, this allows member names in structures to be similar
1756to previous types declarations.
1758.Vb 4
1759\& typedef int UOW;
1760\& struct ABC {
1761\& UOW UOW;
1762\& };
1765Some cases of unnamed fields in structures and unions are only
1766accepted with this option.
1767.IP "\fB\-fplan9\-extensions\fR" 4
1768.IX Item "-fplan9-extensions"
1769Accept some non-standard constructs used in Plan 9 code.
1771This enables \fB\-fms\-extensions\fR, permits passing pointers to
1772structures with anonymous fields to functions that expect pointers to
1773elements of the type of the field, and permits referring to anonymous
1774fields declared using a typedef. This is only
1775supported for C, not \*(C+.
1776.IP "\fB\-trigraphs\fR" 4
1777.IX Item "-trigraphs"
1778Support \s-1ISO\s0 C trigraphs. The \fB\-ansi\fR option (and \fB\-std\fR
1779options for strict \s-1ISO\s0 C conformance) implies \fB\-trigraphs\fR.
1780.IP "\fB\-no\-integrated\-cpp\fR" 4
1781.IX Item "-no-integrated-cpp"
1782Performs a compilation in two passes: preprocessing and compiling. This
1783option allows a user supplied \*(L"cc1\*(R", \*(L"cc1plus\*(R", or \*(L"cc1obj\*(R" via the
1784\&\fB\-B\fR option. The user supplied compilation step can then add in
1785an additional preprocessing step after normal preprocessing but before
1786compiling. The default is to use the integrated cpp (internal cpp)
1788The semantics of this option will change if \*(L"cc1\*(R", \*(L"cc1plus\*(R", and
1789\&\*(L"cc1obj\*(R" are merged.
1790.IP "\fB\-traditional\fR" 4
1791.IX Item "-traditional"
1792.PD 0
1793.IP "\fB\-traditional\-cpp\fR" 4
1794.IX Item "-traditional-cpp"
1796Formerly, these options caused \s-1GCC\s0 to attempt to emulate a pre-standard
1797C compiler. They are now only supported with the \fB\-E\fR switch.
1798The preprocessor continues to support a pre-standard mode. See the \s-1GNU\s0
1799\&\s-1CPP\s0 manual for details.
1800.IP "\fB\-fcond\-mismatch\fR" 4
1801.IX Item "-fcond-mismatch"
1802Allow conditional expressions with mismatched types in the second and
1803third arguments. The value of such an expression is void. This option
1804is not supported for \*(C+.
1805.IP "\fB\-flax\-vector\-conversions\fR" 4
1806.IX Item "-flax-vector-conversions"
1807Allow implicit conversions between vectors with differing numbers of
1808elements and/or incompatible element types. This option should not be
1809used for new code.
1810.IP "\fB\-funsigned\-char\fR" 4
1811.IX Item "-funsigned-char"
1812Let the type \f(CW\*(C`char\*(C'\fR be unsigned, like \f(CW\*(C`unsigned char\*(C'\fR.
1814Each kind of machine has a default for what \f(CW\*(C`char\*(C'\fR should
1815be. It is either like \f(CW\*(C`unsigned char\*(C'\fR by default or like
1816\&\f(CW\*(C`signed char\*(C'\fR by default.
1818Ideally, a portable program should always use \f(CW\*(C`signed char\*(C'\fR or
1819\&\f(CW\*(C`unsigned char\*(C'\fR when it depends on the signedness of an object.
1820But many programs have been written to use plain \f(CW\*(C`char\*(C'\fR and
1821expect it to be signed, or expect it to be unsigned, depending on the
1822machines they were written for. This option, and its inverse, let you
1823make such a program work with the opposite default.
1825The type \f(CW\*(C`char\*(C'\fR is always a distinct type from each of
1826\&\f(CW\*(C`signed char\*(C'\fR or \f(CW\*(C`unsigned char\*(C'\fR, even though its behavior
1827is always just like one of those two.
1828.IP "\fB\-fsigned\-char\fR" 4
1829.IX Item "-fsigned-char"
1830Let the type \f(CW\*(C`char\*(C'\fR be signed, like \f(CW\*(C`signed char\*(C'\fR.
1832Note that this is equivalent to \fB\-fno\-unsigned\-char\fR, which is
1833the negative form of \fB\-funsigned\-char\fR. Likewise, the option
1834\&\fB\-fno\-signed\-char\fR is equivalent to \fB\-funsigned\-char\fR.
1835.IP "\fB\-fsigned\-bitfields\fR" 4
1836.IX Item "-fsigned-bitfields"
1837.PD 0
1838.IP "\fB\-funsigned\-bitfields\fR" 4
1839.IX Item "-funsigned-bitfields"
1840.IP "\fB\-fno\-signed\-bitfields\fR" 4
1841.IX Item "-fno-signed-bitfields"
1842.IP "\fB\-fno\-unsigned\-bitfields\fR" 4
1843.IX Item "-fno-unsigned-bitfields"
1845These options control whether a bit-field is signed or unsigned, when the
1846declaration does not use either \f(CW\*(C`signed\*(C'\fR or \f(CW\*(C`unsigned\*(C'\fR. By
1847default, such a bit-field is signed, because this is consistent: the
1848basic integer types such as \f(CW\*(C`int\*(C'\fR are signed types.
5ce9237c 1849.Sh "Options Controlling \*(C+ Dialect"
1850.IX Subsection "Options Controlling Dialect"
1851This section describes the command-line options that are only meaningful
1852for \*(C+ programs; but you can also use most of the \s-1GNU\s0 compiler options
1853regardless of what language your program is in. For example, you
1854might compile a file \f(CW\*(C`firstClass.C\*(C'\fR like this:
1856.Vb 1
1857\& g++ \-g \-frepo \-O \-c firstClass.C
1860In this example, only \fB\-frepo\fR is an option meant
1861only for \*(C+ programs; you can use the other options with any
1862language supported by \s-1GCC\s0.
1864Here is a list of options that are \fIonly\fR for compiling \*(C+ programs:
1865.IP "\fB\-fabi\-version=\fR\fIn\fR" 4
1866.IX Item "-fabi-version=n"
1867Use version \fIn\fR of the \*(C+ \s-1ABI\s0. Version 2 is the version of the
1868\&\*(C+ \s-1ABI\s0 that first appeared in G++ 3.4. Version 1 is the version of
1869the \*(C+ \s-1ABI\s0 that first appeared in G++ 3.2. Version 0 will always be
1870the version that conforms most closely to the \*(C+ \s-1ABI\s0 specification.
1871Therefore, the \s-1ABI\s0 obtained using version 0 will change as \s-1ABI\s0 bugs
1872are fixed.
1874The default is version 2.
1876Version 3 corrects an error in mangling a constant address as a
1877template argument.
1879Version 4, which first appeared in G++ 4.5, implements a standard
1880mangling for vector types.
1882Version 5, which first appeared in G++ 4.6, corrects the mangling of
1883attribute const/volatile on function pointer types, decltype of a
1884plain decl, and use of a function parameter in the declaration of
1885another parameter.
1887Version 6, which first appeared in G++ 4.7, corrects the promotion
1888behavior of \*(C+11 scoped enums and the mangling of template argument
1889packs, const/static_cast, prefix ++ and \-\-, and a class scope function
1890used as a template argument.
1892See also \fB\-Wabi\fR.
1893.IP "\fB\-fno\-access\-control\fR" 4
1894.IX Item "-fno-access-control"
1895Turn off all access checking. This switch is mainly useful for working
1896around bugs in the access control code.
1897.IP "\fB\-fcheck\-new\fR" 4
1898.IX Item "-fcheck-new"
1899Check that the pointer returned by \f(CW\*(C`operator new\*(C'\fR is non-null
1900before attempting to modify the storage allocated. This check is
1901normally unnecessary because the \*(C+ standard specifies that
1902\&\f(CW\*(C`operator new\*(C'\fR will only return \f(CW0\fR if it is declared
1903\&\fB\f(BIthrow()\fB\fR, in which case the compiler will always check the
1904return value even without this option. In all other cases, when
1905\&\f(CW\*(C`operator new\*(C'\fR has a non-empty exception specification, memory
1906exhaustion is signalled by throwing \f(CW\*(C`std::bad_alloc\*(C'\fR. See also
1907\&\fBnew (nothrow)\fR.
1908.IP "\fB\-fconserve\-space\fR" 4
1909.IX Item "-fconserve-space"
1910Put uninitialized or run-time-initialized global variables into the
1911common segment, as C does. This saves space in the executable at the
1912cost of not diagnosing duplicate definitions. If you compile with this
1913flag and your program mysteriously crashes after \f(CW\*(C`main()\*(C'\fR has
1914completed, you may have an object that is being destroyed twice because
1915two definitions were merged.
1917This option is no longer useful on most targets, now that support has
1918been added for putting variables into \s-1BSS\s0 without making them common.
1919.IP "\fB\-fconstexpr\-depth=\fR\fIn\fR" 4
1920.IX Item "-fconstexpr-depth=n"
1921Set the maximum nested evaluation depth for \*(C+11 constexpr functions
1922to \fIn\fR. A limit is needed to detect endless recursion during
1923constant expression evaluation. The minimum specified by the standard
1924is 512.
1925.IP "\fB\-fdeduce\-init\-list\fR" 4
1926.IX Item "-fdeduce-init-list"
1927Enable deduction of a template type parameter as
1928std::initializer_list from a brace-enclosed initializer list, i.e.
1930.Vb 4
1931\& template <class T> auto forward(T t) \-> decltype (realfn (t))
1932\& {
1933\& return realfn (t);
1934\& }
1936\& void f()
1937\& {
1938\& forward({1,2}); // call forward<std::initializer_list<int>>
1939\& }
1942This deduction was implemented as a possible extension to the
1943originally proposed semantics for the \*(C+11 standard, but was not part
1944of the final standard, so it is disabled by default. This option is
1945deprecated, and may be removed in a future version of G++.
1946.IP "\fB\-ffriend\-injection\fR" 4
1947.IX Item "-ffriend-injection"
1948Inject friend functions into the enclosing namespace, so that they are
1949visible outside the scope of the class in which they are declared.
1950Friend functions were documented to work this way in the old Annotated
1951\&\*(C+ Reference Manual, and versions of G++ before 4.1 always worked
1952that way. However, in \s-1ISO\s0 \*(C+ a friend function that is not declared
1953in an enclosing scope can only be found using argument dependent
1954lookup. This option causes friends to be injected as they were in
1955earlier releases.
1957This option is for compatibility, and may be removed in a future
1958release of G++.
1959.IP "\fB\-fno\-elide\-constructors\fR" 4
1960.IX Item "-fno-elide-constructors"
1961The \*(C+ standard allows an implementation to omit creating a temporary
1962that is only used to initialize another object of the same type.
1963Specifying this option disables that optimization, and forces G++ to
1964call the copy constructor in all cases.
1965.IP "\fB\-fno\-enforce\-eh\-specs\fR" 4
1966.IX Item "-fno-enforce-eh-specs"
1967Don't generate code to check for violation of exception specifications
1968at run time. This option violates the \*(C+ standard, but may be useful
1969for reducing code size in production builds, much like defining
1970\&\fB\s-1NDEBUG\s0\fR. This does not give user code permission to throw
1971exceptions in violation of the exception specifications; the compiler
1972will still optimize based on the specifications, so throwing an
1973unexpected exception will result in undefined behavior.
1974.IP "\fB\-ffor\-scope\fR" 4
1975.IX Item "-ffor-scope"
1976.PD 0
1977.IP "\fB\-fno\-for\-scope\fR" 4
1978.IX Item "-fno-for-scope"
1980If \fB\-ffor\-scope\fR is specified, the scope of variables declared in
1981a \fIfor-init-statement\fR is limited to the \fBfor\fR loop itself,
1982as specified by the \*(C+ standard.
1983If \fB\-fno\-for\-scope\fR is specified, the scope of variables declared in
1984a \fIfor-init-statement\fR extends to the end of the enclosing scope,
1985as was the case in old versions of G++, and other (traditional)
1986implementations of \*(C+.
1988The default if neither flag is given to follow the standard,
1989but to allow and give a warning for old-style code that would
1990otherwise be invalid, or have different behavior.
1991.IP "\fB\-fno\-gnu\-keywords\fR" 4
1992.IX Item "-fno-gnu-keywords"
1993Do not recognize \f(CW\*(C`typeof\*(C'\fR as a keyword, so that code can use this
1994word as an identifier. You can use the keyword \f(CW\*(C`_\|_typeof_\|_\*(C'\fR instead.
1995\&\fB\-ansi\fR implies \fB\-fno\-gnu\-keywords\fR.
1996.IP "\fB\-fno\-implicit\-templates\fR" 4
1997.IX Item "-fno-implicit-templates"
1998Never emit code for non-inline templates that are instantiated
1999implicitly (i.e. by use); only emit code for explicit instantiations.
2000.IP "\fB\-fno\-implicit\-inline\-templates\fR" 4
2001.IX Item "-fno-implicit-inline-templates"
2002Don't emit code for implicit instantiations of inline templates, either.
2003The default is to handle inlines differently so that compiles with and
2004without optimization will need the same set of explicit instantiations.
2005.IP "\fB\-fno\-implement\-inlines\fR" 4
2006.IX Item "-fno-implement-inlines"
2007To save space, do not emit out-of-line copies of inline functions
2008controlled by \fB#pragma implementation\fR. This will cause linker
2009errors if these functions are not inlined everywhere they are called.
2010.IP "\fB\-fms\-extensions\fR" 4
2011.IX Item "-fms-extensions"
2012Disable pedantic warnings about constructs used in \s-1MFC\s0, such as implicit
2013int and getting a pointer to member function via non-standard syntax.
2014.IP "\fB\-fno\-nonansi\-builtins\fR" 4
2015.IX Item "-fno-nonansi-builtins"
2016Disable built-in declarations of functions that are not mandated by
2017\&\s-1ANSI/ISO\s0 C. These include \f(CW\*(C`ffs\*(C'\fR, \f(CW\*(C`alloca\*(C'\fR, \f(CW\*(C`_exit\*(C'\fR,
2018\&\f(CW\*(C`index\*(C'\fR, \f(CW\*(C`bzero\*(C'\fR, \f(CW\*(C`conjf\*(C'\fR, and other related functions.
2019.IP "\fB\-fnothrow\-opt\fR" 4
2020.IX Item "-fnothrow-opt"
2021Treat a \f(CW\*(C`throw()\*(C'\fR exception specification as though it were a
2022\&\f(CW\*(C`noexcept\*(C'\fR specification to reduce or eliminate the text size
2023overhead relative to a function with no exception specification. If
2024the function has local variables of types with non-trivial
2025destructors, the exception specification will actually make the
2026function smaller because the \s-1EH\s0 cleanups for those variables can be
2027optimized away. The semantic effect is that an exception thrown out of
2028a function with such an exception specification will result in a call
2029to \f(CW\*(C`terminate\*(C'\fR rather than \f(CW\*(C`unexpected\*(C'\fR.
2030.IP "\fB\-fno\-operator\-names\fR" 4
2031.IX Item "-fno-operator-names"
2032Do not treat the operator name keywords \f(CW\*(C`and\*(C'\fR, \f(CW\*(C`bitand\*(C'\fR,
2033\&\f(CW\*(C`bitor\*(C'\fR, \f(CW\*(C`compl\*(C'\fR, \f(CW\*(C`not\*(C'\fR, \f(CW\*(C`or\*(C'\fR and \f(CW\*(C`xor\*(C'\fR as
2034synonyms as keywords.
2035.IP "\fB\-fno\-optional\-diags\fR" 4
2036.IX Item "-fno-optional-diags"
2037Disable diagnostics that the standard says a compiler does not need to
2038issue. Currently, the only such diagnostic issued by G++ is the one for
2039a name having multiple meanings within a class.
2040.IP "\fB\-fpermissive\fR" 4
2041.IX Item "-fpermissive"
2042Downgrade some diagnostics about nonconformant code from errors to
2043warnings. Thus, using \fB\-fpermissive\fR will allow some
2044nonconforming code to compile.
2045.IP "\fB\-fno\-pretty\-templates\fR" 4
2046.IX Item "-fno-pretty-templates"
2047When an error message refers to a specialization of a function
2048template, the compiler will normally print the signature of the
2049template followed by the template arguments and any typedefs or
2050typenames in the signature (e.g. \f(CW\*(C`void f(T) [with T = int]\*(C'\fR
2051rather than \f(CW\*(C`void f(int)\*(C'\fR) so that it's clear which template is
2052involved. When an error message refers to a specialization of a class
2053template, the compiler will omit any template arguments that match
2054the default template arguments for that template. If either of these
2055behaviors make it harder to understand the error message rather than
2056easier, using \fB\-fno\-pretty\-templates\fR will disable them.
2057.IP "\fB\-frepo\fR" 4
2058.IX Item "-frepo"
2059Enable automatic template instantiation at link time. This option also
2060implies \fB\-fno\-implicit\-templates\fR.
2061.IP "\fB\-fno\-rtti\fR" 4
2062.IX Item "-fno-rtti"
2063Disable generation of information about every class with virtual
2064functions for use by the \*(C+ run-time type identification features
2065(\fBdynamic_cast\fR and \fBtypeid\fR). If you don't use those parts
2066of the language, you can save some space by using this flag. Note that
2067exception handling uses the same information, but it will generate it as
2068needed. The \fBdynamic_cast\fR operator can still be used for casts that
2069do not require run-time type information, i.e. casts to \f(CW\*(C`void *\*(C'\fR or to
2070unambiguous base classes.
2071.IP "\fB\-fstats\fR" 4
2072.IX Item "-fstats"
2073Emit statistics about front-end processing at the end of the compilation.
2074This information is generally only useful to the G++ development team.
2075.IP "\fB\-fstrict\-enums\fR" 4
2076.IX Item "-fstrict-enums"
2077Allow the compiler to optimize using the assumption that a value of
2078enumerated type can only be one of the values of the enumeration (as
2079defined in the \*(C+ standard; basically, a value that can be
2080represented in the minimum number of bits needed to represent all the
2081enumerators). This assumption may not be valid if the program uses a
2082cast to convert an arbitrary integer value to the enumerated type.
2083.IP "\fB\-ftemplate\-depth=\fR\fIn\fR" 4
2084.IX Item "-ftemplate-depth=n"
2085Set the maximum instantiation depth for template classes to \fIn\fR.
2086A limit on the template instantiation depth is needed to detect
2087endless recursions during template class instantiation. \s-1ANSI/ISO\s0 \*(C+
2088conforming programs must not rely on a maximum depth greater than 17
2089(changed to 1024 in \*(C+11). The default value is 900, as the compiler
2090can run out of stack space before hitting 1024 in some situations.
2091.IP "\fB\-fno\-threadsafe\-statics\fR" 4
2092.IX Item "-fno-threadsafe-statics"
2093Do not emit the extra code to use the routines specified in the \*(C+
2094\&\s-1ABI\s0 for thread-safe initialization of local statics. You can use this
2095option to reduce code size slightly in code that doesn't need to be
2097.IP "\fB\-fuse\-cxa\-atexit\fR" 4
2098.IX Item "-fuse-cxa-atexit"
2099Register destructors for objects with static storage duration with the
2100\&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR function rather than the \f(CW\*(C`atexit\*(C'\fR function.
2101This option is required for fully standards-compliant handling of static
2102destructors, but will only work if your C library supports
2104.IP "\fB\-fno\-use\-cxa\-get\-exception\-ptr\fR" 4
2105.IX Item "-fno-use-cxa-get-exception-ptr"
2106Don't use the \f(CW\*(C`_\|_cxa_get_exception_ptr\*(C'\fR runtime routine. This
2107will cause \f(CW\*(C`std::uncaught_exception\*(C'\fR to be incorrect, but is necessary
2108if the runtime routine is not available.
2109.IP "\fB\-fvisibility\-inlines\-hidden\fR" 4
2110.IX Item "-fvisibility-inlines-hidden"
2111This switch declares that the user does not attempt to compare
2112pointers to inline functions or methods where the addresses of the two functions
2113were taken in different shared objects.
2115The effect of this is that \s-1GCC\s0 may, effectively, mark inline methods with
2116\&\f(CW\*(C`_\|_attribute_\|_ ((visibility ("hidden")))\*(C'\fR so that they do not
2117appear in the export table of a \s-1DSO\s0 and do not require a \s-1PLT\s0 indirection
2118when used within the \s-1DSO\s0. Enabling this option can have a dramatic effect
2119on load and link times of a \s-1DSO\s0 as it massively reduces the size of the
2120dynamic export table when the library makes heavy use of templates.
2122The behavior of this switch is not quite the same as marking the
2123methods as hidden directly, because it does not affect static variables
2124local to the function or cause the compiler to deduce that
2125the function is defined in only one shared object.
2127You may mark a method as having a visibility explicitly to negate the
2128effect of the switch for that method. For example, if you do want to
2129compare pointers to a particular inline method, you might mark it as
2130having default visibility. Marking the enclosing class with explicit
2131visibility will have no effect.
2133Explicitly instantiated inline methods are unaffected by this option
2134as their linkage might otherwise cross a shared library boundary.
2135.IP "\fB\-fvisibility\-ms\-compat\fR" 4
2136.IX Item "-fvisibility-ms-compat"
2137This flag attempts to use visibility settings to make \s-1GCC\s0's \*(C+
2138linkage model compatible with that of Microsoft Visual Studio.
2140The flag makes these changes to \s-1GCC\s0's linkage model:
2141.RS 4
2142.IP "1." 4
2143It sets the default visibility to \f(CW\*(C`hidden\*(C'\fR, like
2145.IP "2." 4
2146Types, but not their members, are not hidden by default.
2147.IP "3." 4
2148The One Definition Rule is relaxed for types without explicit
2149visibility specifications that are defined in more than one different
2150shared object: those declarations are permitted if they would have
2151been permitted when this option was not used.
2153.RS 4
2155In new code it is better to use \fB\-fvisibility=hidden\fR and
2156export those classes that are intended to be externally visible.
2157Unfortunately it is possible for code to rely, perhaps accidentally,
2158on the Visual Studio behavior.
2160Among the consequences of these changes are that static data members
2161of the same type with the same name but defined in different shared
2162objects will be different, so changing one will not change the other;
2163and that pointers to function members defined in different shared
2164objects may not compare equal. When this flag is given, it is a
2165violation of the \s-1ODR\s0 to define types with the same name differently.
2167.IP "\fB\-fno\-weak\fR" 4
2168.IX Item "-fno-weak"
2169Do not use weak symbol support, even if it is provided by the linker.
2170By default, G++ will use weak symbols if they are available. This
2171option exists only for testing, and should not be used by end-users;
2172it will result in inferior code and has no benefits. This option may
2173be removed in a future release of G++.
2174.IP "\fB\-nostdinc++\fR" 4
2175.IX Item "-nostdinc++"
2176Do not search for header files in the standard directories specific to
2177\&\*(C+, but do still search the other standard directories. (This option
2178is used when building the \*(C+ library.)
2180In addition, these optimization, warning, and code generation options
2181have meanings only for \*(C+ programs:
2182.IP "\fB\-fno\-default\-inline\fR" 4
2183.IX Item "-fno-default-inline"
2184Do not assume \fBinline\fR for functions defined inside a class scope.
2185 Note that these
2186functions will have linkage like inline functions; they just won't be
2187inlined by default.
2188.IP "\fB\-Wabi\fR (C, Objective-C, \*(C+ and Objective\-\*(C+ only)" 4
2189.IX Item "-Wabi (C, Objective-C, and Objective- only)"
2190Warn when G++ generates code that is probably not compatible with the
2191vendor-neutral \*(C+ \s-1ABI\s0. Although an effort has been made to warn about
2192all such cases, there are probably some cases that are not warned about,
2193even though G++ is generating incompatible code. There may also be
2194cases where warnings are emitted even though the code that is generated
2195will be compatible.
2197You should rewrite your code to avoid these warnings if you are
2198concerned about the fact that code generated by G++ may not be binary
2199compatible with code generated by other compilers.
2201The known incompatibilities in \fB\-fabi\-version=2\fR (the default) include:
2202.RS 4
2203.IP "\(bu" 4
2204A template with a non-type template parameter of reference type is
2205mangled incorrectly:
2207.Vb 3
2208\& extern int N;
2209\& template <int &> struct S {};
2210\& void n (S<N>) {2}
2213This is fixed in \fB\-fabi\-version=3\fR.
2214.IP "\(bu" 4
2215\&\s-1SIMD\s0 vector types declared using \f(CW\*(C`_\|_attribute ((vector_size))\*(C'\fR are
2216mangled in a non-standard way that does not allow for overloading of
2217functions taking vectors of different sizes.
2219The mangling is changed in \fB\-fabi\-version=4\fR.
2221.RS 4
2223The known incompatibilities in \fB\-fabi\-version=1\fR include:
2224.IP "\(bu" 4
2225Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2226pack data into the same byte as a base class. For example:
2228.Vb 2
2229\& struct A { virtual void f(); int f1 : 1; };
2230\& struct B : public A { int f2 : 1; };
2233In this case, G++ will place \f(CW\*(C`B::f2\*(C'\fR into the same byte
2234as\f(CW\*(C`A::f1\*(C'\fR; other compilers will not. You can avoid this problem
2235by explicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of the
2236byte size on your platform; that will cause G++ and other compilers to
2237layout \f(CW\*(C`B\*(C'\fR identically.
2238.IP "\(bu" 4
2239Incorrect handling of tail-padding for virtual bases. G++ does not use
2240tail padding when laying out virtual bases. For example:
2242.Vb 3
2243\& struct A { virtual void f(); char c1; };
2244\& struct B { B(); char c2; };
2245\& struct C : public A, public virtual B {};
2248In this case, G++ will not place \f(CW\*(C`B\*(C'\fR into the tail-padding for
2249\&\f(CW\*(C`A\*(C'\fR; other compilers will. You can avoid this problem by
2250explicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of its
2251alignment (ignoring virtual base classes); that will cause G++ and other
2252compilers to layout \f(CW\*(C`C\*(C'\fR identically.
2253.IP "\(bu" 4
2254Incorrect handling of bit-fields with declared widths greater than that
2255of their underlying types, when the bit-fields appear in a union. For
2258.Vb 1
2259\& union U { int i : 4096; };
2262Assuming that an \f(CW\*(C`int\*(C'\fR does not have 4096 bits, G++ will make the
2263union too small by the number of bits in an \f(CW\*(C`int\*(C'\fR.
2264.IP "\(bu" 4
2265Empty classes can be placed at incorrect offsets. For example:
2267.Vb 1
2268\& struct A {};
2270\& struct B {
2271\& A a;
2272\& virtual void f ();
2273\& };
2275\& struct C : public B, public A {};
2278G++ will place the \f(CW\*(C`A\*(C'\fR base class of \f(CW\*(C`C\*(C'\fR at a nonzero offset;
2279it should be placed at offset zero. G++ mistakenly believes that the
2280\&\f(CW\*(C`A\*(C'\fR data member of \f(CW\*(C`B\*(C'\fR is already at offset zero.
2281.IP "\(bu" 4
2282Names of template functions whose types involve \f(CW\*(C`typename\*(C'\fR or
2283template template parameters can be mangled incorrectly.
2285.Vb 2
2286\& template <typename Q>
2287\& void f(typename Q::X) {}
2289\& template <template <typename> class Q>
2290\& void f(typename Q<int>::X) {}
2293Instantiations of these templates may be mangled incorrectly.
2295.RS 4
2297It also warns psABI related changes. The known psABI changes at this
2298point include:
2299.IP "\(bu" 4
2300For SYSV/x86\-64, when passing union with long double, it is changed to
2301pass in memory as specified in psABI. For example:
2303.Vb 4
2304\& union U {
2305\& long double ld;
2306\& int i;
2307\& };
2310\&\f(CW\*(C`union U\*(C'\fR will always be passed in memory.
2312.RS 4
2314.IP "\fB\-Wctor\-dtor\-privacy\fR (\*(C+ and Objective\-\*(C+ only)" 4
2315.IX Item "-Wctor-dtor-privacy ( and Objective- only)"
2316Warn when a class seems unusable because all the constructors or
2317destructors in that class are private, and it has neither friends nor
2318public static member functions.
2319.IP "\fB\-Wdelete\-non\-virtual\-dtor\fR (\*(C+ and Objective\-\*(C+ only)" 4
2320.IX Item "-Wdelete-non-virtual-dtor ( and Objective- only)"
2321Warn when \fBdelete\fR is used to destroy an instance of a class that
2322has virtual functions and non-virtual destructor. It is unsafe to delete
2323an instance of a derived class through a pointer to a base class if the
2324base class does not have a virtual destructor. This warning is enabled
2325by \fB\-Wall\fR.
2326.IP "\fB\-Wnarrowing\fR (\*(C+ and Objective\-\*(C+ only)" 4
2327.IX Item "-Wnarrowing ( and Objective- only)"
2328Warn when a narrowing conversion prohibited by \*(C+11 occurs within
2329\&\fB{ }\fR, e.g.
2331.Vb 1
2332\& int i = { 2.2 }; // error: narrowing from double to int
2335This flag is included in \fB\-Wall\fR and \fB\-Wc++11\-compat\fR.
2337With \-std=c++11, \fB\-Wno\-narrowing\fR suppresses the diagnostic
2338required by the standard. Note that this does not affect the meaning
2339of well-formed code; narrowing conversions are still considered
2340ill-formed in \s-1SFINAE\s0 context.
2341.IP "\fB\-Wnoexcept\fR (\*(C+ and Objective\-\*(C+ only)" 4
2342.IX Item "-Wnoexcept ( and Objective- only)"
2343Warn when a noexcept-expression evaluates to false because of a call
2344to a function that does not have a non-throwing exception
2345specification (i.e. \fB\f(BIthrow()\fB\fR or \fBnoexcept\fR) but is known by
2346the compiler to never throw an exception.
2347.IP "\fB\-Wnon\-virtual\-dtor\fR (\*(C+ and Objective\-\*(C+ only)" 4
2348.IX Item "-Wnon-virtual-dtor ( and Objective- only)"
2349Warn when a class has virtual functions and accessible non-virtual
2350destructor, in which case it would be possible but unsafe to delete
2351an instance of a derived class through a pointer to the base class.
2352This warning is also enabled if \fB\-Weffc++\fR is specified.
2353.IP "\fB\-Wreorder\fR (\*(C+ and Objective\-\*(C+ only)" 4
2354.IX Item "-Wreorder ( and Objective- only)"
2355Warn when the order of member initializers given in the code does not
2356match the order in which they must be executed. For instance:
2358.Vb 5
2359\& struct A {
2360\& int i;
2361\& int j;
2362\& A(): j (0), i (1) { }
2363\& };
2366The compiler will rearrange the member initializers for \fBi\fR
2367and \fBj\fR to match the declaration order of the members, emitting
2368a warning to that effect. This warning is enabled by \fB\-Wall\fR.
2370The following \fB\-W...\fR options are not affected by \fB\-Wall\fR.
2371.IP "\fB\-Weffc++\fR (\*(C+ and Objective\-\*(C+ only)" 4
2372.IX Item "-Weffc++ ( and Objective- only)"
2373Warn about violations of the following style guidelines from Scott Meyers'
2374\&\fIEffective \*(C+, Second Edition\fR book:
2375.RS 4
2376.IP "\(bu" 4
2377Item 11: Define a copy constructor and an assignment operator for classes
2378with dynamically allocated memory.
2379.IP "\(bu" 4
2380Item 12: Prefer initialization to assignment in constructors.
2381.IP "\(bu" 4
2382Item 14: Make destructors virtual in base classes.
2383.IP "\(bu" 4
2384Item 15: Have \f(CW\*(C`operator=\*(C'\fR return a reference to \f(CW*this\fR.
2385.IP "\(bu" 4
2386Item 23: Don't try to return a reference when you must return an object.
2388.RS 4
2390Also warn about violations of the following style guidelines from
2391Scott Meyers' \fIMore Effective \*(C+\fR book:
2392.IP "\(bu" 4
2393Item 6: Distinguish between prefix and postfix forms of increment and
2394decrement operators.
2395.IP "\(bu" 4
2396Item 7: Never overload \f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, or \f(CW\*(C`,\*(C'\fR.
2398.RS 4
2400When selecting this option, be aware that the standard library
2401headers do not obey all of these guidelines; use \fBgrep \-v\fR
2402to filter out those warnings.
2404.IP "\fB\-Wstrict\-null\-sentinel\fR (\*(C+ and Objective\-\*(C+ only)" 4
2405.IX Item "-Wstrict-null-sentinel ( and Objective- only)"
2406Warn also about the use of an uncasted \f(CW\*(C`NULL\*(C'\fR as sentinel. When
2407compiling only with \s-1GCC\s0 this is a valid sentinel, as \f(CW\*(C`NULL\*(C'\fR is defined
2408to \f(CW\*(C`_\|_null\*(C'\fR. Although it is a null pointer constant not a null pointer,
2409it is guaranteed to be of the same size as a pointer. But this use is
2410not portable across different compilers.
2411.IP "\fB\-Wno\-non\-template\-friend\fR (\*(C+ and Objective\-\*(C+ only)" 4
2412.IX Item "-Wno-non-template-friend ( and Objective- only)"
2413Disable warnings when non-templatized friend functions are declared
2414within a template. Since the advent of explicit template specification
2415support in G++, if the name of the friend is an unqualified-id (i.e.,
2416\&\fBfriend foo(int)\fR), the \*(C+ language specification demands that the
2417friend declare or define an ordinary, nontemplate function. (Section
241814.5.3). Before G++ implemented explicit specification, unqualified-ids
2419could be interpreted as a particular specialization of a templatized
2420function. Because this non-conforming behavior is no longer the default
2421behavior for G++, \fB\-Wnon\-template\-friend\fR allows the compiler to
2422check existing code for potential trouble spots and is on by default.
2423This new compiler behavior can be turned off with
2424\&\fB\-Wno\-non\-template\-friend\fR, which keeps the conformant compiler code
2425but disables the helpful warning.
2426.IP "\fB\-Wold\-style\-cast\fR (\*(C+ and Objective\-\*(C+ only)" 4
2427.IX Item "-Wold-style-cast ( and Objective- only)"
2428Warn if an old-style (C\-style) cast to a non-void type is used within
2429a \*(C+ program. The new-style casts (\fBdynamic_cast\fR,
2430\&\fBstatic_cast\fR, \fBreinterpret_cast\fR, and \fBconst_cast\fR) are
2431less vulnerable to unintended effects and much easier to search for.
2432.IP "\fB\-Woverloaded\-virtual\fR (\*(C+ and Objective\-\*(C+ only)" 4
2433.IX Item "-Woverloaded-virtual ( and Objective- only)"
2434Warn when a function declaration hides virtual functions from a
2435base class. For example, in:
2437.Vb 3
2438\& struct A {
2439\& virtual void f();
2440\& };
2442\& struct B: public A {
2443\& void f(int);
2444\& };
2447the \f(CW\*(C`A\*(C'\fR class version of \f(CW\*(C`f\*(C'\fR is hidden in \f(CW\*(C`B\*(C'\fR, and code
2450.Vb 2
2451\& B* b;
2452\& b\->f();
2455will fail to compile.
2456.IP "\fB\-Wno\-pmf\-conversions\fR (\*(C+ and Objective\-\*(C+ only)" 4
2457.IX Item "-Wno-pmf-conversions ( and Objective- only)"
2458Disable the diagnostic for converting a bound pointer to member function
2459to a plain pointer.
2460.IP "\fB\-Wsign\-promo\fR (\*(C+ and Objective\-\*(C+ only)" 4
2461.IX Item "-Wsign-promo ( and Objective- only)"
2462Warn when overload resolution chooses a promotion from unsigned or
2463enumerated type to a signed type, over a conversion to an unsigned type of
2464the same size. Previous versions of G++ would try to preserve
2465unsignedness, but the standard mandates the current behavior.
2467.Vb 4
2468\& struct A {
2469\& operator int ();
2470\& A& operator = (int);
2471\& };
2473\& main ()
2474\& {
2475\& A a,b;
2476\& a = b;
2477\& }
2480In this example, G++ will synthesize a default \fBA& operator =
2481(const A&);\fR, while cfront will use the user-defined \fBoperator =\fR.
5ce9237c 2482.Sh "Options Controlling Objective-C and Objective\-\*(C+ Dialects"
2483.IX Subsection "Options Controlling Objective-C and Objective- Dialects"
2484(\s-1NOTE:\s0 This manual does not describe the Objective-C and Objective\-\*(C+
2485languages themselves.
2487This section describes the command-line options that are only meaningful
2488for Objective-C and Objective\-\*(C+ programs, but you can also use most of
2489the language-independent \s-1GNU\s0 compiler options.
2490For example, you might compile a file \f(CW\*(C`some_class.m\*(C'\fR like this:
2492.Vb 1
2493\& gcc \-g \-fgnu\-runtime \-O \-c some_class.m
2496In this example, \fB\-fgnu\-runtime\fR is an option meant only for
2497Objective-C and Objective\-\*(C+ programs; you can use the other options with
2498any language supported by \s-1GCC\s0.
2500Note that since Objective-C is an extension of the C language, Objective-C
2501compilations may also use options specific to the C front-end (e.g.,
2502\&\fB\-Wtraditional\fR). Similarly, Objective\-\*(C+ compilations may use
2503\&\*(C+\-specific options (e.g., \fB\-Wabi\fR).
2505Here is a list of options that are \fIonly\fR for compiling Objective-C
2506and Objective\-\*(C+ programs:
2507.IP "\fB\-fconstant\-string\-class=\fR\fIclass-name\fR" 4
2508.IX Item "-fconstant-string-class=class-name"
2509Use \fIclass-name\fR as the name of the class to instantiate for each
2510literal string specified with the syntax \f(CW\*(C`@"..."\*(C'\fR. The default
2511class name is \f(CW\*(C`NXConstantString\*(C'\fR if the \s-1GNU\s0 runtime is being used, and
2512\&\f(CW\*(C`NSConstantString\*(C'\fR if the NeXT runtime is being used (see below). The
2513\&\fB\-fconstant\-cfstrings\fR option, if also present, will override the
2514\&\fB\-fconstant\-string\-class\fR setting and cause \f(CW\*(C`@"..."\*(C'\fR literals
2515to be laid out as constant CoreFoundation strings.
2516.IP "\fB\-fgnu\-runtime\fR" 4
2517.IX Item "-fgnu-runtime"
2518Generate object code compatible with the standard \s-1GNU\s0 Objective-C
2519runtime. This is the default for most types of systems.
2520.IP "\fB\-fnext\-runtime\fR" 4
2521.IX Item "-fnext-runtime"
2522Generate output compatible with the NeXT runtime. This is the default
2523for NeXT-based systems, including Darwin and Mac \s-1OS\s0 X. The macro
2524\&\f(CW\*(C`_\|_NEXT_RUNTIME_\|_\*(C'\fR is predefined if (and only if) this option is
2526.IP "\fB\-fno\-nil\-receivers\fR" 4
2527.IX Item "-fno-nil-receivers"
2528Assume that all Objective-C message dispatches (\f(CW\*(C`[receiver
2529message:arg]\*(C'\fR) in this translation unit ensure that the receiver is
2530not \f(CW\*(C`nil\*(C'\fR. This allows for more efficient entry points in the
2531runtime to be used. This option is only available in conjunction with
2532the NeXT runtime and \s-1ABI\s0 version 0 or 1.
2533.IP "\fB\-fobjc\-abi\-version=\fR\fIn\fR" 4
2534.IX Item "-fobjc-abi-version=n"
2535Use version \fIn\fR of the Objective-C \s-1ABI\s0 for the selected runtime.
2536This option is currently supported only for the NeXT runtime. In that
2537case, Version 0 is the traditional (32\-bit) \s-1ABI\s0 without support for
2538properties and other Objective-C 2.0 additions. Version 1 is the
2539traditional (32\-bit) \s-1ABI\s0 with support for properties and other
2540Objective-C 2.0 additions. Version 2 is the modern (64\-bit) \s-1ABI\s0. If
2541nothing is specified, the default is Version 0 on 32\-bit target
2542machines, and Version 2 on 64\-bit target machines.
2543.IP "\fB\-fobjc\-call\-cxx\-cdtors\fR" 4
2544.IX Item "-fobjc-call-cxx-cdtors"
2545For each Objective-C class, check if any of its instance variables is a
2546\&\*(C+ object with a non-trivial default constructor. If so, synthesize a
2547special \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR instance method which will run
2548non-trivial default constructors on any such instance variables, in order,
2549and then return \f(CW\*(C`self\*(C'\fR. Similarly, check if any instance variable
2550is a \*(C+ object with a non-trivial destructor, and if so, synthesize a
2551special \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR method which will run
2552all such default destructors, in reverse order.
2554The \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR and \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR
2555methods thusly generated will only operate on instance variables
2556declared in the current Objective-C class, and not those inherited
2557from superclasses. It is the responsibility of the Objective-C
2558runtime to invoke all such methods in an object's inheritance
2559hierarchy. The \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR methods will be invoked
2560by the runtime immediately after a new object instance is allocated;
2561the \f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR methods will be invoked immediately
2562before the runtime deallocates an object instance.
2564As of this writing, only the NeXT runtime on Mac \s-1OS\s0 X 10.4 and later has
2565support for invoking the \f(CW\*(C`\- (id) .cxx_construct\*(C'\fR and
2566\&\f(CW\*(C`\- (void) .cxx_destruct\*(C'\fR methods.
2567.IP "\fB\-fobjc\-direct\-dispatch\fR" 4
2568.IX Item "-fobjc-direct-dispatch"
2569Allow fast jumps to the message dispatcher. On Darwin this is
2570accomplished via the comm page.
2571.IP "\fB\-fobjc\-exceptions\fR" 4
2572.IX Item "-fobjc-exceptions"
2573Enable syntactic support for structured exception handling in
2574Objective-C, similar to what is offered by \*(C+ and Java. This option
2575is required to use the Objective-C keywords \f(CW@try\fR,
2576\&\f(CW@throw\fR, \f(CW@catch\fR, \f(CW@finally\fR and
2577\&\f(CW@synchronized\fR. This option is available with both the \s-1GNU\s0
2578runtime and the NeXT runtime (but not available in conjunction with
2579the NeXT runtime on Mac \s-1OS\s0 X 10.2 and earlier).
2580.IP "\fB\-fobjc\-gc\fR" 4
2581.IX Item "-fobjc-gc"
2582Enable garbage collection (\s-1GC\s0) in Objective-C and Objective\-\*(C+
2583programs. This option is only available with the NeXT runtime; the
2584\&\s-1GNU\s0 runtime has a different garbage collection implementation that
2585does not require special compiler flags.
2586.IP "\fB\-fobjc\-nilcheck\fR" 4
2587.IX Item "-fobjc-nilcheck"
2588For the NeXT runtime with version 2 of the \s-1ABI\s0, check for a nil
2589receiver in method invocations before doing the actual method call.
2590This is the default and can be disabled using
2591\&\fB\-fno\-objc\-nilcheck\fR. Class methods and super calls are never
2592checked for nil in this way no matter what this flag is set to.
2593Currently this flag does nothing when the \s-1GNU\s0 runtime, or an older
2594version of the NeXT runtime \s-1ABI\s0, is used.
2595.IP "\fB\-fobjc\-std=objc1\fR" 4
2596.IX Item "-fobjc-std=objc1"
2597Conform to the language syntax of Objective-C 1.0, the language
2598recognized by \s-1GCC\s0 4.0. This only affects the Objective-C additions to
2599the C/\*(C+ language; it does not affect conformance to C/\*(C+ standards,
2600which is controlled by the separate C/\*(C+ dialect option flags. When
2601this option is used with the Objective-C or Objective\-\*(C+ compiler,
2602any Objective-C syntax that is not recognized by \s-1GCC\s0 4.0 is rejected.
2603This is useful if you need to make sure that your Objective-C code can
2604be compiled with older versions of \s-1GCC\s0.
2605.IP "\fB\-freplace\-objc\-classes\fR" 4
2606.IX Item "-freplace-objc-classes"
2607Emit a special marker instructing \fB\f(BIld\fB\|(1)\fR not to statically link in
2608the resulting object file, and allow \fB\f(BIdyld\fB\|(1)\fR to load it in at
2609run time instead. This is used in conjunction with the Fix-and-Continue
2610debugging mode, where the object file in question may be recompiled and
2611dynamically reloaded in the course of program execution, without the need
2612to restart the program itself. Currently, Fix-and-Continue functionality
2613is only available in conjunction with the NeXT runtime on Mac \s-1OS\s0 X 10.3
2614and later.
2615.IP "\fB\-fzero\-link\fR" 4
2616.IX Item "-fzero-link"
2617When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2618to \f(CW\*(C`objc_getClass("...")\*(C'\fR (when the name of the class is known at
2619compile time) with static class references that get initialized at load time,
2620which improves run-time performance. Specifying the \fB\-fzero\-link\fR flag
2621suppresses this behavior and causes calls to \f(CW\*(C`objc_getClass("...")\*(C'\fR
2622to be retained. This is useful in Zero-Link debugging mode, since it allows
2623for individual class implementations to be modified during program execution.
2624The \s-1GNU\s0 runtime currently always retains calls to \f(CW\*(C`objc_get_class("...")\*(C'\fR
2625regardless of command-line options.
2626.IP "\fB\-gen\-decls\fR" 4
2627.IX Item "-gen-decls"
2628Dump interface declarations for all classes seen in the source file to a
2629file named \fI\fIsourcename\fI.decl\fR.
2630.IP "\fB\-Wassign\-intercept\fR (Objective-C and Objective\-\*(C+ only)" 4
2631.IX Item "-Wassign-intercept (Objective-C and Objective- only)"
2632Warn whenever an Objective-C assignment is being intercepted by the
2633garbage collector.
2634.IP "\fB\-Wno\-protocol\fR (Objective-C and Objective\-\*(C+ only)" 4
2635.IX Item "-Wno-protocol (Objective-C and Objective- only)"
2636If a class is declared to implement a protocol, a warning is issued for
2637every method in the protocol that is not implemented by the class. The
2638default behavior is to issue a warning for every method not explicitly
2639implemented in the class, even if a method implementation is inherited
2640from the superclass. If you use the \fB\-Wno\-protocol\fR option, then
2641methods inherited from the superclass are considered to be implemented,
2642and no warning is issued for them.
2643.IP "\fB\-Wselector\fR (Objective-C and Objective\-\*(C+ only)" 4
2644.IX Item "-Wselector (Objective-C and Objective- only)"
2645Warn if multiple methods of different types for the same selector are
2646found during compilation. The check is performed on the list of methods
2647in the final stage of compilation. Additionally, a check is performed
2648for each selector appearing in a \f(CW\*(C`@selector(...)\*(C'\fR
2649expression, and a corresponding method for that selector has been found
2650during compilation. Because these checks scan the method table only at
2651the end of compilation, these warnings are not produced if the final
2652stage of compilation is not reached, for example because an error is
2653found during compilation, or because the \fB\-fsyntax\-only\fR option is
2654being used.
2655.IP "\fB\-Wstrict\-selector\-match\fR (Objective-C and Objective\-\*(C+ only)" 4
2656.IX Item "-Wstrict-selector-match (Objective-C and Objective- only)"
2657Warn if multiple methods with differing argument and/or return types are
2658found for a given selector when attempting to send a message using this
2659selector to a receiver of type \f(CW\*(C`id\*(C'\fR or \f(CW\*(C`Class\*(C'\fR. When this flag
2660is off (which is the default behavior), the compiler will omit such warnings
2661if any differences found are confined to types that share the same size
2662and alignment.
2663.IP "\fB\-Wundeclared\-selector\fR (Objective-C and Objective\-\*(C+ only)" 4
2664.IX Item "-Wundeclared-selector (Objective-C and Objective- only)"
2665Warn if a \f(CW\*(C`@selector(...)\*(C'\fR expression referring to an
2666undeclared selector is found. A selector is considered undeclared if no
2667method with that name has been declared before the
2668\&\f(CW\*(C`@selector(...)\*(C'\fR expression, either explicitly in an
2669\&\f(CW@interface\fR or \f(CW@protocol\fR declaration, or implicitly in
2670an \f(CW@implementation\fR section. This option always performs its
2671checks as soon as a \f(CW\*(C`@selector(...)\*(C'\fR expression is found,
2672while \fB\-Wselector\fR only performs its checks in the final stage of
2673compilation. This also enforces the coding style convention
2674that methods and selectors must be declared before being used.
2675.IP "\fB\-print\-objc\-runtime\-info\fR" 4
2676.IX Item "-print-objc-runtime-info"
2677Generate C header describing the largest structure that is passed by
2678value, if any.
5ce9237c 2679.Sh "Options to Control Diagnostic Messages Formatting"
2680.IX Subsection "Options to Control Diagnostic Messages Formatting"
2681Traditionally, diagnostic messages have been formatted irrespective of
2682the output device's aspect (e.g. its width, ...). The options described
2683below can be used to control the diagnostic messages formatting
2684algorithm, e.g. how many characters per line, how often source location
2685information should be reported. Right now, only the \*(C+ front end can
2686honor these options. However it is expected, in the near future, that
2687the remaining front ends would be able to digest them correctly.
2688.IP "\fB\-fmessage\-length=\fR\fIn\fR" 4
2689.IX Item "-fmessage-length=n"
2690Try to format error messages so that they fit on lines of about \fIn\fR
2691characters. The default is 72 characters for \fBg++\fR and 0 for the rest of
2692the front ends supported by \s-1GCC\s0. If \fIn\fR is zero, then no
2693line-wrapping will be done; each error message will appear on a single
2695.IP "\fB\-fdiagnostics\-show\-location=once\fR" 4
2696.IX Item "-fdiagnostics-show-location=once"
2697Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2698reporter to emit \fIonce\fR source location information; that is, in
2699case the message is too long to fit on a single physical line and has to
2700be wrapped, the source location won't be emitted (as prefix) again,
2701over and over, in subsequent continuation lines. This is the default
2703.IP "\fB\-fdiagnostics\-show\-location=every\-line\fR" 4
2704.IX Item "-fdiagnostics-show-location=every-line"
2705Only meaningful in line-wrapping mode. Instructs the diagnostic
2706messages reporter to emit the same source location information (as
2707prefix) for physical lines that result from the process of breaking
2708a message which is too long to fit on a single line.
2709.IP "\fB\-fno\-diagnostics\-show\-option\fR" 4
2710.IX Item "-fno-diagnostics-show-option"
2711By default, each diagnostic emitted includes text indicating the
2712command-line option that directly controls the diagnostic (if such an
2713option is known to the diagnostic machinery). Specifying the
2714\&\fB\-fno\-diagnostics\-show\-option\fR flag suppresses that behavior.
5ce9237c 2715.Sh "Options to Request or Suppress Warnings"
2716.IX Subsection "Options to Request or Suppress Warnings"
2717Warnings are diagnostic messages that report constructions that
2718are not inherently erroneous but that are risky or suggest there
2719may have been an error.
2721The following language-independent options do not enable specific
2722warnings but control the kinds of diagnostics produced by \s-1GCC\s0.
2723.IP "\fB\-fsyntax\-only\fR" 4
2724.IX Item "-fsyntax-only"
2725Check the code for syntax errors, but don't do anything beyond that.
2726.IP "\fB\-fmax\-errors=\fR\fIn\fR" 4
2727.IX Item "-fmax-errors=n"
2728Limits the maximum number of error messages to \fIn\fR, at which point
2729\&\s-1GCC\s0 bails out rather than attempting to continue processing the source
2730code. If \fIn\fR is 0 (the default), there is no limit on the number
2731of error messages produced. If \fB\-Wfatal\-errors\fR is also
2732specified, then \fB\-Wfatal\-errors\fR takes precedence over this
2734.IP "\fB\-w\fR" 4
2735.IX Item "-w"
2736Inhibit all warning messages.
2737.IP "\fB\-Werror\fR" 4
2738.IX Item "-Werror"
2739Make all warnings into errors.
2740.IP "\fB\-Werror=\fR" 4
2741.IX Item "-Werror="
2742Make the specified warning into an error. The specifier for a warning
2743is appended, for example \fB\-Werror=switch\fR turns the warnings
2744controlled by \fB\-Wswitch\fR into errors. This switch takes a
2745negative form, to be used to negate \fB\-Werror\fR for specific
2746warnings, for example \fB\-Wno\-error=switch\fR makes
2747\&\fB\-Wswitch\fR warnings not be errors, even when \fB\-Werror\fR
2748is in effect.
2750The warning message for each controllable warning includes the
2751option that controls the warning. That option can then be used with
2752\&\fB\-Werror=\fR and \fB\-Wno\-error=\fR as described above.
2753(Printing of the option in the warning message can be disabled using the
2754\&\fB\-fno\-diagnostics\-show\-option\fR flag.)
2756Note that specifying \fB\-Werror=\fR\fIfoo\fR automatically implies
2757\&\fB\-W\fR\fIfoo\fR. However, \fB\-Wno\-error=\fR\fIfoo\fR does not
2758imply anything.
2759.IP "\fB\-Wfatal\-errors\fR" 4
2760.IX Item "-Wfatal-errors"
2761This option causes the compiler to abort compilation on the first error
2762occurred rather than trying to keep going and printing further error
2765You can request many specific warnings with options beginning
2766\&\fB\-W\fR, for example \fB\-Wimplicit\fR to request warnings on
2767implicit declarations. Each of these specific warning options also
2768has a negative form beginning \fB\-Wno\-\fR to turn off warnings; for
2769example, \fB\-Wno\-implicit\fR. This manual lists only one of the
2770two forms, whichever is not the default. For further,
2771language-specific options also refer to \fB\*(C+ Dialect Options\fR and
2772\&\fBObjective-C and Objective\-\*(C+ Dialect Options\fR.
2774When an unrecognized warning option is requested (e.g.,
2775\&\fB\-Wunknown\-warning\fR), \s-1GCC\s0 will emit a diagnostic stating
2776that the option is not recognized. However, if the \fB\-Wno\-\fR form
2777is used, the behavior is slightly different: No diagnostic will be
2778produced for \fB\-Wno\-unknown\-warning\fR unless other diagnostics
2779are being produced. This allows the use of new \fB\-Wno\-\fR options
2780with old compilers, but if something goes wrong, the compiler will
2781warn that an unrecognized option was used.
2782.IP "\fB\-pedantic\fR" 4
2783.IX Item "-pedantic"
2784Issue all the warnings demanded by strict \s-1ISO\s0 C and \s-1ISO\s0 \*(C+;
2785reject all programs that use forbidden extensions, and some other
2786programs that do not follow \s-1ISO\s0 C and \s-1ISO\s0 \*(C+. For \s-1ISO\s0 C, follows the
2787version of the \s-1ISO\s0 C standard specified by any \fB\-std\fR option used.
2789Valid \s-1ISO\s0 C and \s-1ISO\s0 \*(C+ programs should compile properly with or without
2790this option (though a rare few will require \fB\-ansi\fR or a
2791\&\fB\-std\fR option specifying the required version of \s-1ISO\s0 C). However,
2792without this option, certain \s-1GNU\s0 extensions and traditional C and \*(C+
2793features are supported as well. With this option, they are rejected.
2795\&\fB\-pedantic\fR does not cause warning messages for use of the
2796alternate keywords whose names begin and end with \fB_\|_\fR. Pedantic
2797warnings are also disabled in the expression that follows
2798\&\f(CW\*(C`_\|_extension_\|_\*(C'\fR. However, only system header files should use
2799these escape routes; application programs should avoid them.
2801Some users try to use \fB\-pedantic\fR to check programs for strict \s-1ISO\s0
2802C conformance. They soon find that it does not do quite what they want:
2803it finds some non-ISO practices, but not all\-\-\-only those for which
2804\&\s-1ISO\s0 C \fIrequires\fR a diagnostic, and some others for which
2805diagnostics have been added.
2807A feature to report any failure to conform to \s-1ISO\s0 C might be useful in
2808some instances, but would require considerable additional work and would
2809be quite different from \fB\-pedantic\fR. We don't have plans to
2810support such a feature in the near future.
2812Where the standard specified with \fB\-std\fR represents a \s-1GNU\s0
2813extended dialect of C, such as \fBgnu90\fR or \fBgnu99\fR, there is a
2814corresponding \fIbase standard\fR, the version of \s-1ISO\s0 C on which the \s-1GNU\s0
2815extended dialect is based. Warnings from \fB\-pedantic\fR are given
2816where they are required by the base standard. (It would not make sense
2817for such warnings to be given only for features not in the specified \s-1GNU\s0
2818C dialect, since by definition the \s-1GNU\s0 dialects of C include all
2819features the compiler supports with the given option, and there would be
2820nothing to warn about.)
2821.IP "\fB\-pedantic\-errors\fR" 4
2822.IX Item "-pedantic-errors"
2823Like \fB\-pedantic\fR, except that errors are produced rather than
2825.IP "\fB\-Wall\fR" 4
2826.IX Item "-Wall"
2827This enables all the warnings about constructions that some users
2828consider questionable, and that are easy to avoid (or modify to
2829prevent the warning), even in conjunction with macros. This also
2830enables some language-specific warnings described in \fB\*(C+ Dialect
2831Options\fR and \fBObjective-C and Objective\-\*(C+ Dialect Options\fR.
2833\&\fB\-Wall\fR turns on the following warning flags:
2836\&\-Warray\-bounds\fR (only with\fB \fR\fB\-O2\fR)
2839\&\-Wenum\-compare\fR (in C/Objc; this is on by default in \*(C+)
2840\&\fB\-Wimplicit\-int\fR (C and Objective-C only)
2841\&\fB\-Wimplicit\-function\-declaration\fR (C and Objective-C only)
2844\&\-Wmain\fR (only for C/ObjC and unless\fB \fR\fB\-ffreestanding\fR)
2853\&\-Wsign\-compare\fR (only in \*(C+)
2866Note that some warning flags are not implied by \fB\-Wall\fR. Some of
2867them warn about constructions that users generally do not consider
2868questionable, but which occasionally you might wish to check for;
2869others warn about constructions that are necessary or hard to avoid in
2870some cases, and there is no simple way to modify the code to suppress
2871the warning. Some of them are enabled by \fB\-Wextra\fR but many of
2872them must be enabled individually.
2873.IP "\fB\-Wextra\fR" 4
2874.IX Item "-Wextra"
2875This enables some extra warning flags that are not enabled by
2876\&\fB\-Wall\fR. (This option used to be called \fB\-W\fR. The older
2877name is still supported, but the newer name is more descriptive.)
2883\&\-Wmissing\-parameter\-type\fR (C only)
2884\&\fB\-Wold\-style\-declaration\fR (C only)
2889\&\-Wunused\-parameter\fR (only with\fB \fR\fB\-Wunused\fR\fB \fRor\fB \fR\fB\-Wall\fR)
2890\&\fB\-Wunused\-but\-set\-parameter\fR (only with\fB \fR\fB\-Wunused\fR\fB \fRor\fB \fR\fB\-Wall\fR) \fB \fR
2892The option \fB\-Wextra\fR also prints warning messages for the
2893following cases:
2894.RS 4
2895.IP "\(bu" 4
2896A pointer is compared against integer zero with \fB<\fR, \fB<=\fR,
2897\&\fB>\fR, or \fB>=\fR.
2898.IP "\(bu" 4
2899(\*(C+ only) An enumerator and a non-enumerator both appear in a
2900conditional expression.
2901.IP "\(bu" 4
2902(\*(C+ only) Ambiguous virtual bases.
2903.IP "\(bu" 4
2904(\*(C+ only) Subscripting an array that has been declared \fBregister\fR.
2905.IP "\(bu" 4
2906(\*(C+ only) Taking the address of a variable that has been declared
2908.IP "\(bu" 4
2909(\*(C+ only) A base class is not initialized in a derived class' copy
2912.RS 4
2914.IP "\fB\-Wchar\-subscripts\fR" 4
2915.IX Item "-Wchar-subscripts"
2916Warn if an array subscript has type \f(CW\*(C`char\*(C'\fR. This is a common cause
2917of error, as programmers often forget that this type is signed on some
2919This warning is enabled by \fB\-Wall\fR.
2920.IP "\fB\-Wcomment\fR" 4
2921.IX Item "-Wcomment"
2922Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR
2923comment, or whenever a Backslash-Newline appears in a \fB//\fR comment.
2924This warning is enabled by \fB\-Wall\fR.
2925.IP "\fB\-Wno\-coverage\-mismatch\fR" 4
2926.IX Item "-Wno-coverage-mismatch"
2927Warn if feedback profiles do not match when using the
2928\&\fB\-fprofile\-use\fR option.
2929If a source file was changed between \fB\-fprofile\-gen\fR and
2930\&\fB\-fprofile\-use\fR, the files with the profile feedback can fail
2931to match the source file and \s-1GCC\s0 cannot use the profile feedback
2932information. By default, this warning is enabled and is treated as an
2933error. \fB\-Wno\-coverage\-mismatch\fR can be used to disable the
2934warning or \fB\-Wno\-error=coverage\-mismatch\fR can be used to
2935disable the error. Disabling the error for this warning can result in
2936poorly optimized code and is useful only in the
2937case of very minor changes such as bug fixes to an existing code-base.
2938Completely disabling the warning is not recommended.
2939.IP "\fB\-Wno\-cpp\fR" 4
2940.IX Item "-Wno-cpp"
2941(C, Objective-C, \*(C+, Objective\-\*(C+ and Fortran only)
2943Suppress warning messages emitted by \f(CW\*(C`#warning\*(C'\fR directives.
2944.IP "\fB\-Wdouble\-promotion\fR (C, \*(C+, Objective-C and Objective\-\*(C+ only)" 4
2945.IX Item "-Wdouble-promotion (C, , Objective-C and Objective- only)"
2946Give a warning when a value of type \f(CW\*(C`float\*(C'\fR is implicitly
2947promoted to \f(CW\*(C`double\*(C'\fR. CPUs with a 32\-bit \*(L"single-precision\*(R"
2948floating-point unit implement \f(CW\*(C`float\*(C'\fR in hardware, but emulate
2949\&\f(CW\*(C`double\*(C'\fR in software. On such a machine, doing computations
2950using \f(CW\*(C`double\*(C'\fR values is much more expensive because of the
2951overhead required for software emulation.
2953It is easy to accidentally do computations with \f(CW\*(C`double\*(C'\fR because
2954floating-point literals are implicitly of type \f(CW\*(C`double\*(C'\fR. For
2955example, in:
2957.Vb 4
2958\& float area(float radius)
2959\& {
2960\& return 3.14159 * radius * radius;
2961\& }
2964the compiler will perform the entire computation with \f(CW\*(C`double\*(C'\fR
2965because the floating-point literal is a \f(CW\*(C`double\*(C'\fR.
2966.IP "\fB\-Wformat\fR" 4
2967.IX Item "-Wformat"
2968Check calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR, etc., to make sure that
2969the arguments supplied have types appropriate to the format string
2970specified, and that the conversions specified in the format string make
2971sense. This includes standard functions, and others specified by format
2972attributes, in the \f(CW\*(C`printf\*(C'\fR,
2973\&\f(CW\*(C`scanf\*(C'\fR, \f(CW\*(C`strftime\*(C'\fR and \f(CW\*(C`strfmon\*(C'\fR (an X/Open extension,
2974not in the C standard) families (or other target-specific families).
2975Which functions are checked without format attributes having been
2976specified depends on the standard version selected, and such checks of
2977functions without the attribute specified are disabled by
2978\&\fB\-ffreestanding\fR or \fB\-fno\-builtin\fR.
2980The formats are checked against the format features supported by \s-1GNU\s0
2981libc version 2.2. These include all \s-1ISO\s0 C90 and C99 features, as well
2982as features from the Single Unix Specification and some \s-1BSD\s0 and \s-1GNU\s0
2983extensions. Other library implementations may not support all these
2984features; \s-1GCC\s0 does not support warning about features that go beyond a
2985particular library's limitations. However, if \fB\-pedantic\fR is used
2986with \fB\-Wformat\fR, warnings will be given about format features not
2987in the selected standard version (but not for \f(CW\*(C`strfmon\*(C'\fR formats,
2988since those are not in any version of the C standard).
2990Since \fB\-Wformat\fR also checks for null format arguments for
2991several functions, \fB\-Wformat\fR also implies \fB\-Wnonnull\fR.
2993\&\fB\-Wformat\fR is included in \fB\-Wall\fR. For more control over some
2994aspects of format checking, the options \fB\-Wformat\-y2k\fR,
2995\&\fB\-Wno\-format\-extra\-args\fR, \fB\-Wno\-format\-zero\-length\fR,
2996\&\fB\-Wformat\-nonliteral\fR, \fB\-Wformat\-security\fR, and
2997\&\fB\-Wformat=2\fR are available, but are not included in \fB\-Wall\fR.
2998.IP "\fB\-Wformat\-y2k\fR" 4
2999.IX Item "-Wformat-y2k"
3000If \fB\-Wformat\fR is specified, also warn about \f(CW\*(C`strftime\*(C'\fR
3001formats that may yield only a two-digit year.
3002.IP "\fB\-Wno\-format\-contains\-nul\fR" 4
3003.IX Item "-Wno-format-contains-nul"
3004If \fB\-Wformat\fR is specified, do not warn about format strings that
3005contain \s-1NUL\s0 bytes.
3006.IP "\fB\-Wno\-format\-extra\-args\fR" 4
3007.IX Item "-Wno-format-extra-args"
3008If \fB\-Wformat\fR is specified, do not warn about excess arguments to a
3009\&\f(CW\*(C`printf\*(C'\fR or \f(CW\*(C`scanf\*(C'\fR format function. The C standard specifies
3010that such arguments are ignored.
3012Where the unused arguments lie between used arguments that are
3013specified with \fB$\fR operand number specifications, normally
3014warnings are still given, since the implementation could not know what
3015type to pass to \f(CW\*(C`va_arg\*(C'\fR to skip the unused arguments. However,
3016in the case of \f(CW\*(C`scanf\*(C'\fR formats, this option will suppress the
3017warning if the unused arguments are all pointers, since the Single
3018Unix Specification says that such unused arguments are allowed.
3019.IP "\fB\-Wno\-format\-zero\-length\fR" 4
3020.IX Item "-Wno-format-zero-length"
3021If \fB\-Wformat\fR is specified, do not warn about zero-length formats.
3022The C standard specifies that zero-length formats are allowed.
3023.IP "\fB\-Wformat\-nonliteral\fR" 4
3024.IX Item "-Wformat-nonliteral"
3025If \fB\-Wformat\fR is specified, also warn if the format string is not a
3026string literal and so cannot be checked, unless the format function
3027takes its format arguments as a \f(CW\*(C`va_list\*(C'\fR.
3028.IP "\fB\-Wformat\-security\fR" 4
3029.IX Item "-Wformat-security"
3030If \fB\-Wformat\fR is specified, also warn about uses of format
3031functions that represent possible security problems. At present, this
3032warns about calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR functions where the
3033format string is not a string literal and there are no format arguments,
3034as in \f(CW\*(C`printf (foo);\*(C'\fR. This may be a security hole if the format
3035string came from untrusted input and contains \fB\f(CB%n\fB\fR. (This is
3036currently a subset of what \fB\-Wformat\-nonliteral\fR warns about, but
3037in future warnings may be added to \fB\-Wformat\-security\fR that are not
3038included in \fB\-Wformat\-nonliteral\fR.)
3039.IP "\fB\-Wformat=2\fR" 4
3040.IX Item "-Wformat=2"
3041Enable \fB\-Wformat\fR plus format checks not included in
3042\&\fB\-Wformat\fR. Currently equivalent to \fB\-Wformat
3043\&\-Wformat\-nonliteral \-Wformat\-security \-Wformat\-y2k\fR.
3044.IP "\fB\-Wnonnull\fR" 4
3045.IX Item "-Wnonnull"
3046Warn about passing a null pointer for arguments marked as
3047requiring a non-null value by the \f(CW\*(C`nonnull\*(C'\fR function attribute.
3049\&\fB\-Wnonnull\fR is included in \fB\-Wall\fR and \fB\-Wformat\fR. It
3050can be disabled with the \fB\-Wno\-nonnull\fR option.
3051.IP "\fB\-Winit\-self\fR (C, \*(C+, Objective-C and Objective\-\*(C+ only)" 4
3052.IX Item "-Winit-self (C, , Objective-C and Objective- only)"
3053Warn about uninitialized variables that are initialized with themselves.
3054Note this option can only be used with the \fB\-Wuninitialized\fR option.
3056For example, \s-1GCC\s0 will warn about \f(CW\*(C`i\*(C'\fR being uninitialized in the
3057following snippet only when \fB\-Winit\-self\fR has been specified:
3059.Vb 5
3060\& int f()
3061\& {
3062\& int i = i;
3063\& return i;
3064\& }
3066.IP "\fB\-Wimplicit\-int\fR (C and Objective-C only)" 4
3067.IX Item "-Wimplicit-int (C and Objective-C only)"
3068Warn when a declaration does not specify a type.
3069This warning is enabled by \fB\-Wall\fR.
3070.IP "\fB\-Wimplicit\-function\-declaration\fR (C and Objective-C only)" 4
3071.IX Item "-Wimplicit-function-declaration (C and Objective-C only)"
3072Give a warning whenever a function is used before being declared. In
3073C99 mode (\fB\-std=c99\fR or \fB\-std=gnu99\fR), this warning is
3074enabled by default and it is made into an error by
3075\&\fB\-pedantic\-errors\fR. This warning is also enabled by
3077.IP "\fB\-Wimplicit\fR (C and Objective-C only)" 4
3078.IX Item "-Wimplicit (C and Objective-C only)"
3079Same as \fB\-Wimplicit\-int\fR and \fB\-Wimplicit\-function\-declaration\fR.
3080This warning is enabled by \fB\-Wall\fR.
3081.IP "\fB\-Wignored\-qualifiers\fR (C and \*(C+ only)" 4
3082.IX Item "-Wignored-qualifiers (C and only)"
3083Warn if the return type of a function has a type qualifier
3084such as \f(CW\*(C`const\*(C'\fR. For \s-1ISO\s0 C such a type qualifier has no effect,
3085since the value returned by a function is not an lvalue.
3086For \*(C+, the warning is only emitted for scalar types or \f(CW\*(C`void\*(C'\fR.
3087\&\s-1ISO\s0 C prohibits qualified \f(CW\*(C`void\*(C'\fR return types on function
3088definitions, so such return types always receive a warning
3089even without this option.
3091This warning is also enabled by \fB\-Wextra\fR.
3092.IP "\fB\-Wmain\fR" 4
3093.IX Item "-Wmain"
3094Warn if the type of \fBmain\fR is suspicious. \fBmain\fR should be
3095a function with external linkage, returning int, taking either zero
3096arguments, two, or three arguments of appropriate types. This warning
3097is enabled by default in \*(C+ and is enabled by either \fB\-Wall\fR
3098or \fB\-pedantic\fR.
3099.IP "\fB\-Wmissing\-braces\fR" 4
3100.IX Item "-Wmissing-braces"
3101Warn if an aggregate or union initializer is not fully bracketed. In
3102the following example, the initializer for \fBa\fR is not fully
3103bracketed, but that for \fBb\fR is fully bracketed.
3105.Vb 2
3106\& int a[2][2] = { 0, 1, 2, 3 };
3107\& int b[2][2] = { { 0, 1 }, { 2, 3 } };
3110This warning is enabled by \fB\-Wall\fR.
3111.IP "\fB\-Wmissing\-include\-dirs\fR (C, \*(C+, Objective-C and Objective\-\*(C+ only)" 4
3112.IX Item "-Wmissing-include-dirs (C, , Objective-C and Objective- only)"
3113Warn if a user-supplied include directory does not exist.
3114.IP "\fB\-Wparentheses\fR" 4
3115.IX Item "-Wparentheses"
3116Warn if parentheses are omitted in certain contexts, such
3117as when there is an assignment in a context where a truth value
3118is expected, or when operators are nested whose precedence people
3119often get confused about.
3121Also warn if a comparison like \fBx<=y<=z\fR appears; this is
3122equivalent to \fB(x<=y ? 1 : 0) <= z\fR, which is a different
3123interpretation from that of ordinary mathematical notation.
3125Also warn about constructions where there may be confusion to which
3126\&\f(CW\*(C`if\*(C'\fR statement an \f(CW\*(C`else\*(C'\fR branch belongs. Here is an example of
3127such a case:
3129.Vb 7
3130\& {
3131\& if (a)
3132\& if (b)
3133\& foo ();
3134\& else
3135\& bar ();
3136\& }
3139In C/\*(C+, every \f(CW\*(C`else\*(C'\fR branch belongs to the innermost possible
3140\&\f(CW\*(C`if\*(C'\fR statement, which in this example is \f(CW\*(C`if (b)\*(C'\fR. This is
3141often not what the programmer expected, as illustrated in the above
3142example by indentation the programmer chose. When there is the
3143potential for this confusion, \s-1GCC\s0 will issue a warning when this flag
3144is specified. To eliminate the warning, add explicit braces around
3145the innermost \f(CW\*(C`if\*(C'\fR statement so there is no way the \f(CW\*(C`else\*(C'\fR
3146could belong to the enclosing \f(CW\*(C`if\*(C'\fR. The resulting code would
3147look like this:
3149.Vb 9
3150\& {
3151\& if (a)
3152\& {
3153\& if (b)
3154\& foo ();
3155\& else
3156\& bar ();
3157\& }
3158\& }
3161Also warn for dangerous uses of the
3162?: with omitted middle operand \s-1GNU\s0 extension. When the condition
3163in the ?: operator is a boolean expression the omitted value will
3164be always 1. Often the user expects it to be a value computed
3165inside the conditional expression instead.
3167This warning is enabled by \fB\-Wall\fR.
3168.IP "\fB\-Wsequence\-point\fR" 4
3169.IX Item "-Wsequence-point"
3170Warn about code that may have undefined semantics because of violations
3171of sequence point rules in the C and \*(C+ standards.
3173The C and \*(C+ standards defines the order in which expressions in a C/\*(C+
3174program are evaluated in terms of \fIsequence points\fR, which represent
3175a partial ordering between the execution of parts of the program: those
3176executed before the sequence point, and those executed after it. These
3177occur after the evaluation of a full expression (one which is not part
3178of a larger expression), after the evaluation of the first operand of a
3179\&\f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, \f(CW\*(C`? :\*(C'\fR or \f(CW\*(C`,\*(C'\fR (comma) operator, before a
3180function is called (but after the evaluation of its arguments and the
3181expression denoting the called function), and in certain other places.
3182Other than as expressed by the sequence point rules, the order of
3183evaluation of subexpressions of an expression is not specified. All
3184these rules describe only a partial order rather than a total order,
3185since, for example, if two functions are called within one expression
3186with no sequence point between them, the order in which the functions
3187are called is not specified. However, the standards committee have
3188ruled that function calls do not overlap.
3190It is not specified when between sequence points modifications to the
3191values of objects take effect. Programs whose behavior depends on this
3192have undefined behavior; the C and \*(C+ standards specify that \*(L"Between
3193the previous and next sequence point an object shall have its stored
3194value modified at most once by the evaluation of an expression.
3195Furthermore, the prior value shall be read only to determine the value
3196to be stored.\*(R". If a program breaks these rules, the results on any
3197particular implementation are entirely unpredictable.
3199Examples of code with undefined behavior are \f(CW\*(C`a = a++;\*(C'\fR, \f(CW\*(C`a[n]
3200= b[n++]\*(C'\fR and \f(CW\*(C`a[i++] = i;\*(C'\fR. Some more complicated cases are not
3201diagnosed by this option, and it may give an occasional false positive
3202result, but in general it has been found fairly effective at detecting
3203this sort of problem in programs.
3205The standard is worded confusingly, therefore there is some debate
3206over the precise meaning of the sequence point rules in subtle cases.
3207Links to discussions of the problem, including proposed formal
3208definitions, may be found on the \s-1GCC\s0 readings page, at
3211This warning is enabled by \fB\-Wall\fR for C and \*(C+.
3212.IP "\fB\-Wreturn\-type\fR" 4
3213.IX Item "-Wreturn-type"
3214Warn whenever a function is defined with a return-type that defaults
3215to \f(CW\*(C`int\*(C'\fR. Also warn about any \f(CW\*(C`return\*(C'\fR statement with no
3216return-value in a function whose return-type is not \f(CW\*(C`void\*(C'\fR
3217(falling off the end of the function body is considered returning
3218without a value), and about a \f(CW\*(C`return\*(C'\fR statement with an
3219expression in a function whose return-type is \f(CW\*(C`void\*(C'\fR.
3221For \*(C+, a function without return type always produces a diagnostic
3222message, even when \fB\-Wno\-return\-type\fR is specified. The only
3223exceptions are \fBmain\fR and functions defined in system headers.
3225This warning is enabled by \fB\-Wall\fR.
3226.IP "\fB\-Wswitch\fR" 4
3227.IX Item "-Wswitch"
3228Warn whenever a \f(CW\*(C`switch\*(C'\fR statement has an index of enumerated type
3229and lacks a \f(CW\*(C`case\*(C'\fR for one or more of the named codes of that
3230enumeration. (The presence of a \f(CW\*(C`default\*(C'\fR label prevents this
3231warning.) \f(CW\*(C`case\*(C'\fR labels outside the enumeration range also
3232provoke warnings when this option is used (even if there is a
3233\&\f(CW\*(C`default\*(C'\fR label).
3234This warning is enabled by \fB\-Wall\fR.
3235.IP "\fB\-Wswitch\-default\fR" 4
3236.IX Item "-Wswitch-default"
3237Warn whenever a \f(CW\*(C`switch\*(C'\fR statement does not have a \f(CW\*(C`default\*(C'\fR
3239.IP "\fB\-Wswitch\-enum\fR" 4
3240.IX Item "-Wswitch-enum"
3241Warn whenever a \f(CW\*(C`switch\*(C'\fR statement has an index of enumerated type
3242and lacks a \f(CW\*(C`case\*(C'\fR for one or more of the named codes of that
3243enumeration. \f(CW\*(C`case\*(C'\fR labels outside the enumeration range also
3244provoke warnings when this option is used. The only difference
3245between \fB\-Wswitch\fR and this option is that this option gives a
3246warning about an omitted enumeration code even if there is a
3247\&\f(CW\*(C`default\*(C'\fR label.
3248.IP "\fB\-Wsync\-nand\fR (C and \*(C+ only)" 4
3249.IX Item "-Wsync-nand (C and only)"
3250Warn when \f(CW\*(C`_\|_sync_fetch_and_nand\*(C'\fR and \f(CW\*(C`_\|_sync_nand_and_fetch\*(C'\fR
3251built-in functions are used. These functions changed semantics in \s-1GCC\s0 4.4.
3252.IP "\fB\-Wtrigraphs\fR" 4
3253.IX Item "-Wtrigraphs"
3254Warn if any trigraphs are encountered that might change the meaning of
3255the program (trigraphs within comments are not warned about).
3256This warning is enabled by \fB\-Wall\fR.
3257.IP "\fB\-Wunused\-but\-set\-parameter\fR" 4
3258.IX Item "-Wunused-but-set-parameter"
3259Warn whenever a function parameter is assigned to, but otherwise unused
3260(aside from its declaration).
3262To suppress this warning use the \fBunused\fR attribute.
3264This warning is also enabled by \fB\-Wunused\fR together with
3266.IP "\fB\-Wunused\-but\-set\-variable\fR" 4
3267.IX Item "-Wunused-but-set-variable"
3268Warn whenever a local variable is assigned to, but otherwise unused
3269(aside from its declaration).
3270This warning is enabled by \fB\-Wall\fR.
3272To suppress this warning use the \fBunused\fR attribute.
3274This warning is also enabled by \fB\-Wunused\fR, which is enabled
3275by \fB\-Wall\fR.
3276.IP "\fB\-Wunused\-function\fR" 4
3277.IX Item "-Wunused-function"
3278Warn whenever a static function is declared but not defined or a
3279non-inline static function is unused.
3280This warning is enabled by \fB\-Wall\fR.
3281.IP "\fB\-Wunused\-label\fR" 4
3282.IX Item "-Wunused-label"
3283Warn whenever a label is declared but not used.
3284This warning is enabled by \fB\-Wall\fR.
3286To suppress this warning use the \fBunused\fR attribute.
3287.IP "\fB\-Wunused\-local\-typedefs\fR (C, Objective-C, \*(C+ and Objective\-\*(C+ only)" 4
3288.IX Item "-Wunused-local-typedefs (C, Objective-C, and Objective- only)"
3289Warn when a typedef locally defined in a function is not used.
3290.IP "\fB\-Wunused\-parameter\fR" 4
3291.IX Item "-Wunused-parameter"
3292Warn whenever a function parameter is unused aside from its declaration.
3294To suppress this warning use the \fBunused\fR attribute.
3295.IP "\fB\-Wno\-unused\-result\fR" 4
3296.IX Item "-Wno-unused-result"
3297Do not warn if a caller of a function marked with attribute
3298\&\f(CW\*(C`warn_unused_result\*(C'\fR does not use
3299its return value. The default is \fB\-Wunused\-result\fR.
3300.IP "\fB\-Wunused\-variable\fR" 4
3301.IX Item "-Wunused-variable"
3302Warn whenever a local variable or non-constant static variable is unused
3303aside from its declaration.
3304This warning is enabled by \fB\-Wall\fR.
3306To suppress this warning use the \fBunused\fR attribute.
3307.IP "\fB\-Wunused\-value\fR" 4
3308.IX Item "-Wunused-value"
3309Warn whenever a statement computes a result that is explicitly not
3310used. To suppress this warning cast the unused expression to
3311\&\fBvoid\fR. This includes an expression-statement or the left-hand
3312side of a comma expression that contains no side effects. For example,
3313an expression such as \fBx[i,j]\fR will cause a warning, while
3314\&\fBx[(void)i,j]\fR will not.
3316This warning is enabled by \fB\-Wall\fR.
3317.IP "\fB\-Wunused\fR" 4
3318.IX Item "-Wunused"
3319All the above \fB\-Wunused\fR options combined.
3321In order to get a warning about an unused function parameter, you must
3322either specify \fB\-Wextra \-Wunused\fR (note that \fB\-Wall\fR implies
3323\&\fB\-Wunused\fR), or separately specify \fB\-Wunused\-parameter\fR.
3324.IP "\fB\-Wuninitialized\fR" 4
3325.IX Item "-Wuninitialized"
3326Warn if an automatic variable is used without first being initialized
3327or if a variable may be clobbered by a \f(CW\*(C`setjmp\*(C'\fR call. In \*(C+,
3328warn if a non-static reference or non-static \fBconst\fR member
3329appears in a class without constructors.
3331If you want to warn about code that uses the uninitialized value of the
3332variable in its own initializer, use the \fB\-Winit\-self\fR option.
3334These warnings occur for individual uninitialized or clobbered
3335elements of structure, union or array variables as well as for
3336variables that are uninitialized or clobbered as a whole. They do
3337not occur for variables or elements declared \f(CW\*(C`volatile\*(C'\fR. Because
3338these warnings depend on optimization, the exact variables or elements
3339for which there are warnings will depend on the precise optimization
3340options and version of \s-1GCC\s0 used.
3342Note that there may be no warning about a variable that is used only
3343to compute a value that itself is never used, because such
3344computations may be deleted by data flow analysis before the warnings
3345are printed.
3346.IP "\fB\-Wmaybe\-uninitialized\fR" 4
3347.IX Item "-Wmaybe-uninitialized"
3348For an automatic variable, if there exists a path from the function
3349entry to a use of the variable that is initialized, but there exist
3350some other paths the variable is not initialized, the compiler will
3351emit a warning if it can not prove the uninitialized paths do not
3352happen at run time. These warnings are made optional because \s-1GCC\s0 is
3353not smart enough to see all the reasons why the code might be correct
3354despite appearing to have an error. Here is one example of how
3355this can happen:
3357.Vb 12
3358\& {
3359\& int x;
3360\& switch (y)
3361\& {
3362\& case 1: x = 1;
3363\& break;
3364\& case 2: x = 4;
3365\& break;
3366\& case 3: x = 5;
3367\& }
3368\& foo (x);
3369\& }
3372If the value of \f(CW\*(C`y\*(C'\fR is always 1, 2 or 3, then \f(CW\*(C`x\*(C'\fR is
3373always initialized, but \s-1GCC\s0 doesn't know this. To suppress the
3374warning, the user needs to provide a default case with \fIassert\fR\|(0) or
3375similar code.
3377This option also warns when a non-volatile automatic variable might be
3378changed by a call to \f(CW\*(C`longjmp\*(C'\fR. These warnings as well are possible
3379only in optimizing compilation.
3381The compiler sees only the calls to \f(CW\*(C`setjmp\*(C'\fR. It cannot know
3382where \f(CW\*(C`longjmp\*(C'\fR will be called; in fact, a signal handler could
3383call it at any point in the code. As a result, you may get a warning
3384even when there is in fact no problem because \f(CW\*(C`longjmp\*(C'\fR cannot
3385in fact be called at the place that would cause a problem.
3387Some spurious warnings can be avoided if you declare all the functions
3388you use that never return as \f(CW\*(C`noreturn\*(C'\fR.
3390This warning is enabled by \fB\-Wall\fR or \fB\-Wextra\fR.
3391.IP "\fB\-Wunknown\-pragmas\fR" 4
3392.IX Item "-Wunknown-pragmas"
3393Warn when a \f(CW\*(C`#pragma\*(C'\fR directive is encountered that is not understood by
3394\&\s-1GCC\s0. If this command-line option is used, warnings will even be issued
3395for unknown pragmas in system header files. This is not the case if
3396the warnings were only enabled by the \fB\-Wall\fR command-line option.
3397.IP "\fB\-Wno\-pragmas\fR" 4
3398.IX Item "-Wno-pragmas"
3399Do not warn about misuses of pragmas, such as incorrect parameters,
3400invalid syntax, or conflicts between pragmas. See also
3402.IP "\fB\-Wstrict\-aliasing\fR" 4
3403.IX Item "-Wstrict-aliasing"
3404This option is only active when \fB\-fstrict\-aliasing\fR is active.
3405It warns about code that might break the strict aliasing rules that the
3406compiler is using for optimization. The warning does not catch all
3407cases, but does attempt to catch the more common pitfalls. It is
3408included in \fB\-Wall\fR.
3409It is equivalent to \fB\-Wstrict\-aliasing=3\fR
3410.IP "\fB\-Wstrict\-aliasing=n\fR" 4
3411.IX Item "-Wstrict-aliasing=n"
3412This option is only active when \fB\-fstrict\-aliasing\fR is active.
3413It warns about code that might break the strict aliasing rules that the
3414compiler is using for optimization.
3415Higher levels correspond to higher accuracy (fewer false positives).
3416Higher levels also correspond to more effort, similar to the way \-O works.
3417\&\fB\-Wstrict\-aliasing\fR is equivalent to \fB\-Wstrict\-aliasing=n\fR,
3418with n=3.
3420Level 1: Most aggressive, quick, least accurate.
3421Possibly useful when higher levels
3422do not warn but \-fstrict\-aliasing still breaks the code, as it has very few
3423false negatives. However, it has many false positives.
3424Warns for all pointer conversions between possibly incompatible types,
3425even if never dereferenced. Runs in the front end only.
3427Level 2: Aggressive, quick, not too precise.
3428May still have many false positives (not as many as level 1 though),
3429and few false negatives (but possibly more than level 1).
3430Unlike level 1, it only warns when an address is taken. Warns about
3431incomplete types. Runs in the front end only.
3433Level 3 (default for \fB\-Wstrict\-aliasing\fR):
3434Should have very few false positives and few false
3435negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3436Takes care of the common pun+dereference pattern in the front end:
3438If optimization is enabled, it also runs in the back end, where it deals
3439with multiple statement cases using flow-sensitive points-to information.
3440Only warns when the converted pointer is dereferenced.
3441Does not warn about incomplete types.
3442.IP "\fB\-Wstrict\-overflow\fR" 4
3443.IX Item "-Wstrict-overflow"
3444.PD 0
3445.IP "\fB\-Wstrict\-overflow=\fR\fIn\fR" 4
3446.IX Item "-Wstrict-overflow=n"
3448This option is only active when \fB\-fstrict\-overflow\fR is active.
3449It warns about cases where the compiler optimizes based on the
3450assumption that signed overflow does not occur. Note that it does not
3451warn about all cases where the code might overflow: it only warns
3452about cases where the compiler implements some optimization. Thus
3453this warning depends on the optimization level.
3455An optimization that assumes that signed overflow does not occur is
3456perfectly safe if the values of the variables involved are such that
3457overflow never does, in fact, occur. Therefore this warning can
3458easily give a false positive: a warning about code that is not
3459actually a problem. To help focus on important issues, several
3460warning levels are defined. No warnings are issued for the use of
3461undefined signed overflow when estimating how many iterations a loop
3462will require, in particular when determining whether a loop will be
3463executed at all.
3464.RS 4
3465.IP "\fB\-Wstrict\-overflow=1\fR" 4
3466.IX Item "-Wstrict-overflow=1"
3467Warn about cases that are both questionable and easy to avoid. For
3468example: \f(CW\*(C`x + 1 > x\*(C'\fR; with \fB\-fstrict\-overflow\fR, the
3469compiler will simplify this to \f(CW1\fR. This level of
3470\&\fB\-Wstrict\-overflow\fR is enabled by \fB\-Wall\fR; higher levels
3471are not, and must be explicitly requested.
3472.IP "\fB\-Wstrict\-overflow=2\fR" 4
3473.IX Item "-Wstrict-overflow=2"
3474Also warn about other cases where a comparison is simplified to a
3475constant. For example: \f(CW\*(C`abs (x) >= 0\*(C'\fR. This can only be
3476simplified when \fB\-fstrict\-overflow\fR is in effect, because
3477\&\f(CW\*(C`abs (INT_MIN)\*(C'\fR overflows to \f(CW\*(C`INT_MIN\*(C'\fR, which is less than
3478zero. \fB\-Wstrict\-overflow\fR (with no level) is the same as
3480.IP "\fB\-Wstrict\-overflow=3\fR" 4
3481.IX Item "-Wstrict-overflow=3"
3482Also warn about other cases where a comparison is simplified. For
3483example: \f(CW\*(C`x + 1 > 1\*(C'\fR will be simplified to \f(CW\*(C`x > 0\*(C'\fR.
3484.IP "\fB\-Wstrict\-overflow=4\fR" 4
3485.IX Item "-Wstrict-overflow=4"
3486Also warn about other simplifications not covered by the above cases.
3487For example: \f(CW\*(C`(x * 10) / 5\*(C'\fR will be simplified to \f(CW\*(C`x * 2\*(C'\fR.
3488.IP "\fB\-Wstrict\-overflow=5\fR" 4
3489.IX Item "-Wstrict-overflow=5"
3490Also warn about cases where the compiler reduces the magnitude of a
3491constant involved in a comparison. For example: \f(CW\*(C`x + 2 > y\*(C'\fR will
3492be simplified to \f(CW\*(C`x + 1 >= y\*(C'\fR. This is reported only at the
3493highest warning level because this simplification applies to many
3494comparisons, so this warning level will give a very large number of
3495false positives.
3497.RS 4
3499.IP "\fB\-Wsuggest\-attribute=\fR[\fBpure\fR|\fBconst\fR|\fBnoreturn\fR]" 4
3500.IX Item "-Wsuggest-attribute=[pure|const|noreturn]"
3501Warn for cases where adding an attribute may be beneficial. The
3502attributes currently supported are listed below.
3503.RS 4
3504.IP "\fB\-Wsuggest\-attribute=pure\fR" 4
3505.IX Item "-Wsuggest-attribute=pure"
3506.PD 0
3507.IP "\fB\-Wsuggest\-attribute=const\fR" 4
3508.IX Item "-Wsuggest-attribute=const"
3509.IP "\fB\-Wsuggest\-attribute=noreturn\fR" 4
3510.IX Item "-Wsuggest-attribute=noreturn"
3512Warn about functions that might be candidates for attributes
3513\&\f(CW\*(C`pure\*(C'\fR, \f(CW\*(C`const\*(C'\fR or \f(CW\*(C`noreturn\*(C'\fR. The compiler only warns for
3514functions visible in other compilation units or (in the case of \f(CW\*(C`pure\*(C'\fR and
3515\&\f(CW\*(C`const\*(C'\fR) if it cannot prove that the function returns normally. A function
3516returns normally if it doesn't contain an infinite loop nor returns abnormally
3517by throwing, calling \f(CW\*(C`abort()\*(C'\fR or trapping. This analysis requires option
3518\&\fB\-fipa\-pure\-const\fR, which is enabled by default at \fB\-O\fR and
3519higher. Higher optimization levels improve the accuracy of the analysis.
3521.RS 4
3523.IP "\fB\-Warray\-bounds\fR" 4
3524.IX Item "-Warray-bounds"
3525This option is only active when \fB\-ftree\-vrp\fR is active
3526(default for \fB\-O2\fR and above). It warns about subscripts to arrays
3527that are always out of bounds. This warning is enabled by \fB\-Wall\fR.
3528.IP "\fB\-Wno\-div\-by\-zero\fR" 4
3529.IX Item "-Wno-div-by-zero"
3530Do not warn about compile-time integer division by zero. Floating-point
3531division by zero is not warned about, as it can be a legitimate way of
3532obtaining infinities and NaNs.
3533.IP "\fB\-Wsystem\-headers\fR" 4
3534.IX Item "-Wsystem-headers"
3535Print warning messages for constructs found in system header files.
3536Warnings from system headers are normally suppressed, on the assumption
3537that they usually do not indicate real problems and would only make the
3538compiler output harder to read. Using this command-line option tells
3539\&\s-1GCC\s0 to emit warnings from system headers as if they occurred in user
3540code. However, note that using \fB\-Wall\fR in conjunction with this
3541option will \fInot\fR warn about unknown pragmas in system
3542headers\-\-\-for that, \fB\-Wunknown\-pragmas\fR must also be used.
3543.IP "\fB\-Wtrampolines\fR" 4
3544.IX Item "-Wtrampolines"
3545.Vb 1
3546\& Warn about trampolines generated for pointers to nested functions.
3548\& A trampoline is a small piece of data or code that is created at run
3549\& time on the stack when the address of a nested function is taken, and
3550\& is used to call the nested function indirectly. For some targets, it
3551\& is made up of data only and thus requires no special treatment. But,
3552\& for most targets, it is made up of code and thus requires the stack
3553\& to be made executable in order for the program to work properly.
3555.IP "\fB\-Wfloat\-equal\fR" 4
3556.IX Item "-Wfloat-equal"
3557Warn if floating-point values are used in equality comparisons.
3559The idea behind this is that sometimes it is convenient (for the
3560programmer) to consider floating-point values as approximations to
3561infinitely precise real numbers. If you are doing this, then you need
3562to compute (by analyzing the code, or in some other way) the maximum or
3563likely maximum error that the computation introduces, and allow for it
3564when performing comparisons (and when producing output, but that's a
3565different problem). In particular, instead of testing for equality, you
3566would check to see whether the two values have ranges that overlap; and