Commit | Line | Data |
---|---|---|
1378ea41 SS |
1 | .\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14 |
2 | .\" | |
3 | .\" Standard preamble: | |
4 | .\" ======================================================================== | |
5 | .de Sh \" Subsection heading | |
6 | .br | |
7 | .if t .Sp | |
8 | .ne 5 | |
9 | .PP | |
10 | \fB\\$1\fR | |
11 | .PP | |
12 | .. | |
13 | .de Sp \" Vertical space (when we can't use .PP) | |
14 | .if t .sp .5v | |
15 | .if n .sp | |
16 | .. | |
17 | .de Vb \" Begin verbatim text | |
18 | .ft CW | |
19 | .nf | |
20 | .ne \\$1 | |
21 | .. | |
22 | .de Ve \" End verbatim text | |
23 | .ft R | |
24 | .fi | |
25 | .. | |
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. | will give a | |
29 | .\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to | |
30 | .\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C' | |
31 | .\" expand to `' in nroff, nothing in troff, for use with C<>. | |
32 | .tr \(*W-|\(bv\*(Tr | |
33 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' | |
34 | .ie 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' "" | |
43 | 'br\} | |
44 | .el\{\ | |
45 | . ds -- \|\(em\| | |
46 | . ds PI \(*p | |
47 | . ds L" `` | |
48 | . ds R" '' | |
49 | 'br\} | |
50 | .\" | |
51 | .\" If the F register is turned on, we'll generate index entries on stderr for | |
52 | .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index | |
53 | .\" entries marked with X<> in POD. Of course, you'll have to process the | |
54 | .\" output yourself in some meaningful fashion. | |
55 | .if \nF \{\ | |
56 | . de IX | |
57 | . tm Index:\\$1\t\\n%\t"\\$2" | |
58 | .. | |
59 | . nr % 0 | |
60 | . rr F | |
61 | .\} | |
62 | .\" | |
63 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes | |
64 | .\" way too many mistakes in technical documents. | |
65 | .hy 0 | |
66 | .if n .na | |
67 | .\" | |
68 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). | |
69 | .\" Fear. Run. Save yourself. No user-serviceable parts. | |
70 | . \" fudge factors for nroff and troff | |
71 | .if n \{\ | |
72 | . ds #H 0 | |
73 | . ds #V .8m | |
74 | . ds #F .3m | |
75 | . ds #[ \f1 | |
76 | . ds #] \fP | |
77 | .\} | |
78 | .if t \{\ | |
79 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) | |
80 | . ds #V .6m | |
81 | . ds #F 0 | |
82 | . ds #[ \& | |
83 | . ds #] \& | |
84 | .\} | |
85 | . \" simple accents for nroff and troff | |
86 | .if n \{\ | |
87 | . ds ' \& | |
88 | . ds ` \& | |
89 | . ds ^ \& | |
90 | . ds , \& | |
91 | . ds ~ ~ | |
92 | . ds / | |
93 | .\} | |
94 | .if t \{\ | |
95 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" | |
96 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' | |
97 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' | |
98 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' | |
99 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' | |
100 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' | |
101 | .\} | |
102 | . \" troff and (daisy-wheel) nroff accents | |
103 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' | |
104 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' | |
105 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] | |
106 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' | |
107 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' | |
108 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] | |
109 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] | |
110 | .ds ae a\h'-(\w'a'u*4/10)'e | |
111 | .ds Ae A\h'-(\w'A'u*4/10)'E | |
112 | . \" corrections for vroff | |
113 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' | |
114 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' | |
115 | . \" for low resolution devices (crt and lpr) | |
116 | .if \n(.H>23 .if \n(.V>19 \ | |
117 | \{\ | |
118 | . ds : e | |
119 | . ds 8 ss | |
120 | . ds o a | |
121 | . ds d- d\h'-1'\(ga | |
122 | . ds D- D\h'-1'\(hy | |
123 | . ds th \o'bp' | |
124 | . ds Th \o'LP' | |
125 | . ds ae ae | |
126 | . ds Ae AE | |
127 | .\} | |
128 | .rm #[ #] #H #V #F C | |
129 | .\" ======================================================================== | |
130 | .\" | |
131 | .IX Title "GCC 1" | |
132 | .TH GCC 1 "2006-03-06" "gcc-3.4.6" "GNU" | |
133 | .SH "NAME" | |
134 | gcc \- GNU project C and C++ compiler | |
135 | .SH "SYNOPSIS" | |
136 | .IX Header "SYNOPSIS" | |
137 | gcc [\fB\-c\fR|\fB\-S\fR|\fB\-E\fR] [\fB\-std=\fR\fIstandard\fR] | |
138 | [\fB\-g\fR] [\fB\-pg\fR] [\fB\-O\fR\fIlevel\fR] | |
139 | [\fB\-W\fR\fIwarn\fR...] [\fB\-pedantic\fR] | |
140 | [\fB\-I\fR\fIdir\fR...] [\fB\-L\fR\fIdir\fR...] | |
141 | [\fB\-D\fR\fImacro\fR[=\fIdefn\fR]...] [\fB\-U\fR\fImacro\fR] | |
142 | [\fB\-f\fR\fIoption\fR...] [\fB\-m\fR\fImachine-option\fR...] | |
143 | [\fB\-o\fR \fIoutfile\fR] \fIinfile\fR... | |
144 | .PP | |
145 | Only the most useful options are listed here; see below for the | |
146 | remainder. \fBg++\fR accepts mostly the same options as \fBgcc\fR. | |
147 | .SH "DESCRIPTION" | |
148 | .IX Header "DESCRIPTION" | |
149 | When you invoke \s-1GCC\s0, it normally does preprocessing, compilation, | |
150 | assembly and linking. The ``overall options'' allow you to stop this | |
151 | process at an intermediate stage. For example, the \fB\-c\fR option | |
152 | says not to run the linker. Then the output consists of object files | |
153 | output by the assembler. | |
154 | .PP | |
155 | Other options are passed on to one stage of processing. Some options | |
156 | control the preprocessor and others the compiler itself. Yet other | |
157 | options control the assembler and linker; most of these are not | |
158 | documented here, since you rarely need to use any of them. | |
159 | .PP | |
160 | Most of the command line options that you can use with \s-1GCC\s0 are useful | |
161 | for C programs; when an option is only useful with another language | |
162 | (usually \*(C+), the explanation says so explicitly. If the description | |
163 | for a particular option does not mention a source language, you can use | |
164 | that option with all supported languages. | |
165 | .PP | |
166 | The \fBgcc\fR program accepts options and file names as operands. Many | |
167 | options have multi-letter names; therefore multiple single-letter options | |
168 | may \fInot\fR be grouped: \fB\-dr\fR is very different from \fB\-d\ \-r\fR. | |
169 | .PP | |
170 | You can mix options and other arguments. For the most part, the order | |
171 | you use doesn't matter. Order does matter when you use several options | |
172 | of the same kind; for example, if you specify \fB\-L\fR more than once, | |
173 | the directories are searched in the order specified. | |
174 | .PP | |
175 | Many options have long names starting with \fB\-f\fR or with | |
176 | \&\fB\-W\fR\-\-\-for example, \fB\-fforce\-mem\fR, | |
177 | \&\fB\-fstrength\-reduce\fR, \fB\-Wformat\fR and so on. Most of | |
178 | these have both positive and negative forms; the negative form of | |
179 | \&\fB\-ffoo\fR would be \fB\-fno\-foo\fR. This manual documents | |
180 | only one of these two forms, whichever one is not the default. | |
181 | .SH "OPTIONS" | |
182 | .IX Header "OPTIONS" | |
183 | .Sh "Option Summary" | |
184 | .IX Subsection "Option Summary" | |
185 | Here is a summary of all the options, grouped by type. Explanations are | |
186 | in the following sections. | |
187 | .IP "\fIOverall Options\fR" 4 | |
188 | .IX Item "Overall Options" | |
189 | \&\fB\-c \-S \-E \-o\fR \fIfile\fR \fB\-pipe \-pass\-exit\-codes | |
190 | \&\-x\fR \fIlanguage\fR \fB\-v \-### \-\-help \-\-target\-help \-\-version\fR | |
191 | .IP "\fIC Language Options\fR" 4 | |
192 | .IX Item "C Language Options" | |
193 | \&\fB\-ansi \-std=\fR\fIstandard\fR \fB\-aux\-info\fR \fIfilename\fR | |
194 | \&\fB\-fno\-asm \-fno\-builtin \-fno\-builtin\-\fR\fIfunction\fR | |
195 | \&\fB\-fhosted \-ffreestanding \-fms\-extensions | |
196 | \&\-trigraphs \-no\-integrated\-cpp \-traditional \-traditional\-cpp | |
197 | \&\-fallow\-single\-precision \-fcond\-mismatch | |
198 | \&\-fsigned\-bitfields \-fsigned\-char | |
199 | \&\-funsigned\-bitfields \-funsigned\-char | |
200 | \&\-fwritable\-strings\fR | |
201 | .IP "\fI\*(C+ Language Options\fR" 4 | |
202 | .IX Item " Language Options" | |
203 | \&\fB\-fabi\-version=\fR\fIn\fR \fB\-fno\-access\-control \-fcheck\-new | |
204 | \&\-fconserve\-space \-fno\-const\-strings | |
205 | \&\-fno\-elide\-constructors | |
206 | \&\-fno\-enforce\-eh\-specs | |
207 | \&\-ffor\-scope \-fno\-for\-scope \-fno\-gnu\-keywords | |
208 | \&\-fno\-implicit\-templates | |
209 | \&\-fno\-implicit\-inline\-templates | |
210 | \&\-fno\-implement\-inlines \-fms\-extensions | |
211 | \&\-fno\-nonansi\-builtins \-fno\-operator\-names | |
212 | \&\-fno\-optional\-diags \-fpermissive | |
213 | \&\-frepo \-fno\-rtti \-fstats \-ftemplate\-depth\-\fR\fIn\fR | |
214 | \&\fB\-fuse\-cxa\-atexit \-fno\-weak \-nostdinc++ | |
215 | \&\-fno\-default\-inline \-Wabi \-Wctor\-dtor\-privacy | |
216 | \&\-Wnon\-virtual\-dtor \-Wreorder | |
217 | \&\-Weffc++ \-Wno\-deprecated | |
218 | \&\-Wno\-non\-template\-friend \-Wold\-style\-cast | |
219 | \&\-Woverloaded\-virtual \-Wno\-pmf\-conversions | |
220 | \&\-Wsign\-promo\fR | |
221 | .IP "\fIObjective-C Language Options\fR" 4 | |
222 | .IX Item "Objective-C Language Options" | |
223 | \&\fB\-fconstant\-string\-class=\fR\fIclass-name\fR | |
224 | \&\fB\-fgnu\-runtime \-fnext\-runtime | |
225 | \&\-fno\-nil\-receivers | |
226 | \&\-fobjc\-exceptions | |
227 | \&\-freplace\-objc\-classes | |
228 | \&\-fzero\-link | |
229 | \&\-gen\-decls | |
230 | \&\-Wno\-protocol \-Wselector \-Wundeclared\-selector\fR | |
231 | .IP "\fILanguage Independent Options\fR" 4 | |
232 | .IX Item "Language Independent Options" | |
233 | \&\fB\-fmessage\-length=\fR\fIn\fR | |
234 | \&\fB\-fdiagnostics\-show\-location=\fR[\fBonce\fR|\fBevery-line\fR] | |
235 | .IP "\fIWarning Options\fR" 4 | |
236 | .IX Item "Warning Options" | |
237 | \&\fB\-fsyntax\-only \-pedantic \-pedantic\-errors | |
238 | \&\-w \-Wextra \-Wall \-Waggregate\-return | |
239 | \&\-Wcast\-align \-Wcast\-qual \-Wchar\-subscripts \-Wcomment | |
240 | \&\-Wconversion \-Wno\-deprecated\-declarations | |
241 | \&\-Wdisabled\-optimization \-Wno\-div\-by\-zero \-Wendif\-labels | |
242 | \&\-Werror \-Werror\-implicit\-function\-declaration | |
243 | \&\-Wfloat\-equal \-Wformat \-Wformat=2 | |
244 | \&\-Wno\-format\-extra\-args \-Wformat\-nonliteral | |
245 | \&\-Wformat\-security \-Wformat\-y2k | |
246 | \&\-Wimplicit \-Wimplicit\-function\-declaration \-Wimplicit\-int | |
247 | \&\-Wimport \-Wno\-import \-Winit\-self \-Winline | |
248 | \&\-Wno\-invalid\-offsetof \-Winvalid\-pch | |
249 | \&\-Wlarger\-than\-\fR\fIlen\fR \fB\-Wlong\-long | |
250 | \&\-Wmain \-Wmissing\-braces | |
251 | \&\-Wmissing\-format\-attribute \-Wmissing\-noreturn | |
252 | \&\-Wno\-multichar \-Wnonnull \-Wpacked \-Wpadded | |
253 | \&\-Wparentheses \-Wpointer\-arith \-Wredundant\-decls | |
254 | \&\-Wreturn\-type \-Wsequence\-point \-Wshadow | |
255 | \&\-Wsign\-compare \-Wstrict\-aliasing | |
256 | \&\-Wswitch \-Wswitch\-default \-Wswitch\-enum | |
257 | \&\-Wsystem\-headers \-Wtrigraphs \-Wundef \-Wuninitialized | |
258 | \&\-Wunknown\-pragmas \-Wunreachable\-code | |
259 | \&\-Wunused \-Wunused\-function \-Wunused\-label \-Wunused\-parameter | |
260 | \&\-Wunused\-value \-Wunused\-variable \-Wwrite\-strings\fR | |
261 | .IP "\fIC\-only Warning Options\fR" 4 | |
262 | .IX Item "C-only Warning Options" | |
263 | \&\fB\-Wbad\-function\-cast \-Wmissing\-declarations | |
264 | \&\-Wmissing\-prototypes \-Wnested\-externs \-Wold\-style\-definition | |
265 | \&\-Wstrict\-prototypes \-Wtraditional | |
266 | \&\-Wdeclaration\-after\-statement\fR | |
267 | .IP "\fIDebugging Options\fR" 4 | |
268 | .IX Item "Debugging Options" | |
269 | \&\fB\-d\fR\fIletters\fR \fB\-dumpspecs \-dumpmachine \-dumpversion | |
270 | \&\-fdump\-unnumbered \-fdump\-translation\-unit\fR[\fB\-\fR\fIn\fR] | |
271 | \&\fB\-fdump\-class\-hierarchy\fR[\fB\-\fR\fIn\fR] | |
272 | \&\fB\-fdump\-tree\-original\fR[\fB\-\fR\fIn\fR] | |
273 | \&\fB\-fdump\-tree\-optimized\fR[\fB\-\fR\fIn\fR] | |
274 | \&\fB\-fdump\-tree\-inlined\fR[\fB\-\fR\fIn\fR] | |
275 | \&\fB\-feliminate\-dwarf2\-dups \-feliminate\-unused\-debug\-types | |
276 | \&\-feliminate\-unused\-debug\-symbols \-fmem\-report \-fprofile\-arcs | |
277 | \&\-frandom\-seed=\fR\fIstring\fR \fB\-fsched\-verbose=\fR\fIn\fR | |
278 | \&\fB\-ftest\-coverage \-ftime\-report | |
279 | \&\-g \-g\fR\fIlevel\fR \fB\-gcoff \-gdwarf\-2 | |
280 | \&\-ggdb \-gstabs \-gstabs+ \-gvms \-gxcoff \-gxcoff+ | |
281 | \&\-p \-pg \-print\-file\-name=\fR\fIlibrary\fR \fB\-print\-libgcc\-file\-name | |
282 | \&\-print\-multi\-directory \-print\-multi\-lib | |
283 | \&\-print\-prog\-name=\fR\fIprogram\fR \fB\-print\-search\-dirs \-Q | |
284 | \&\-save\-temps \-time\fR | |
285 | .IP "\fIOptimization Options\fR" 4 | |
286 | .IX Item "Optimization Options" | |
287 | \&\fB\-falign\-functions=\fR\fIn\fR \fB\-falign\-jumps=\fR\fIn\fR | |
288 | \&\fB\-falign\-labels=\fR\fIn\fR \fB\-falign\-loops=\fR\fIn\fR | |
289 | \&\fB\-fbranch\-probabilities \-fprofile\-values \-fvpt \-fbranch\-target\-load\-optimize | |
290 | \&\-fbranch\-target\-load\-optimize2 \-fcaller\-saves \-fcprop\-registers | |
291 | \&\-fcse\-follow\-jumps \-fcse\-skip\-blocks \-fdata\-sections | |
292 | \&\-fdelayed\-branch \-fdelete\-null\-pointer\-checks | |
293 | \&\-fexpensive\-optimizations \-ffast\-math \-ffloat\-store | |
294 | \&\-fforce\-addr \-fforce\-mem \-ffunction\-sections | |
295 | \&\-fgcse \-fgcse\-lm \-fgcse\-sm \-fgcse\-las \-floop\-optimize | |
296 | \&\-fcrossjumping \-fif\-conversion \-fif\-conversion2 | |
297 | \&\-finline\-functions \-finline\-limit=\fR\fIn\fR \fB\-fkeep\-inline\-functions | |
298 | \&\-fkeep\-static\-consts \-fmerge\-constants \-fmerge\-all\-constants | |
299 | \&\-fmove\-all\-movables \-fnew\-ra \-fno\-branch\-count\-reg | |
300 | \&\-fno\-default\-inline \-fno\-defer\-pop | |
301 | \&\-fno\-function\-cse \-fno\-guess\-branch\-probability | |
302 | \&\-fno\-inline \-fno\-math\-errno \-fno\-peephole \-fno\-peephole2 | |
303 | \&\-funsafe\-math\-optimizations \-ffinite\-math\-only | |
304 | \&\-fno\-trapping\-math \-fno\-zero\-initialized\-in\-bss | |
305 | \&\-fomit\-frame\-pointer \-foptimize\-register\-move | |
306 | \&\-foptimize\-sibling\-calls \-fprefetch\-loop\-arrays | |
307 | \&\-fprofile\-generate \-fprofile\-use | |
308 | \&\-freduce\-all\-givs \-fregmove \-frename\-registers | |
309 | \&\-freorder\-blocks \-freorder\-functions | |
310 | \&\-frerun\-cse\-after\-loop \-frerun\-loop\-opt | |
311 | \&\-frounding\-math \-fschedule\-insns \-fschedule\-insns2 | |
312 | \&\-fno\-sched\-interblock \-fno\-sched\-spec \-fsched\-spec\-load | |
313 | \&\-fsched\-spec\-load\-dangerous | |
314 | \&\-fsched\-stalled\-insns=\fR\fIn\fR \fB\-sched\-stalled\-insns\-dep=\fR\fIn\fR | |
315 | \&\fB\-fsched2\-use\-superblocks | |
316 | \&\-fsched2\-use\-traces \-fsignaling\-nans | |
317 | \&\-fsingle\-precision\-constant | |
318 | \&\-fstrength\-reduce \-fstrict\-aliasing \-ftracer \-fthread\-jumps | |
319 | \&\-funroll\-all\-loops \-funroll\-loops \-fpeel\-loops | |
320 | \&\-funswitch\-loops \-fold\-unroll\-loops \-fold\-unroll\-all\-loops | |
321 | \&\-\-param\fR \fIname\fR\fB=\fR\fIvalue\fR | |
322 | \&\fB\-O \-O0 \-O1 \-O2 \-O3 \-Os\fR | |
323 | .IP "\fIPreprocessor Options\fR" 4 | |
324 | .IX Item "Preprocessor Options" | |
325 | \&\fB\-A\fR\fIquestion\fR\fB=\fR\fIanswer\fR | |
326 | \&\fB\-A\-\fR\fIquestion\fR[\fB=\fR\fIanswer\fR] | |
327 | \&\fB\-C \-dD \-dI \-dM \-dN | |
328 | \&\-D\fR\fImacro\fR[\fB=\fR\fIdefn\fR] \fB\-E \-H | |
329 | \&\-idirafter\fR \fIdir\fR | |
330 | \&\fB\-include\fR \fIfile\fR \fB\-imacros\fR \fIfile\fR | |
331 | \&\fB\-iprefix\fR \fIfile\fR \fB\-iwithprefix\fR \fIdir\fR | |
332 | \&\fB\-iwithprefixbefore\fR \fIdir\fR \fB\-isystem\fR \fIdir\fR | |
333 | \&\fB\-M \-MM \-MF \-MG \-MP \-MQ \-MT \-nostdinc | |
334 | \&\-P \-fworking\-directory \-remap | |
335 | \&\-trigraphs \-undef \-U\fR\fImacro\fR \fB\-Wp,\fR\fIoption\fR | |
336 | \&\fB\-Xpreprocessor\fR \fIoption\fR | |
337 | .IP "\fIAssembler Option\fR" 4 | |
338 | .IX Item "Assembler Option" | |
339 | \&\fB\-Wa,\fR\fIoption\fR \fB\-Xassembler\fR \fIoption\fR | |
340 | .IP "\fILinker Options\fR" 4 | |
341 | .IX Item "Linker Options" | |
342 | \&\fIobject-file-name\fR \fB\-l\fR\fIlibrary\fR | |
343 | \&\fB\-nostartfiles \-nodefaultlibs \-nostdlib \-pie | |
344 | \&\-s \-static \-static\-libgcc \-shared \-shared\-libgcc \-symbolic | |
345 | \&\-Wl,\fR\fIoption\fR \fB\-Xlinker\fR \fIoption\fR | |
346 | \&\fB\-u\fR \fIsymbol\fR | |
347 | .IP "\fIDirectory Options\fR" 4 | |
348 | .IX Item "Directory Options" | |
349 | \&\fB\-B\fR\fIprefix\fR \fB\-I\fR\fIdir\fR \fB\-I\- \-L\fR\fIdir\fR \fB\-specs=\fR\fIfile\fR | |
350 | .IP "\fITarget Options\fR" 4 | |
351 | .IX Item "Target Options" | |
352 | \&\fB\-V\fR \fIversion\fR \fB\-b\fR \fImachine\fR | |
353 | .IP "\fIMachine Dependent Options\fR" 4 | |
354 | .IX Item "Machine Dependent Options" | |
355 | \&\fIM680x0 Options\fR | |
356 | \&\fB\-m68000 \-m68020 \-m68020\-40 \-m68020\-60 \-m68030 \-m68040 | |
357 | \&\-m68060 \-mcpu32 \-m5200 \-m68881 \-mbitfield \-mc68000 \-mc68020 | |
358 | \&\-mnobitfield \-mrtd \-mshort \-msoft\-float \-mpcrel | |
359 | \&\-malign\-int \-mstrict\-align \-msep\-data \-mno\-sep\-data | |
360 | \&\-mshared\-library\-id=n \-mid\-shared\-library \-mno\-id\-shared\-library\fR | |
361 | .Sp | |
362 | \&\fIM68hc1x Options\fR | |
363 | \&\fB\-m6811 \-m6812 \-m68hc11 \-m68hc12 \-m68hcs12 | |
364 | \&\-mauto\-incdec \-minmax \-mlong\-calls \-mshort | |
365 | \&\-msoft\-reg\-count=\fR\fIcount\fR | |
366 | .Sp | |
367 | \&\fI\s-1VAX\s0 Options\fR | |
368 | \&\fB\-mg \-mgnu \-munix\fR | |
369 | .Sp | |
370 | \&\fI\s-1SPARC\s0 Options\fR | |
371 | \&\fB\-mcpu=\fR\fIcpu-type\fR | |
372 | \&\fB\-mtune=\fR\fIcpu-type\fR | |
373 | \&\fB\-mcmodel=\fR\fIcode-model\fR | |
374 | \&\fB\-m32 \-m64 \-mapp\-regs \-mno\-app\-regs | |
375 | \&\-mfaster\-structs \-mno\-faster\-structs | |
376 | \&\-mflat \-mno\-flat \-mfpu \-mno\-fpu | |
377 | \&\-mhard\-float \-msoft\-float | |
378 | \&\-mhard\-quad\-float \-msoft\-quad\-float | |
379 | \&\-mimpure\-text \-mno\-impure\-text \-mlittle\-endian | |
380 | \&\-mstack\-bias \-mno\-stack\-bias | |
381 | \&\-munaligned\-doubles \-mno\-unaligned\-doubles | |
382 | \&\-mv8plus \-mno\-v8plus \-mvis \-mno\-vis | |
383 | \&\-mcypress \-mf930 \-mf934 | |
384 | \&\-msparclite \-msupersparc \-mv8 | |
385 | \&\-threads \-pthreads\fR | |
386 | .Sp | |
387 | \&\fI\s-1ARM\s0 Options\fR | |
388 | \&\fB\-mapcs\-frame \-mno\-apcs\-frame | |
389 | \&\-mapcs\-26 \-mapcs\-32 | |
390 | \&\-mapcs\-stack\-check \-mno\-apcs\-stack\-check | |
391 | \&\-mapcs\-float \-mno\-apcs\-float | |
392 | \&\-mapcs\-reentrant \-mno\-apcs\-reentrant | |
393 | \&\-msched\-prolog \-mno\-sched\-prolog | |
394 | \&\-mlittle\-endian \-mbig\-endian \-mwords\-little\-endian | |
395 | \&\-malignment\-traps \-mno\-alignment\-traps | |
396 | \&\-msoft\-float \-mhard\-float \-mfpe | |
397 | \&\-mthumb\-interwork \-mno\-thumb\-interwork | |
398 | \&\-mcpu=\fR\fIname\fR \fB\-march=\fR\fIname\fR \fB\-mfpe=\fR\fIname\fR | |
399 | \&\fB\-mstructure\-size\-boundary=\fR\fIn\fR | |
400 | \&\fB\-mabort\-on\-noreturn | |
401 | \&\-mlong\-calls \-mno\-long\-calls | |
402 | \&\-msingle\-pic\-base \-mno\-single\-pic\-base | |
403 | \&\-mpic\-register=\fR\fIreg\fR | |
404 | \&\fB\-mnop\-fun\-dllimport | |
405 | \&\-mcirrus\-fix\-invalid\-insns \-mno\-cirrus\-fix\-invalid\-insns | |
406 | \&\-mpoke\-function\-name | |
407 | \&\-mthumb \-marm | |
408 | \&\-mtpcs\-frame \-mtpcs\-leaf\-frame | |
409 | \&\-mcaller\-super\-interworking \-mcallee\-super\-interworking\fR | |
410 | .Sp | |
411 | \&\fI\s-1MN10300\s0 Options\fR | |
412 | \&\fB\-mmult\-bug \-mno\-mult\-bug | |
413 | \&\-mam33 \-mno\-am33 | |
414 | \&\-mam33\-2 \-mno\-am33\-2 | |
415 | \&\-mno\-crt0 \-mrelax\fR | |
416 | .Sp | |
417 | \&\fIM32R/D Options\fR | |
418 | \&\fB\-m32r2 \-m32rx \-m32r | |
419 | \&\-mdebug | |
420 | \&\-malign\-loops \-mno\-align\-loops | |
421 | \&\-missue\-rate=\fR\fInumber\fR | |
422 | \&\fB\-mbranch\-cost=\fR\fInumber\fR | |
423 | \&\fB\-mmodel=\fR\fIcode-size-model-type\fR | |
424 | \&\fB\-msdata=\fR\fIsdata-type\fR | |
425 | \&\fB\-mno\-flush\-func \-mflush\-func=\fR\fIname\fR | |
426 | \&\fB\-mno\-flush\-trap \-mflush\-trap=\fR\fInumber\fR | |
427 | \&\fB\-G\fR \fInum\fR | |
428 | .Sp | |
429 | \&\fI\s-1RS/6000\s0 and PowerPC Options\fR | |
430 | \&\fB\-mcpu=\fR\fIcpu-type\fR | |
431 | \&\fB\-mtune=\fR\fIcpu-type\fR | |
432 | \&\fB\-mpower \-mno\-power \-mpower2 \-mno\-power2 | |
433 | \&\-mpowerpc \-mpowerpc64 \-mno\-powerpc | |
434 | \&\-maltivec \-mno\-altivec | |
435 | \&\-mpowerpc\-gpopt \-mno\-powerpc\-gpopt | |
436 | \&\-mpowerpc\-gfxopt \-mno\-powerpc\-gfxopt | |
437 | \&\-mnew\-mnemonics \-mold\-mnemonics | |
438 | \&\-mfull\-toc \-mminimal\-toc \-mno\-fp\-in\-toc \-mno\-sum\-in\-toc | |
439 | \&\-m64 \-m32 \-mxl\-compat \-mno\-xl\-compat \-mpe | |
440 | \&\-malign\-power \-malign\-natural | |
441 | \&\-msoft\-float \-mhard\-float \-mmultiple \-mno\-multiple | |
442 | \&\-mstring \-mno\-string \-mupdate \-mno\-update | |
443 | \&\-mfused\-madd \-mno\-fused\-madd \-mbit\-align \-mno\-bit\-align | |
444 | \&\-mstrict\-align \-mno\-strict\-align \-mrelocatable | |
445 | \&\-mno\-relocatable \-mrelocatable\-lib \-mno\-relocatable\-lib | |
446 | \&\-mtoc \-mno\-toc \-mlittle \-mlittle\-endian \-mbig \-mbig\-endian | |
447 | \&\-mdynamic\-no\-pic | |
448 | \&\-mprioritize\-restricted\-insns=\fR\fIpriority\fR | |
449 | \&\fB\-msched\-costly\-dep=\fR\fIdependence_type\fR | |
450 | \&\fB\-minsert\-sched\-nops=\fR\fIscheme\fR | |
451 | \&\fB\-mcall\-sysv \-mcall\-netbsd | |
452 | \&\-maix\-struct\-return \-msvr4\-struct\-return | |
453 | \&\-mabi=altivec \-mabi=no\-altivec | |
454 | \&\-mabi=spe \-mabi=no\-spe | |
455 | \&\-misel=yes \-misel=no | |
456 | \&\-mspe=yes \-mspe=no | |
457 | \&\-mfloat\-gprs=yes \-mfloat\-gprs=no | |
458 | \&\-mprototype \-mno\-prototype | |
459 | \&\-msim \-mmvme \-mads \-myellowknife \-memb \-msdata | |
460 | \&\-msdata=\fR\fIopt\fR \fB\-mvxworks \-mwindiss \-G\fR \fInum\fR \fB\-pthread\fR | |
461 | .Sp | |
462 | \&\fIDarwin Options\fR | |
463 | \&\fB\-all_load \-allowable_client \-arch \-arch_errors_fatal | |
464 | \&\-arch_only \-bind_at_load \-bundle \-bundle_loader | |
465 | \&\-client_name \-compatibility_version \-current_version | |
466 | \&\-dependency\-file \-dylib_file \-dylinker_install_name | |
467 | \&\-dynamic \-dynamiclib \-exported_symbols_list | |
468 | \&\-filelist \-flat_namespace \-force_cpusubtype_ALL | |
469 | \&\-force_flat_namespace \-headerpad_max_install_names | |
470 | \&\-image_base \-init \-install_name \-keep_private_externs | |
471 | \&\-multi_module \-multiply_defined \-multiply_defined_unused | |
472 | \&\-noall_load \-nofixprebinding \-nomultidefs \-noprebind \-noseglinkedit | |
473 | \&\-pagezero_size \-prebind \-prebind_all_twolevel_modules | |
474 | \&\-private_bundle \-read_only_relocs \-sectalign | |
475 | \&\-sectobjectsymbols \-whyload \-seg1addr | |
476 | \&\-sectcreate \-sectobjectsymbols \-sectorder | |
477 | \&\-seg_addr_table \-seg_addr_table_filename \-seglinkedit | |
478 | \&\-segprot \-segs_read_only_addr \-segs_read_write_addr | |
479 | \&\-single_module \-static \-sub_library \-sub_umbrella | |
480 | \&\-twolevel_namespace \-umbrella \-undefined | |
481 | \&\-unexported_symbols_list \-weak_reference_mismatches | |
482 | \&\-whatsloaded\fR | |
483 | .Sp | |
484 | \&\fI\s-1MIPS\s0 Options\fR | |
485 | \&\fB\-EL \-EB \-march=\fR\fIarch\fR \fB\-mtune=\fR\fIarch\fR | |
486 | \&\fB\-mips1 \-mips2 \-mips3 \-mips4 \-mips32 \-mips32r2 \-mips64 | |
487 | \&\-mips16 \-mno\-mips16 \-mabi=\fR\fIabi\fR \fB\-mabicalls \-mno\-abicalls | |
488 | \&\-mxgot \-mno\-xgot \-membedded\-pic \-mno\-embedded\-pic | |
489 | \&\-mgp32 \-mgp64 \-mfp32 \-mfp64 \-mhard\-float \-msoft\-float | |
490 | \&\-msingle\-float \-mdouble\-float \-mint64 \-mlong64 \-mlong32 | |
491 | \&\-G\fR\fInum\fR \fB\-membedded\-data \-mno\-embedded\-data | |
492 | \&\-muninit\-const\-in\-rodata \-mno\-uninit\-const\-in\-rodata | |
493 | \&\-msplit\-addresses \-mno\-split\-addresses | |
494 | \&\-mexplicit\-relocs \-mno\-explicit\-relocs | |
495 | \&\-mrnames \-mno\-rnames | |
496 | \&\-mcheck\-zero\-division \-mno\-check\-zero\-division | |
497 | \&\-mmemcpy \-mno\-memcpy \-mlong\-calls \-mno\-long\-calls | |
498 | \&\-mmad \-mno\-mad \-mfused\-madd \-mno\-fused\-madd \-nocpp | |
499 | \&\-mfix\-sb1 \-mno\-fix\-sb1 \-mflush\-func=\fR\fIfunc\fR | |
500 | \&\fB\-mno\-flush\-func \-mbranch\-likely \-mno\-branch\-likely\fR | |
501 | .Sp | |
502 | \&\fIi386 and x86\-64 Options\fR | |
503 | \&\fB\-mtune=\fR\fIcpu-type\fR \fB\-march=\fR\fIcpu-type\fR | |
504 | \&\fB\-mfpmath=\fR\fIunit\fR | |
505 | \&\fB\-masm=\fR\fIdialect\fR \fB\-mno\-fancy\-math\-387 | |
506 | \&\-mno\-fp\-ret\-in\-387 \-msoft\-float \-msvr3\-shlib | |
507 | \&\-mno\-wide\-multiply \-mrtd \-malign\-double | |
508 | \&\-mpreferred\-stack\-boundary=\fR\fInum\fR | |
509 | \&\fB\-mmmx \-msse \-msse2 \-msse3 \-m3dnow | |
510 | \&\-mthreads \-mno\-align\-stringops \-minline\-all\-stringops | |
511 | \&\-mpush\-args \-maccumulate\-outgoing\-args \-m128bit\-long\-double | |
512 | \&\-m96bit\-long\-double \-mregparm=\fR\fInum\fR \fB\-momit\-leaf\-frame\-pointer | |
513 | \&\-mno\-red\-zone \-mno\-tls\-direct\-seg\-refs | |
514 | \&\-mcmodel=\fR\fIcode-model\fR | |
515 | \&\fB\-m32 \-m64\fR | |
516 | .Sp | |
517 | \&\fI\s-1HPPA\s0 Options\fR | |
518 | \&\fB\-march=\fR\fIarchitecture-type\fR | |
519 | \&\fB\-mbig\-switch \-mdisable\-fpregs \-mdisable\-indexing | |
520 | \&\-mfast\-indirect\-calls \-mgas \-mgnu\-ld \-mhp\-ld | |
521 | \&\-mjump\-in\-delay \-mlinker\-opt \-mlong\-calls | |
522 | \&\-mlong\-load\-store \-mno\-big\-switch \-mno\-disable\-fpregs | |
523 | \&\-mno\-disable\-indexing \-mno\-fast\-indirect\-calls \-mno\-gas | |
524 | \&\-mno\-jump\-in\-delay \-mno\-long\-load\-store | |
525 | \&\-mno\-portable\-runtime \-mno\-soft\-float | |
526 | \&\-mno\-space\-regs \-msoft\-float \-mpa\-risc\-1\-0 | |
527 | \&\-mpa\-risc\-1\-1 \-mpa\-risc\-2\-0 \-mportable\-runtime | |
528 | \&\-mschedule=\fR\fIcpu-type\fR \fB\-mspace\-regs \-msio \-mwsio | |
529 | \&\-nolibdld \-static \-threads\fR | |
530 | .Sp | |
531 | \&\fIIntel 960 Options\fR | |
532 | \&\fB\-m\fR\fIcpu-type\fR \fB\-masm\-compat \-mclean\-linkage | |
533 | \&\-mcode\-align \-mcomplex\-addr \-mleaf\-procedures | |
534 | \&\-mic\-compat \-mic2.0\-compat \-mic3.0\-compat | |
535 | \&\-mintel\-asm \-mno\-clean\-linkage \-mno\-code\-align | |
536 | \&\-mno\-complex\-addr \-mno\-leaf\-procedures | |
537 | \&\-mno\-old\-align \-mno\-strict\-align \-mno\-tail\-call | |
538 | \&\-mnumerics \-mold\-align \-msoft\-float \-mstrict\-align | |
539 | \&\-mtail\-call\fR | |
540 | .Sp | |
541 | \&\fI\s-1DEC\s0 Alpha Options\fR | |
542 | \&\fB\-mno\-fp\-regs \-msoft\-float \-malpha\-as \-mgas | |
543 | \&\-mieee \-mieee\-with\-inexact \-mieee\-conformant | |
544 | \&\-mfp\-trap\-mode=\fR\fImode\fR \fB\-mfp\-rounding\-mode=\fR\fImode\fR | |
545 | \&\fB\-mtrap\-precision=\fR\fImode\fR \fB\-mbuild\-constants | |
546 | \&\-mcpu=\fR\fIcpu-type\fR \fB\-mtune=\fR\fIcpu-type\fR | |
547 | \&\fB\-mbwx \-mmax \-mfix \-mcix | |
548 | \&\-mfloat\-vax \-mfloat\-ieee | |
549 | \&\-mexplicit\-relocs \-msmall\-data \-mlarge\-data | |
550 | \&\-msmall\-text \-mlarge\-text | |
551 | \&\-mmemory\-latency=\fR\fItime\fR | |
552 | .Sp | |
553 | \&\fI\s-1DEC\s0 Alpha/VMS Options\fR | |
554 | \&\fB\-mvms\-return\-codes\fR | |
555 | .Sp | |
556 | \&\fIH8/300 Options\fR | |
557 | \&\fB\-mrelax \-mh \-ms \-mn \-mint32 \-malign\-300\fR | |
558 | .Sp | |
559 | \&\fI\s-1SH\s0 Options\fR | |
560 | \&\fB\-m1 \-m2 \-m2e \-m3 \-m3e | |
561 | \&\-m4\-nofpu \-m4\-single\-only \-m4\-single \-m4 | |
562 | \&\-m5\-64media \-m5\-64media\-nofpu | |
563 | \&\-m5\-32media \-m5\-32media\-nofpu | |
564 | \&\-m5\-compact \-m5\-compact\-nofpu | |
565 | \&\-mb \-ml \-mdalign \-mrelax | |
566 | \&\-mbigtable \-mfmovd \-mhitachi \-mnomacsave | |
567 | \&\-mieee \-misize \-mpadstruct \-mspace | |
568 | \&\-mprefergot \-musermode\fR | |
569 | .Sp | |
570 | \&\fISystem V Options\fR | |
571 | \&\fB\-Qy \-Qn \-YP,\fR\fIpaths\fR \fB\-Ym,\fR\fIdir\fR | |
572 | .Sp | |
573 | \&\fI\s-1ARC\s0 Options\fR | |
574 | \&\fB\-EB \-EL | |
575 | \&\-mmangle\-cpu \-mcpu=\fR\fIcpu\fR \fB\-mtext=\fR\fItext-section\fR | |
576 | \&\fB\-mdata=\fR\fIdata-section\fR \fB\-mrodata=\fR\fIreadonly-data-section\fR | |
577 | .Sp | |
578 | \&\fITMS320C3x/C4x Options\fR | |
579 | \&\fB\-mcpu=\fR\fIcpu\fR \fB\-mbig \-msmall \-mregparm \-mmemparm | |
580 | \&\-mfast\-fix \-mmpyi \-mbk \-mti \-mdp\-isr\-reload | |
581 | \&\-mrpts=\fR\fIcount\fR \fB\-mrptb \-mdb \-mloop\-unsigned | |
582 | \&\-mparallel\-insns \-mparallel\-mpy \-mpreserve\-float\fR | |
583 | .Sp | |
584 | \&\fIV850 Options\fR | |
585 | \&\fB\-mlong\-calls \-mno\-long\-calls \-mep \-mno\-ep | |
586 | \&\-mprolog\-function \-mno\-prolog\-function \-mspace | |
587 | \&\-mtda=\fR\fIn\fR \fB\-msda=\fR\fIn\fR \fB\-mzda=\fR\fIn\fR | |
588 | \&\fB\-mapp\-regs \-mno\-app\-regs | |
589 | \&\-mdisable\-callt \-mno\-disable\-callt | |
590 | \&\-mv850e1 | |
591 | \&\-mv850e | |
592 | \&\-mv850 \-mbig\-switch\fR | |
593 | .Sp | |
594 | \&\fI\s-1NS32K\s0 Options\fR | |
595 | \&\fB\-m32032 \-m32332 \-m32532 \-m32081 \-m32381 | |
596 | \&\-mmult\-add \-mnomult\-add \-msoft\-float \-mrtd \-mnortd | |
597 | \&\-mregparam \-mnoregparam \-msb \-mnosb | |
598 | \&\-mbitfield \-mnobitfield \-mhimem \-mnohimem\fR | |
599 | .Sp | |
600 | \&\fI\s-1AVR\s0 Options\fR | |
601 | \&\fB\-mmcu=\fR\fImcu\fR \fB\-msize \-minit\-stack=\fR\fIn\fR \fB\-mno\-interrupts | |
602 | \&\-mcall\-prologues \-mno\-tablejump \-mtiny\-stack\fR | |
603 | .Sp | |
604 | \&\fIMCore Options\fR | |
605 | \&\fB\-mhardlit \-mno\-hardlit \-mdiv \-mno\-div \-mrelax\-immediates | |
606 | \&\-mno\-relax\-immediates \-mwide\-bitfields \-mno\-wide\-bitfields | |
607 | \&\-m4byte\-functions \-mno\-4byte\-functions \-mcallgraph\-data | |
608 | \&\-mno\-callgraph\-data \-mslow\-bytes \-mno\-slow\-bytes \-mno\-lsim | |
609 | \&\-mlittle\-endian \-mbig\-endian \-m210 \-m340 \-mstack\-increment\fR | |
610 | .Sp | |
611 | \&\fI\s-1MMIX\s0 Options\fR | |
612 | \&\fB\-mlibfuncs \-mno\-libfuncs \-mepsilon \-mno\-epsilon \-mabi=gnu | |
613 | \&\-mabi=mmixware \-mzero\-extend \-mknuthdiv \-mtoplevel\-symbols | |
614 | \&\-melf \-mbranch\-predict \-mno\-branch\-predict \-mbase\-addresses | |
615 | \&\-mno\-base\-addresses \-msingle\-exit \-mno\-single\-exit\fR | |
616 | .Sp | |
617 | \&\fI\s-1IA\-64\s0 Options\fR | |
618 | \&\fB\-mbig\-endian \-mlittle\-endian \-mgnu\-as \-mgnu\-ld \-mno\-pic | |
619 | \&\-mvolatile\-asm\-stop \-mb\-step \-mregister\-names \-mno\-sdata | |
620 | \&\-mconstant\-gp \-mauto\-pic \-minline\-float\-divide\-min\-latency | |
621 | \&\-minline\-float\-divide\-max\-throughput | |
622 | \&\-minline\-int\-divide\-min\-latency | |
623 | \&\-minline\-int\-divide\-max\-throughput | |
624 | \&\-minline\-sqrt\-min\-latency \-minline\-sqrt\-max\-throughput | |
625 | \&\-mno\-dwarf2\-asm \-mearly\-stop\-bits | |
626 | \&\-mfixed\-range=\fR\fIregister-range\fR \fB\-mtls\-size=\fR\fItls-size\fR | |
627 | \&\fB\-mtune=\fR\fIcpu-type\fR \fB\-mt \-pthread \-milp32 \-mlp64\fR | |
628 | .Sp | |
629 | \&\fID30V Options\fR | |
630 | \&\fB\-mextmem \-mextmemory \-monchip \-mno\-asm\-optimize | |
631 | \&\-masm\-optimize \-mbranch\-cost=\fR\fIn\fR \fB\-mcond\-exec=\fR\fIn\fR | |
632 | .Sp | |
633 | \&\fIS/390 and zSeries Options\fR | |
634 | \&\fB\-mtune=\fR\fIcpu-type\fR \fB\-march=\fR\fIcpu-type\fR | |
635 | \&\fB\-mhard\-float \-msoft\-float \-mbackchain \-mno\-backchain | |
636 | \&\-msmall\-exec \-mno\-small\-exec \-mmvcle \-mno\-mvcle | |
637 | \&\-m64 \-m31 \-mdebug \-mno\-debug \-mesa \-mzarch \-mfused\-madd \-mno\-fused\-madd\fR | |
638 | .Sp | |
639 | \&\fI\s-1CRIS\s0 Options\fR | |
640 | \&\fB\-mcpu=\fR\fIcpu\fR \fB\-march=\fR\fIcpu\fR \fB\-mtune=\fR\fIcpu\fR | |
641 | \&\fB\-mmax\-stack\-frame=\fR\fIn\fR \fB\-melinux\-stacksize=\fR\fIn\fR | |
642 | \&\fB\-metrax4 \-metrax100 \-mpdebug \-mcc\-init \-mno\-side\-effects | |
643 | \&\-mstack\-align \-mdata\-align \-mconst\-align | |
644 | \&\-m32\-bit \-m16\-bit \-m8\-bit \-mno\-prologue\-epilogue \-mno\-gotplt | |
645 | \&\-melf \-maout \-melinux \-mlinux \-sim \-sim2 | |
646 | \&\-mmul\-bug\-workaround \-mno\-mul\-bug\-workaround\fR | |
647 | .Sp | |
648 | \&\fI\s-1PDP\-11\s0 Options\fR | |
649 | \&\fB\-mfpu \-msoft\-float \-mac0 \-mno\-ac0 \-m40 \-m45 \-m10 | |
650 | \&\-mbcopy \-mbcopy\-builtin \-mint32 \-mno\-int16 | |
651 | \&\-mint16 \-mno\-int32 \-mfloat32 \-mno\-float64 | |
652 | \&\-mfloat64 \-mno\-float32 \-mabshi \-mno\-abshi | |
653 | \&\-mbranch\-expensive \-mbranch\-cheap | |
654 | \&\-msplit \-mno\-split \-munix\-asm \-mdec\-asm\fR | |
655 | .Sp | |
656 | \&\fIXstormy16 Options\fR | |
657 | \&\fB\-msim\fR | |
658 | .Sp | |
659 | \&\fIXtensa Options\fR | |
660 | \&\fB\-mconst16 \-mno\-const16 | |
661 | \&\-mfused\-madd \-mno\-fused\-madd | |
662 | \&\-mtext\-section\-literals \-mno\-text\-section\-literals | |
663 | \&\-mtarget\-align \-mno\-target\-align | |
664 | \&\-mlongcalls \-mno\-longcalls\fR | |
665 | .Sp | |
666 | \&\fI\s-1FRV\s0 Options\fR | |
667 | \&\fB\-mgpr\-32 \-mgpr\-64 \-mfpr\-32 \-mfpr\-64 | |
668 | \&\-mhard\-float \-msoft\-float | |
669 | \&\-malloc\-cc \-mfixed\-cc \-mdword \-mno\-dword | |
670 | \&\-mdouble \-mno\-double | |
671 | \&\-mmedia \-mno\-media \-mmuladd \-mno\-muladd | |
672 | \&\-mlibrary\-pic \-macc\-4 \-macc\-8 | |
673 | \&\-mpack \-mno\-pack \-mno\-eflags \-mcond\-move \-mno\-cond\-move | |
674 | \&\-mscc \-mno\-scc \-mcond\-exec \-mno\-cond\-exec | |
675 | \&\-mvliw\-branch \-mno\-vliw\-branch | |
676 | \&\-mmulti\-cond\-exec \-mno\-multi\-cond\-exec \-mnested\-cond\-exec | |
677 | \&\-mno\-nested\-cond\-exec \-mtomcat\-stats | |
678 | \&\-mcpu=\fR\fIcpu\fR | |
679 | .IP "\fICode Generation Options\fR" 4 | |
680 | .IX Item "Code Generation Options" | |
681 | \&\fB\-fcall\-saved\-\fR\fIreg\fR \fB\-fcall\-used\-\fR\fIreg\fR | |
682 | \&\fB\-ffixed\-\fR\fIreg\fR \fB\-fexceptions | |
683 | \&\-fnon\-call\-exceptions \-funwind\-tables | |
684 | \&\-fasynchronous\-unwind\-tables | |
685 | \&\-finhibit\-size\-directive \-finstrument\-functions | |
686 | \&\-fno\-common \-fno\-ident | |
687 | \&\-fpcc\-struct\-return \-fpic \-fPIC \-fpie \-fPIE | |
688 | \&\-freg\-struct\-return \-fshared\-data \-fshort\-enums | |
689 | \&\-fshort\-double \-fshort\-wchar | |
690 | \&\-fverbose\-asm \-fpack\-struct \-fstack\-check | |
691 | \&\-fstack\-limit\-register=\fR\fIreg\fR \fB\-fstack\-limit\-symbol=\fR\fIsym\fR | |
692 | \&\fB\-fargument\-alias \-fargument\-noalias | |
693 | \&\-fargument\-noalias\-global \-fleading\-underscore | |
694 | \&\-ftls\-model=\fR\fImodel\fR | |
695 | \&\fB\-ftrapv \-fwrapv \-fbounds\-check\fR | |
696 | .Sh "Options Controlling the Kind of Output" | |
697 | .IX Subsection "Options Controlling the Kind of Output" | |
698 | Compilation can involve up to four stages: preprocessing, compilation | |
699 | proper, assembly and linking, always in that order. \s-1GCC\s0 is capable of | |
700 | preprocessing and compiling several files either into several | |
701 | assembler input files, or into one assembler input file; then each | |
702 | assembler input file produces an object file, and linking combines all | |
703 | the object files (those newly compiled, and those specified as input) | |
704 | into an executable file. | |
705 | .PP | |
706 | For any given input file, the file name suffix determines what kind of | |
707 | compilation is done: | |
708 | .IP "\fIfile\fR\fB.c\fR" 4 | |
709 | .IX Item "file.c" | |
710 | C source code which must be preprocessed. | |
711 | .IP "\fIfile\fR\fB.i\fR" 4 | |
712 | .IX Item "file.i" | |
713 | C source code which should not be preprocessed. | |
714 | .IP "\fIfile\fR\fB.ii\fR" 4 | |
715 | .IX Item "file.ii" | |
716 | \&\*(C+ source code which should not be preprocessed. | |
717 | .IP "\fIfile\fR\fB.m\fR" 4 | |
718 | .IX Item "file.m" | |
719 | Objective-C source code. Note that you must link with the library | |
720 | \&\fIlibobjc.a\fR to make an Objective-C program work. | |
721 | .IP "\fIfile\fR\fB.mi\fR" 4 | |
722 | .IX Item "file.mi" | |
723 | Objective-C source code which should not be preprocessed. | |
724 | .IP "\fIfile\fR\fB.h\fR" 4 | |
725 | .IX Item "file.h" | |
726 | C or \*(C+ header file to be turned into a precompiled header. | |
727 | .IP "\fIfile\fR\fB.cc\fR" 4 | |
728 | .IX Item "file.cc" | |
729 | .PD 0 | |
730 | .IP "\fIfile\fR\fB.cp\fR" 4 | |
731 | .IX Item "file.cp" | |
732 | .IP "\fIfile\fR\fB.cxx\fR" 4 | |
733 | .IX Item "file.cxx" | |
734 | .IP "\fIfile\fR\fB.cpp\fR" 4 | |
735 | .IX Item "file.cpp" | |
736 | .IP "\fIfile\fR\fB.CPP\fR" 4 | |
737 | .IX Item "file.CPP" | |
738 | .IP "\fIfile\fR\fB.c++\fR" 4 | |
739 | .IX Item "file.c++" | |
740 | .IP "\fIfile\fR\fB.C\fR" 4 | |
741 | .IX Item "file.C" | |
742 | .PD | |
743 | \&\*(C+ source code which must be preprocessed. Note that in \fB.cxx\fR, | |
744 | the last two letters must both be literally \fBx\fR. Likewise, | |
745 | \&\fB.C\fR refers to a literal capital C. | |
746 | .IP "\fIfile\fR\fB.hh\fR" 4 | |
747 | .IX Item "file.hh" | |
748 | .PD 0 | |
749 | .IP "\fIfile\fR\fB.H\fR" 4 | |
750 | .IX Item "file.H" | |
751 | .PD | |
752 | \&\*(C+ header file to be turned into a precompiled header. | |
753 | .IP "\fIfile\fR\fB.f\fR" 4 | |
754 | .IX Item "file.f" | |
755 | .PD 0 | |
756 | .IP "\fIfile\fR\fB.for\fR" 4 | |
757 | .IX Item "file.for" | |
758 | .IP "\fIfile\fR\fB.FOR\fR" 4 | |
759 | .IX Item "file.FOR" | |
760 | .PD | |
761 | Fortran source code which should not be preprocessed. | |
762 | .IP "\fIfile\fR\fB.F\fR" 4 | |
763 | .IX Item "file.F" | |
764 | .PD 0 | |
765 | .IP "\fIfile\fR\fB.fpp\fR" 4 | |
766 | .IX Item "file.fpp" | |
767 | .IP "\fIfile\fR\fB.FPP\fR" 4 | |
768 | .IX Item "file.FPP" | |
769 | .PD | |
770 | Fortran source code which must be preprocessed (with the traditional | |
771 | preprocessor). | |
772 | .IP "\fIfile\fR\fB.r\fR" 4 | |
773 | .IX Item "file.r" | |
774 | Fortran source code which must be preprocessed with a \s-1RATFOR\s0 | |
775 | preprocessor (not included with \s-1GCC\s0). | |
776 | .IP "\fIfile\fR\fB.ads\fR" 4 | |
777 | .IX Item "file.ads" | |
778 | Ada source code file which contains a library unit declaration (a | |
779 | declaration of a package, subprogram, or generic, or a generic | |
780 | instantiation), or a library unit renaming declaration (a package, | |
781 | generic, or subprogram renaming declaration). Such files are also | |
782 | called \fIspecs\fR. | |
783 | .IP "\fIfile\fR\fB.adb\fR" 4 | |
784 | .IX Item "file.adb" | |
785 | Ada source code file containing a library unit body (a subprogram or | |
786 | package body). Such files are also called \fIbodies\fR. | |
787 | .IP "\fIfile\fR\fB.s\fR" 4 | |
788 | .IX Item "file.s" | |
789 | Assembler code. | |
790 | .IP "\fIfile\fR\fB.S\fR" 4 | |
791 | .IX Item "file.S" | |
792 | Assembler code which must be preprocessed. | |
793 | .IP "\fIother\fR" 4 | |
794 | .IX Item "other" | |
795 | An object file to be fed straight into linking. | |
796 | Any file name with no recognized suffix is treated this way. | |
797 | .PP | |
798 | You can specify the input language explicitly with the \fB\-x\fR option: | |
799 | .IP "\fB\-x\fR \fIlanguage\fR" 4 | |
800 | .IX Item "-x language" | |
801 | Specify explicitly the \fIlanguage\fR for the following input files | |
802 | (rather than letting the compiler choose a default based on the file | |
803 | name suffix). This option applies to all following input files until | |
804 | the next \fB\-x\fR option. Possible values for \fIlanguage\fR are: | |
805 | .Sp | |
806 | .Vb 8 | |
807 | \& c c-header cpp-output | |
808 | \& c++ c++-header c++-cpp-output | |
809 | \& objective-c objective-c-header objc-cpp-output | |
810 | \& assembler assembler-with-cpp | |
811 | \& ada | |
812 | \& f77 f77-cpp-input ratfor | |
813 | \& java | |
814 | \& treelang | |
815 | .Ve | |
816 | .IP "\fB\-x none\fR" 4 | |
817 | .IX Item "-x none" | |
818 | Turn off any specification of a language, so that subsequent files are | |
819 | handled according to their file name suffixes (as they are if \fB\-x\fR | |
820 | has not been used at all). | |
821 | .IP "\fB\-pass\-exit\-codes\fR" 4 | |
822 | .IX Item "-pass-exit-codes" | |
823 | Normally the \fBgcc\fR program will exit with the code of 1 if any | |
824 | phase of the compiler returns a non-success return code. If you specify | |
825 | \&\fB\-pass\-exit\-codes\fR, the \fBgcc\fR program will instead return with | |
826 | numerically highest error produced by any phase that returned an error | |
827 | indication. | |
828 | .PP | |
829 | If you only want some of the stages of compilation, you can use | |
830 | \&\fB\-x\fR (or filename suffixes) to tell \fBgcc\fR where to start, and | |
831 | one of the options \fB\-c\fR, \fB\-S\fR, or \fB\-E\fR to say where | |
832 | \&\fBgcc\fR is to stop. Note that some combinations (for example, | |
833 | \&\fB\-x cpp-output \-E\fR) instruct \fBgcc\fR to do nothing at all. | |
834 | .IP "\fB\-c\fR" 4 | |
835 | .IX Item "-c" | |
836 | Compile or assemble the source files, but do not link. The linking | |
837 | stage simply is not done. The ultimate output is in the form of an | |
838 | object file for each source file. | |
839 | .Sp | |
840 | By default, the object file name for a source file is made by replacing | |
841 | the suffix \fB.c\fR, \fB.i\fR, \fB.s\fR, etc., with \fB.o\fR. | |
842 | .Sp | |
843 | Unrecognized input files, not requiring compilation or assembly, are | |
844 | ignored. | |
845 | .IP "\fB\-S\fR" 4 | |
846 | .IX Item "-S" | |
847 | Stop after the stage of compilation proper; do not assemble. The output | |
848 | is in the form of an assembler code file for each non-assembler input | |
849 | file specified. | |
850 | .Sp | |
851 | By default, the assembler file name for a source file is made by | |
852 | replacing the suffix \fB.c\fR, \fB.i\fR, etc., with \fB.s\fR. | |
853 | .Sp | |
854 | Input files that don't require compilation are ignored. | |
855 | .IP "\fB\-E\fR" 4 | |
856 | .IX Item "-E" | |
857 | Stop after the preprocessing stage; do not run the compiler proper. The | |
858 | output is in the form of preprocessed source code, which is sent to the | |
859 | standard output. | |
860 | .Sp | |
861 | Input files which don't require preprocessing are ignored. | |
862 | .IP "\fB\-o\fR \fIfile\fR" 4 | |
863 | .IX Item "-o file" | |
864 | Place output in file \fIfile\fR. This applies regardless to whatever | |
865 | sort of output is being produced, whether it be an executable file, | |
866 | an object file, an assembler file or preprocessed C code. | |
867 | .Sp | |
868 | If you specify \fB\-o\fR when compiling more than one input file, or | |
869 | you are producing an executable file as output, all the source files | |
870 | on the command line will be compiled at once. | |
871 | .Sp | |
872 | If \fB\-o\fR is not specified, the default is to put an executable file | |
873 | in \fIa.out\fR, the object file for \fI\fIsource\fI.\fIsuffix\fI\fR in | |
874 | \&\fI\fIsource\fI.o\fR, its assembler file in \fI\fIsource\fI.s\fR, and | |
875 | all preprocessed C source on standard output. | |
876 | .IP "\fB\-v\fR" 4 | |
877 | .IX Item "-v" | |
878 | Print (on standard error output) the commands executed to run the stages | |
879 | of compilation. Also print the version number of the compiler driver | |
880 | program and of the preprocessor and the compiler proper. | |
881 | .IP "\fB\-###\fR" 4 | |
882 | .IX Item "-###" | |
883 | Like \fB\-v\fR except the commands are not executed and all command | |
884 | arguments are quoted. This is useful for shell scripts to capture the | |
885 | driver-generated command lines. | |
886 | .IP "\fB\-pipe\fR" 4 | |
887 | .IX Item "-pipe" | |
888 | Use pipes rather than temporary files for communication between the | |
889 | various stages of compilation. This fails to work on some systems where | |
890 | the assembler is unable to read from a pipe; but the \s-1GNU\s0 assembler has | |
891 | no trouble. | |
892 | .IP "\fB\-\-help\fR" 4 | |
893 | .IX Item "--help" | |
894 | Print (on the standard output) a description of the command line options | |
895 | understood by \fBgcc\fR. If the \fB\-v\fR option is also specified | |
896 | then \fB\-\-help\fR will also be passed on to the various processes | |
897 | invoked by \fBgcc\fR, so that they can display the command line options | |
898 | they accept. If the \fB\-Wextra\fR option is also specified then command | |
899 | line options which have no documentation associated with them will also | |
900 | be displayed. | |
901 | .IP "\fB\-\-target\-help\fR" 4 | |
902 | .IX Item "--target-help" | |
903 | Print (on the standard output) a description of target specific command | |
904 | line options for each tool. | |
905 | .IP "\fB\-\-version\fR" 4 | |
906 | .IX Item "--version" | |
907 | Display the version number and copyrights of the invoked \s-1GCC\s0. | |
908 | .Sh "Compiling \*(C+ Programs" | |
909 | .IX Subsection "Compiling Programs" | |
910 | \&\*(C+ source files conventionally use one of the suffixes \fB.C\fR, | |
911 | \&\fB.cc\fR, \fB.cpp\fR, \fB.CPP\fR, \fB.c++\fR, \fB.cp\fR, or | |
912 | \&\fB.cxx\fR; \*(C+ header files often use \fB.hh\fR or \fB.H\fR; and | |
913 | preprocessed \*(C+ files use the suffix \fB.ii\fR. \s-1GCC\s0 recognizes | |
914 | files with these names and compiles them as \*(C+ programs even if you | |
915 | call the compiler the same way as for compiling C programs (usually | |
916 | with the name \fBgcc\fR). | |
917 | .PP | |
918 | However, \*(C+ programs often require class libraries as well as a | |
919 | compiler that understands the \*(C+ language\-\-\-and under some | |
920 | circumstances, you might want to compile programs or header files from | |
921 | standard input, or otherwise without a suffix that flags them as \*(C+ | |
922 | programs. You might also like to precompile a C header file with a | |
923 | \&\fB.h\fR extension to be used in \*(C+ compilations. \fBg++\fR is a | |
924 | program that calls \s-1GCC\s0 with the default language set to \*(C+, and | |
925 | automatically specifies linking against the \*(C+ library. On many | |
926 | systems, \fBg++\fR is also installed with the name \fBc++\fR. | |
927 | .PP | |
928 | When you compile \*(C+ programs, you may specify many of the same | |
929 | command-line options that you use for compiling programs in any | |
930 | language; or command-line options meaningful for C and related | |
931 | languages; or options that are meaningful only for \*(C+ programs. | |
932 | .Sh "Options Controlling C Dialect" | |
933 | .IX Subsection "Options Controlling C Dialect" | |
934 | The following options control the dialect of C (or languages derived | |
935 | from C, such as \*(C+ and Objective\-C) that the compiler accepts: | |
936 | .IP "\fB\-ansi\fR" 4 | |
937 | .IX Item "-ansi" | |
938 | In C mode, support all \s-1ISO\s0 C90 programs. In \*(C+ mode, | |
939 | remove \s-1GNU\s0 extensions that conflict with \s-1ISO\s0 \*(C+. | |
940 | .Sp | |
941 | This turns off certain features of \s-1GCC\s0 that are incompatible with \s-1ISO\s0 | |
942 | C90 (when compiling C code), or of standard \*(C+ (when compiling \*(C+ code), | |
943 | such as the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, and | |
944 | predefined macros such as \f(CW\*(C`unix\*(C'\fR and \f(CW\*(C`vax\*(C'\fR that identify the | |
945 | type of system you are using. It also enables the undesirable and | |
946 | rarely used \s-1ISO\s0 trigraph feature. For the C compiler, | |
947 | it disables recognition of \*(C+ style \fB//\fR comments as well as | |
948 | the \f(CW\*(C`inline\*(C'\fR keyword. | |
949 | .Sp | |
950 | The alternate keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_extension_\|_\*(C'\fR, | |
951 | \&\f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR continue to work despite | |
952 | \&\fB\-ansi\fR. You would not want to use them in an \s-1ISO\s0 C program, of | |
953 | course, but it is useful to put them in header files that might be included | |
954 | in compilations done with \fB\-ansi\fR. Alternate predefined macros | |
955 | such as \f(CW\*(C`_\|_unix_\|_\*(C'\fR and \f(CW\*(C`_\|_vax_\|_\*(C'\fR are also available, with or | |
956 | without \fB\-ansi\fR. | |
957 | .Sp | |
958 | The \fB\-ansi\fR option does not cause non-ISO programs to be | |
959 | rejected gratuitously. For that, \fB\-pedantic\fR is required in | |
960 | addition to \fB\-ansi\fR. | |
961 | .Sp | |
962 | The macro \f(CW\*(C`_\|_STRICT_ANSI_\|_\*(C'\fR is predefined when the \fB\-ansi\fR | |
963 | option is used. Some header files may notice this macro and refrain | |
964 | from declaring certain functions or defining certain macros that the | |
965 | \&\s-1ISO\s0 standard doesn't call for; this is to avoid interfering with any | |
966 | programs that might use these names for other things. | |
967 | .Sp | |
968 | Functions which would normally be built in but do not have semantics | |
969 | defined by \s-1ISO\s0 C (such as \f(CW\*(C`alloca\*(C'\fR and \f(CW\*(C`ffs\*(C'\fR) are not built-in | |
970 | functions with \fB\-ansi\fR is used. | |
971 | .IP "\fB\-std=\fR" 4 | |
972 | .IX Item "-std=" | |
973 | Determine the language standard. This option is currently only | |
974 | supported when compiling C or \*(C+. A value for this option must be | |
975 | provided; possible values are | |
976 | .RS 4 | |
977 | .IP "\fBc89\fR" 4 | |
978 | .IX Item "c89" | |
979 | .PD 0 | |
980 | .IP "\fBiso9899:1990\fR" 4 | |
981 | .IX Item "iso9899:1990" | |
982 | .PD | |
983 | \&\s-1ISO\s0 C90 (same as \fB\-ansi\fR). | |
984 | .IP "\fBiso9899:199409\fR" 4 | |
985 | .IX Item "iso9899:199409" | |
986 | \&\s-1ISO\s0 C90 as modified in amendment 1. | |
987 | .IP "\fBc99\fR" 4 | |
988 | .IX Item "c99" | |
989 | .PD 0 | |
990 | .IP "\fBc9x\fR" 4 | |
991 | .IX Item "c9x" | |
992 | .IP "\fBiso9899:1999\fR" 4 | |
993 | .IX Item "iso9899:1999" | |
994 | .IP "\fBiso9899:199x\fR" 4 | |
995 | .IX Item "iso9899:199x" | |
996 | .PD | |
997 | \&\s-1ISO\s0 C99. Note that this standard is not yet fully supported; see | |
998 | <\fBhttp://gcc.gnu.org/gcc\-3.4/c99status.html\fR> for more information. The | |
999 | names \fBc9x\fR and \fBiso9899:199x\fR are deprecated. | |
1000 | .IP "\fBgnu89\fR" 4 | |
1001 | .IX Item "gnu89" | |
1002 | Default, \s-1ISO\s0 C90 plus \s-1GNU\s0 extensions (including some C99 features). | |
1003 | .IP "\fBgnu99\fR" 4 | |
1004 | .IX Item "gnu99" | |
1005 | .PD 0 | |
1006 | .IP "\fBgnu9x\fR" 4 | |
1007 | .IX Item "gnu9x" | |
1008 | .PD | |
1009 | \&\s-1ISO\s0 C99 plus \s-1GNU\s0 extensions. When \s-1ISO\s0 C99 is fully implemented in \s-1GCC\s0, | |
1010 | this will become the default. The name \fBgnu9x\fR is deprecated. | |
1011 | .IP "\fBc++98\fR" 4 | |
1012 | .IX Item "c++98" | |
1013 | The 1998 \s-1ISO\s0 \*(C+ standard plus amendments. | |
1014 | .IP "\fBgnu++98\fR" 4 | |
1015 | .IX Item "gnu++98" | |
1016 | The same as \fB\-std=c++98\fR plus \s-1GNU\s0 extensions. This is the | |
1017 | default for \*(C+ code. | |
1018 | .RE | |
1019 | .RS 4 | |
1020 | .Sp | |
1021 | Even when this option is not specified, you can still use some of the | |
1022 | features of newer standards in so far as they do not conflict with | |
1023 | previous C standards. For example, you may use \f(CW\*(C`_\|_restrict_\|_\*(C'\fR even | |
1024 | when \fB\-std=c99\fR is not specified. | |
1025 | .Sp | |
1026 | The \fB\-std\fR options specifying some version of \s-1ISO\s0 C have the same | |
1027 | effects as \fB\-ansi\fR, except that features that were not in \s-1ISO\s0 C90 | |
1028 | but are in the specified version (for example, \fB//\fR comments and | |
1029 | the \f(CW\*(C`inline\*(C'\fR keyword in \s-1ISO\s0 C99) are not disabled. | |
1030 | .RE | |
1031 | .IP "\fB\-aux\-info\fR \fIfilename\fR" 4 | |
1032 | .IX Item "-aux-info filename" | |
1033 | Output to the given filename prototyped declarations for all functions | |
1034 | declared and/or defined in a translation unit, including those in header | |
1035 | files. This option is silently ignored in any language other than C. | |
1036 | .Sp | |
1037 | Besides declarations, the file indicates, in comments, the origin of | |
1038 | each declaration (source file and line), whether the declaration was | |
1039 | implicit, prototyped or unprototyped (\fBI\fR, \fBN\fR for new or | |
1040 | \&\fBO\fR for old, respectively, in the first character after the line | |
1041 | number and the colon), and whether it came from a declaration or a | |
1042 | definition (\fBC\fR or \fBF\fR, respectively, in the following | |
1043 | character). In the case of function definitions, a K&R\-style list of | |
1044 | arguments followed by their declarations is also provided, inside | |
1045 | comments, after the declaration. | |
1046 | .IP "\fB\-fno\-asm\fR" 4 | |
1047 | .IX Item "-fno-asm" | |
1048 | Do not recognize \f(CW\*(C`asm\*(C'\fR, \f(CW\*(C`inline\*(C'\fR or \f(CW\*(C`typeof\*(C'\fR as a | |
1049 | keyword, so that code can use these words as identifiers. You can use | |
1050 | the keywords \f(CW\*(C`_\|_asm_\|_\*(C'\fR, \f(CW\*(C`_\|_inline_\|_\*(C'\fR and \f(CW\*(C`_\|_typeof_\|_\*(C'\fR | |
1051 | instead. \fB\-ansi\fR implies \fB\-fno\-asm\fR. | |
1052 | .Sp | |
1053 | In \*(C+, this switch only affects the \f(CW\*(C`typeof\*(C'\fR keyword, since | |
1054 | \&\f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`inline\*(C'\fR are standard keywords. You may want to | |
1055 | use the \fB\-fno\-gnu\-keywords\fR flag instead, which has the same | |
1056 | effect. In C99 mode (\fB\-std=c99\fR or \fB\-std=gnu99\fR), this | |
1057 | switch only affects the \f(CW\*(C`asm\*(C'\fR and \f(CW\*(C`typeof\*(C'\fR keywords, since | |
1058 | \&\f(CW\*(C`inline\*(C'\fR is a standard keyword in \s-1ISO\s0 C99. | |
1059 | .IP "\fB\-fno\-builtin\fR" 4 | |
1060 | .IX Item "-fno-builtin" | |
1061 | .PD 0 | |
1062 | .IP "\fB\-fno\-builtin\-\fR\fIfunction\fR" 4 | |
1063 | .IX Item "-fno-builtin-function" | |
1064 | .PD | |
1065 | Don't recognize built-in functions that do not begin with | |
1066 | \&\fB_\|_builtin_\fR as prefix. | |
1067 | .Sp | |
1068 | \&\s-1GCC\s0 normally generates special code to handle certain built-in functions | |
1069 | more efficiently; for instance, calls to \f(CW\*(C`alloca\*(C'\fR may become single | |
1070 | instructions that adjust the stack directly, and calls to \f(CW\*(C`memcpy\*(C'\fR | |
1071 | may become inline copy loops. The resulting code is often both smaller | |
1072 | and faster, but since the function calls no longer appear as such, you | |
1073 | cannot set a breakpoint on those calls, nor can you change the behavior | |
1074 | of the functions by linking with a different library. | |
1075 | .Sp | |
1076 | With the \fB\-fno\-builtin\-\fR\fIfunction\fR option | |
1077 | only the built-in function \fIfunction\fR is | |
1078 | disabled. \fIfunction\fR must not begin with \fB_\|_builtin_\fR. If a | |
1079 | function is named this is not built-in in this version of \s-1GCC\s0, this | |
1080 | option is ignored. There is no corresponding | |
1081 | \&\fB\-fbuiltin\-\fR\fIfunction\fR option; if you wish to enable | |
1082 | built-in functions selectively when using \fB\-fno\-builtin\fR or | |
1083 | \&\fB\-ffreestanding\fR, you may define macros such as: | |
1084 | .Sp | |
1085 | .Vb 2 | |
1086 | \& #define abs(n) __builtin_abs ((n)) | |
1087 | \& #define strcpy(d, s) __builtin_strcpy ((d), (s)) | |
1088 | .Ve | |
1089 | .IP "\fB\-fhosted\fR" 4 | |
1090 | .IX Item "-fhosted" | |
1091 | Assert that compilation takes place in a hosted environment. This implies | |
1092 | \&\fB\-fbuiltin\fR. A hosted environment is one in which the | |
1093 | entire standard library is available, and in which \f(CW\*(C`main\*(C'\fR has a return | |
1094 | type of \f(CW\*(C`int\*(C'\fR. Examples are nearly everything except a kernel. | |
1095 | This is equivalent to \fB\-fno\-freestanding\fR. | |
1096 | .IP "\fB\-ffreestanding\fR" 4 | |
1097 | .IX Item "-ffreestanding" | |
1098 | Assert that compilation takes place in a freestanding environment. This | |
1099 | implies \fB\-fno\-builtin\fR. A freestanding environment | |
1100 | is one in which the standard library may not exist, and program startup may | |
1101 | not necessarily be at \f(CW\*(C`main\*(C'\fR. The most obvious example is an \s-1OS\s0 kernel. | |
1102 | This is equivalent to \fB\-fno\-hosted\fR. | |
1103 | .IP "\fB\-fms\-extensions\fR" 4 | |
1104 | .IX Item "-fms-extensions" | |
1105 | Accept some non-standard constructs used in Microsoft header files. | |
1106 | .IP "\fB\-trigraphs\fR" 4 | |
1107 | .IX Item "-trigraphs" | |
1108 | Support \s-1ISO\s0 C trigraphs. The \fB\-ansi\fR option (and \fB\-std\fR | |
1109 | options for strict \s-1ISO\s0 C conformance) implies \fB\-trigraphs\fR. | |
1110 | .IP "\fB\-no\-integrated\-cpp\fR" 4 | |
1111 | .IX Item "-no-integrated-cpp" | |
1112 | Performs a compilation in two passes: preprocessing and compiling. This | |
1113 | option allows a user supplied \*(L"cc1\*(R", \*(L"cc1plus\*(R", or \*(L"cc1obj\*(R" via the | |
1114 | \&\fB\-B\fR option. The user supplied compilation step can then add in | |
1115 | an additional preprocessing step after normal preprocessing but before | |
1116 | compiling. The default is to use the integrated cpp (internal cpp) | |
1117 | .Sp | |
1118 | The semantics of this option will change if \*(L"cc1\*(R", \*(L"cc1plus\*(R", and | |
1119 | \&\*(L"cc1obj\*(R" are merged. | |
1120 | .IP "\fB\-traditional\fR" 4 | |
1121 | .IX Item "-traditional" | |
1122 | .PD 0 | |
1123 | .IP "\fB\-traditional\-cpp\fR" 4 | |
1124 | .IX Item "-traditional-cpp" | |
1125 | .PD | |
1126 | Formerly, these options caused \s-1GCC\s0 to attempt to emulate a pre-standard | |
1127 | C compiler. They are now only supported with the \fB\-E\fR switch. | |
1128 | The preprocessor continues to support a pre-standard mode. See the \s-1GNU\s0 | |
1129 | \&\s-1CPP\s0 manual for details. | |
1130 | .IP "\fB\-fcond\-mismatch\fR" 4 | |
1131 | .IX Item "-fcond-mismatch" | |
1132 | Allow conditional expressions with mismatched types in the second and | |
1133 | third arguments. The value of such an expression is void. This option | |
1134 | is not supported for \*(C+. | |
1135 | .IP "\fB\-funsigned\-char\fR" 4 | |
1136 | .IX Item "-funsigned-char" | |
1137 | Let the type \f(CW\*(C`char\*(C'\fR be unsigned, like \f(CW\*(C`unsigned char\*(C'\fR. | |
1138 | .Sp | |
1139 | Each kind of machine has a default for what \f(CW\*(C`char\*(C'\fR should | |
1140 | be. It is either like \f(CW\*(C`unsigned char\*(C'\fR by default or like | |
1141 | \&\f(CW\*(C`signed char\*(C'\fR by default. | |
1142 | .Sp | |
1143 | Ideally, a portable program should always use \f(CW\*(C`signed char\*(C'\fR or | |
1144 | \&\f(CW\*(C`unsigned char\*(C'\fR when it depends on the signedness of an object. | |
1145 | But many programs have been written to use plain \f(CW\*(C`char\*(C'\fR and | |
1146 | expect it to be signed, or expect it to be unsigned, depending on the | |
1147 | machines they were written for. This option, and its inverse, let you | |
1148 | make such a program work with the opposite default. | |
1149 | .Sp | |
1150 | The type \f(CW\*(C`char\*(C'\fR is always a distinct type from each of | |
1151 | \&\f(CW\*(C`signed char\*(C'\fR or \f(CW\*(C`unsigned char\*(C'\fR, even though its behavior | |
1152 | is always just like one of those two. | |
1153 | .IP "\fB\-fsigned\-char\fR" 4 | |
1154 | .IX Item "-fsigned-char" | |
1155 | Let the type \f(CW\*(C`char\*(C'\fR be signed, like \f(CW\*(C`signed char\*(C'\fR. | |
1156 | .Sp | |
1157 | Note that this is equivalent to \fB\-fno\-unsigned\-char\fR, which is | |
1158 | the negative form of \fB\-funsigned\-char\fR. Likewise, the option | |
1159 | \&\fB\-fno\-signed\-char\fR is equivalent to \fB\-funsigned\-char\fR. | |
1160 | .IP "\fB\-fsigned\-bitfields\fR" 4 | |
1161 | .IX Item "-fsigned-bitfields" | |
1162 | .PD 0 | |
1163 | .IP "\fB\-funsigned\-bitfields\fR" 4 | |
1164 | .IX Item "-funsigned-bitfields" | |
1165 | .IP "\fB\-fno\-signed\-bitfields\fR" 4 | |
1166 | .IX Item "-fno-signed-bitfields" | |
1167 | .IP "\fB\-fno\-unsigned\-bitfields\fR" 4 | |
1168 | .IX Item "-fno-unsigned-bitfields" | |
1169 | .PD | |
1170 | These options control whether a bit-field is signed or unsigned, when the | |
1171 | declaration does not use either \f(CW\*(C`signed\*(C'\fR or \f(CW\*(C`unsigned\*(C'\fR. By | |
1172 | default, such a bit-field is signed, because this is consistent: the | |
1173 | basic integer types such as \f(CW\*(C`int\*(C'\fR are signed types. | |
1174 | .IP "\fB\-fwritable\-strings\fR" 4 | |
1175 | .IX Item "-fwritable-strings" | |
1176 | Store string constants in the writable data segment and don't uniquize | |
1177 | them. This is for compatibility with old programs which assume they can | |
1178 | write into string constants. | |
1179 | .Sp | |
1180 | Writing into string constants is a very bad idea; ``constants'' should | |
1181 | be constant. | |
1182 | .Sp | |
1183 | This option is deprecated. | |
1184 | .Sh "Options Controlling \*(C+ Dialect" | |
1185 | .IX Subsection "Options Controlling Dialect" | |
1186 | This section describes the command-line options that are only meaningful | |
1187 | for \*(C+ programs; but you can also use most of the \s-1GNU\s0 compiler options | |
1188 | regardless of what language your program is in. For example, you | |
1189 | might compile a file \f(CW\*(C`firstClass.C\*(C'\fR like this: | |
1190 | .PP | |
1191 | .Vb 1 | |
1192 | \& g++ -g -frepo -O -c firstClass.C | |
1193 | .Ve | |
1194 | .PP | |
1195 | In this example, only \fB\-frepo\fR is an option meant | |
1196 | only for \*(C+ programs; you can use the other options with any | |
1197 | language supported by \s-1GCC\s0. | |
1198 | .PP | |
1199 | Here is a list of options that are \fIonly\fR for compiling \*(C+ programs: | |
1200 | .IP "\fB\-fabi\-version=\fR\fIn\fR" 4 | |
1201 | .IX Item "-fabi-version=n" | |
1202 | Use version \fIn\fR of the \*(C+ \s-1ABI\s0. Version 2 is the version of the | |
1203 | \&\*(C+ \s-1ABI\s0 that first appeared in G++ 3.4. Version 1 is the version of | |
1204 | the \*(C+ \s-1ABI\s0 that first appeared in G++ 3.2. Version 0 will always be | |
1205 | the version that conforms most closely to the \*(C+ \s-1ABI\s0 specification. | |
1206 | Therefore, the \s-1ABI\s0 obtained using version 0 will change as \s-1ABI\s0 bugs | |
1207 | are fixed. | |
1208 | .Sp | |
1209 | The default is version 2. | |
1210 | .IP "\fB\-fno\-access\-control\fR" 4 | |
1211 | .IX Item "-fno-access-control" | |
1212 | Turn off all access checking. This switch is mainly useful for working | |
1213 | around bugs in the access control code. | |
1214 | .IP "\fB\-fcheck\-new\fR" 4 | |
1215 | .IX Item "-fcheck-new" | |
1216 | Check that the pointer returned by \f(CW\*(C`operator new\*(C'\fR is non-null | |
1217 | before attempting to modify the storage allocated. This check is | |
1218 | normally unnecessary because the \*(C+ standard specifies that | |
1219 | \&\f(CW\*(C`operator new\*(C'\fR will only return \f(CW0\fR if it is declared | |
1220 | \&\fB\f(BIthrow()\fB\fR, in which case the compiler will always check the | |
1221 | return value even without this option. In all other cases, when | |
1222 | \&\f(CW\*(C`operator new\*(C'\fR has a non-empty exception specification, memory | |
1223 | exhaustion is signalled by throwing \f(CW\*(C`std::bad_alloc\*(C'\fR. See also | |
1224 | \&\fBnew (nothrow)\fR. | |
1225 | .IP "\fB\-fconserve\-space\fR" 4 | |
1226 | .IX Item "-fconserve-space" | |
1227 | Put uninitialized or runtime-initialized global variables into the | |
1228 | common segment, as C does. This saves space in the executable at the | |
1229 | cost of not diagnosing duplicate definitions. If you compile with this | |
1230 | flag and your program mysteriously crashes after \f(CW\*(C`main()\*(C'\fR has | |
1231 | completed, you may have an object that is being destroyed twice because | |
1232 | two definitions were merged. | |
1233 | .Sp | |
1234 | This option is no longer useful on most targets, now that support has | |
1235 | been added for putting variables into \s-1BSS\s0 without making them common. | |
1236 | .IP "\fB\-fno\-const\-strings\fR" 4 | |
1237 | .IX Item "-fno-const-strings" | |
1238 | Give string constants type \f(CW\*(C`char *\*(C'\fR instead of type \f(CW\*(C`const | |
1239 | char *\*(C'\fR. By default, G++ uses type \f(CW\*(C`const char *\*(C'\fR as required by | |
1240 | the standard. Even if you use \fB\-fno\-const\-strings\fR, you cannot | |
1241 | actually modify the value of a string constant, unless you also use | |
1242 | \&\fB\-fwritable\-strings\fR. | |
1243 | .Sp | |
1244 | This option might be removed in a future release of G++. For maximum | |
1245 | portability, you should structure your code so that it works with | |
1246 | string constants that have type \f(CW\*(C`const char *\*(C'\fR. | |
1247 | .IP "\fB\-fno\-elide\-constructors\fR" 4 | |
1248 | .IX Item "-fno-elide-constructors" | |
1249 | The \*(C+ standard allows an implementation to omit creating a temporary | |
1250 | which is only used to initialize another object of the same type. | |
1251 | Specifying this option disables that optimization, and forces G++ to | |
1252 | call the copy constructor in all cases. | |
1253 | .IP "\fB\-fno\-enforce\-eh\-specs\fR" 4 | |
1254 | .IX Item "-fno-enforce-eh-specs" | |
1255 | Don't check for violation of exception specifications at runtime. This | |
1256 | option violates the \*(C+ standard, but may be useful for reducing code | |
1257 | size in production builds, much like defining \fB\s-1NDEBUG\s0\fR. The compiler | |
1258 | will still optimize based on the exception specifications. | |
1259 | .IP "\fB\-ffor\-scope\fR" 4 | |
1260 | .IX Item "-ffor-scope" | |
1261 | .PD 0 | |
1262 | .IP "\fB\-fno\-for\-scope\fR" 4 | |
1263 | .IX Item "-fno-for-scope" | |
1264 | .PD | |
1265 | If \fB\-ffor\-scope\fR is specified, the scope of variables declared in | |
1266 | a \fIfor-init-statement\fR is limited to the \fBfor\fR loop itself, | |
1267 | as specified by the \*(C+ standard. | |
1268 | If \fB\-fno\-for\-scope\fR is specified, the scope of variables declared in | |
1269 | a \fIfor-init-statement\fR extends to the end of the enclosing scope, | |
1270 | as was the case in old versions of G++, and other (traditional) | |
1271 | implementations of \*(C+. | |
1272 | .Sp | |
1273 | The default if neither flag is given to follow the standard, | |
1274 | but to allow and give a warning for old-style code that would | |
1275 | otherwise be invalid, or have different behavior. | |
1276 | .IP "\fB\-fno\-gnu\-keywords\fR" 4 | |
1277 | .IX Item "-fno-gnu-keywords" | |
1278 | Do not recognize \f(CW\*(C`typeof\*(C'\fR as a keyword, so that code can use this | |
1279 | word as an identifier. You can use the keyword \f(CW\*(C`_\|_typeof_\|_\*(C'\fR instead. | |
1280 | \&\fB\-ansi\fR implies \fB\-fno\-gnu\-keywords\fR. | |
1281 | .IP "\fB\-fno\-implicit\-templates\fR" 4 | |
1282 | .IX Item "-fno-implicit-templates" | |
1283 | Never emit code for non-inline templates which are instantiated | |
1284 | implicitly (i.e. by use); only emit code for explicit instantiations. | |
1285 | .IP "\fB\-fno\-implicit\-inline\-templates\fR" 4 | |
1286 | .IX Item "-fno-implicit-inline-templates" | |
1287 | Don't emit code for implicit instantiations of inline templates, either. | |
1288 | The default is to handle inlines differently so that compiles with and | |
1289 | without optimization will need the same set of explicit instantiations. | |
1290 | .IP "\fB\-fno\-implement\-inlines\fR" 4 | |
1291 | .IX Item "-fno-implement-inlines" | |
1292 | To save space, do not emit out-of-line copies of inline functions | |
1293 | controlled by \fB#pragma implementation\fR. This will cause linker | |
1294 | errors if these functions are not inlined everywhere they are called. | |
1295 | .IP "\fB\-fms\-extensions\fR" 4 | |
1296 | .IX Item "-fms-extensions" | |
1297 | Disable pedantic warnings about constructs used in \s-1MFC\s0, such as implicit | |
1298 | int and getting a pointer to member function via non-standard syntax. | |
1299 | .IP "\fB\-fno\-nonansi\-builtins\fR" 4 | |
1300 | .IX Item "-fno-nonansi-builtins" | |
1301 | Disable built-in declarations of functions that are not mandated by | |
1302 | \&\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, | |
1303 | \&\f(CW\*(C`index\*(C'\fR, \f(CW\*(C`bzero\*(C'\fR, \f(CW\*(C`conjf\*(C'\fR, and other related functions. | |
1304 | .IP "\fB\-fno\-operator\-names\fR" 4 | |
1305 | .IX Item "-fno-operator-names" | |
1306 | Do not treat the operator name keywords \f(CW\*(C`and\*(C'\fR, \f(CW\*(C`bitand\*(C'\fR, | |
1307 | \&\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 | |
1308 | synonyms as keywords. | |
1309 | .IP "\fB\-fno\-optional\-diags\fR" 4 | |
1310 | .IX Item "-fno-optional-diags" | |
1311 | Disable diagnostics that the standard says a compiler does not need to | |
1312 | issue. Currently, the only such diagnostic issued by G++ is the one for | |
1313 | a name having multiple meanings within a class. | |
1314 | .IP "\fB\-fpermissive\fR" 4 | |
1315 | .IX Item "-fpermissive" | |
1316 | Downgrade some diagnostics about nonconformant code from errors to | |
1317 | warnings. Thus, using \fB\-fpermissive\fR will allow some | |
1318 | nonconforming code to compile. | |
1319 | .IP "\fB\-frepo\fR" 4 | |
1320 | .IX Item "-frepo" | |
1321 | Enable automatic template instantiation at link time. This option also | |
1322 | implies \fB\-fno\-implicit\-templates\fR. | |
1323 | .IP "\fB\-fno\-rtti\fR" 4 | |
1324 | .IX Item "-fno-rtti" | |
1325 | Disable generation of information about every class with virtual | |
1326 | functions for use by the \*(C+ runtime type identification features | |
1327 | (\fBdynamic_cast\fR and \fBtypeid\fR). If you don't use those parts | |
1328 | of the language, you can save some space by using this flag. Note that | |
1329 | exception handling uses the same information, but it will generate it as | |
1330 | needed. | |
1331 | .IP "\fB\-fstats\fR" 4 | |
1332 | .IX Item "-fstats" | |
1333 | Emit statistics about front-end processing at the end of the compilation. | |
1334 | This information is generally only useful to the G++ development team. | |
1335 | .IP "\fB\-ftemplate\-depth\-\fR\fIn\fR" 4 | |
1336 | .IX Item "-ftemplate-depth-n" | |
1337 | Set the maximum instantiation depth for template classes to \fIn\fR. | |
1338 | A limit on the template instantiation depth is needed to detect | |
1339 | endless recursions during template class instantiation. \s-1ANSI/ISO\s0 \*(C+ | |
1340 | conforming programs must not rely on a maximum depth greater than 17. | |
1341 | .IP "\fB\-fuse\-cxa\-atexit\fR" 4 | |
1342 | .IX Item "-fuse-cxa-atexit" | |
1343 | Register destructors for objects with static storage duration with the | |
1344 | \&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR function rather than the \f(CW\*(C`atexit\*(C'\fR function. | |
1345 | This option is required for fully standards-compliant handling of static | |
1346 | destructors, but will only work if your C library supports | |
1347 | \&\f(CW\*(C`_\|_cxa_atexit\*(C'\fR. | |
1348 | .IP "\fB\-fno\-weak\fR" 4 | |
1349 | .IX Item "-fno-weak" | |
1350 | Do not use weak symbol support, even if it is provided by the linker. | |
1351 | By default, G++ will use weak symbols if they are available. This | |
1352 | option exists only for testing, and should not be used by end\-users; | |
1353 | it will result in inferior code and has no benefits. This option may | |
1354 | be removed in a future release of G++. | |
1355 | .IP "\fB\-nostdinc++\fR" 4 | |
1356 | .IX Item "-nostdinc++" | |
1357 | Do not search for header files in the standard directories specific to | |
1358 | \&\*(C+, but do still search the other standard directories. (This option | |
1359 | is used when building the \*(C+ library.) | |
1360 | .PP | |
1361 | In addition, these optimization, warning, and code generation options | |
1362 | have meanings only for \*(C+ programs: | |
1363 | .IP "\fB\-fno\-default\-inline\fR" 4 | |
1364 | .IX Item "-fno-default-inline" | |
1365 | Do not assume \fBinline\fR for functions defined inside a class scope. | |
1366 | Note that these | |
1367 | functions will have linkage like inline functions; they just won't be | |
1368 | inlined by default. | |
1369 | .IP "\fB\-Wabi\fR (\*(C+ only)" 4 | |
1370 | .IX Item "-Wabi ( only)" | |
1371 | Warn when G++ generates code that is probably not compatible with the | |
1372 | vendor-neutral \*(C+ \s-1ABI\s0. Although an effort has been made to warn about | |
1373 | all such cases, there are probably some cases that are not warned about, | |
1374 | even though G++ is generating incompatible code. There may also be | |
1375 | cases where warnings are emitted even though the code that is generated | |
1376 | will be compatible. | |
1377 | .Sp | |
1378 | You should rewrite your code to avoid these warnings if you are | |
1379 | concerned about the fact that code generated by G++ may not be binary | |
1380 | compatible with code generated by other compilers. | |
1381 | .Sp | |
1382 | The known incompatibilities at this point include: | |
1383 | .RS 4 | |
1384 | .IP "*" 4 | |
1385 | Incorrect handling of tail-padding for bit\-fields. G++ may attempt to | |
1386 | pack data into the same byte as a base class. For example: | |
1387 | .Sp | |
1388 | .Vb 2 | |
1389 | \& struct A { virtual void f(); int f1 : 1; }; | |
1390 | \& struct B : public A { int f2 : 1; }; | |
1391 | .Ve | |
1392 | .Sp | |
1393 | In this case, G++ will place \f(CW\*(C`B::f2\*(C'\fR into the same byte | |
1394 | as\f(CW\*(C`A::f1\*(C'\fR; other compilers will not. You can avoid this problem | |
1395 | by explicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of the | |
1396 | byte size on your platform; that will cause G++ and other compilers to | |
1397 | layout \f(CW\*(C`B\*(C'\fR identically. | |
1398 | .IP "*" 4 | |
1399 | Incorrect handling of tail-padding for virtual bases. G++ does not use | |
1400 | tail padding when laying out virtual bases. For example: | |
1401 | .Sp | |
1402 | .Vb 3 | |
1403 | \& struct A { virtual void f(); char c1; }; | |
1404 | \& struct B { B(); char c2; }; | |
1405 | \& struct C : public A, public virtual B {}; | |
1406 | .Ve | |
1407 | .Sp | |
1408 | In this case, G++ will not place \f(CW\*(C`B\*(C'\fR into the tail-padding for | |
1409 | \&\f(CW\*(C`A\*(C'\fR; other compilers will. You can avoid this problem by | |
1410 | explicitly padding \f(CW\*(C`A\*(C'\fR so that its size is a multiple of its | |
1411 | alignment (ignoring virtual base classes); that will cause G++ and other | |
1412 | compilers to layout \f(CW\*(C`C\*(C'\fR identically. | |
1413 | .IP "*" 4 | |
1414 | Incorrect handling of bit-fields with declared widths greater than that | |
1415 | of their underlying types, when the bit-fields appear in a union. For | |
1416 | example: | |
1417 | .Sp | |
1418 | .Vb 1 | |
1419 | \& union U { int i : 4096; }; | |
1420 | .Ve | |
1421 | .Sp | |
1422 | Assuming that an \f(CW\*(C`int\*(C'\fR does not have 4096 bits, G++ will make the | |
1423 | union too small by the number of bits in an \f(CW\*(C`int\*(C'\fR. | |
1424 | .IP "*" 4 | |
1425 | Empty classes can be placed at incorrect offsets. For example: | |
1426 | .Sp | |
1427 | .Vb 1 | |
1428 | \& struct A {}; | |
1429 | .Ve | |
1430 | .Sp | |
1431 | .Vb 4 | |
1432 | \& struct B { | |
1433 | \& A a; | |
1434 | \& virtual void f (); | |
1435 | \& }; | |
1436 | .Ve | |
1437 | .Sp | |
1438 | .Vb 1 | |
1439 | \& struct C : public B, public A {}; | |
1440 | .Ve | |
1441 | .Sp | |
1442 | G++ will place the \f(CW\*(C`A\*(C'\fR base class of \f(CW\*(C`C\*(C'\fR at a nonzero offset; | |
1443 | it should be placed at offset zero. G++ mistakenly believes that the | |
1444 | \&\f(CW\*(C`A\*(C'\fR data member of \f(CW\*(C`B\*(C'\fR is already at offset zero. | |
1445 | .IP "*" 4 | |
1446 | Names of template functions whose types involve \f(CW\*(C`typename\*(C'\fR or | |
1447 | template template parameters can be mangled incorrectly. | |
1448 | .Sp | |
1449 | .Vb 2 | |
1450 | \& template <typename Q> | |
1451 | \& void f(typename Q::X) {} | |
1452 | .Ve | |
1453 | .Sp | |
1454 | .Vb 2 | |
1455 | \& template <template <typename> class Q> | |
1456 | \& void f(typename Q<int>::X) {} | |
1457 | .Ve | |
1458 | .Sp | |
1459 | Instantiations of these templates may be mangled incorrectly. | |
1460 | .RE | |
1461 | .RS 4 | |
1462 | .RE | |
1463 | .IP "\fB\-Wctor\-dtor\-privacy\fR (\*(C+ only)" 4 | |
1464 | .IX Item "-Wctor-dtor-privacy ( only)" | |
1465 | Warn when a class seems unusable because all the constructors or | |
1466 | destructors in that class are private, and it has neither friends nor | |
1467 | public static member functions. | |
1468 | .IP "\fB\-Wnon\-virtual\-dtor\fR (\*(C+ only)" 4 | |
1469 | .IX Item "-Wnon-virtual-dtor ( only)" | |
1470 | Warn when a class appears to be polymorphic, thereby requiring a virtual | |
1471 | destructor, yet it declares a non-virtual one. | |
1472 | This warning is enabled by \fB\-Wall\fR. | |
1473 | .IP "\fB\-Wreorder\fR (\*(C+ only)" 4 | |
1474 | .IX Item "-Wreorder ( only)" | |
1475 | Warn when the order of member initializers given in the code does not | |
1476 | match the order in which they must be executed. For instance: | |
1477 | .Sp | |
1478 | .Vb 5 | |
1479 | \& struct A { | |
1480 | \& int i; | |
1481 | \& int j; | |
1482 | \& A(): j (0), i (1) { } | |
1483 | \& }; | |
1484 | .Ve | |
1485 | .Sp | |
1486 | The compiler will rearrange the member initializers for \fBi\fR | |
1487 | and \fBj\fR to match the declaration order of the members, emitting | |
1488 | a warning to that effect. This warning is enabled by \fB\-Wall\fR. | |
1489 | .PP | |
1490 | The following \fB\-W...\fR options are not affected by \fB\-Wall\fR. | |
1491 | .IP "\fB\-Weffc++\fR (\*(C+ only)" 4 | |
1492 | .IX Item "-Weffc++ ( only)" | |
1493 | Warn about violations of the following style guidelines from Scott Meyers' | |
1494 | \&\fIEffective \*(C+\fR book: | |
1495 | .RS 4 | |
1496 | .IP "*" 4 | |
1497 | Item 11: Define a copy constructor and an assignment operator for classes | |
1498 | with dynamically allocated memory. | |
1499 | .IP "*" 4 | |
1500 | Item 12: Prefer initialization to assignment in constructors. | |
1501 | .IP "*" 4 | |
1502 | Item 14: Make destructors virtual in base classes. | |
1503 | .IP "*" 4 | |
1504 | Item 15: Have \f(CW\*(C`operator=\*(C'\fR return a reference to \f(CW*this\fR. | |
1505 | .IP "*" 4 | |
1506 | Item 23: Don't try to return a reference when you must return an object. | |
1507 | .RE | |
1508 | .RS 4 | |
1509 | .Sp | |
1510 | Also warn about violations of the following style guidelines from | |
1511 | Scott Meyers' \fIMore Effective \*(C+\fR book: | |
1512 | .IP "*" 4 | |
1513 | Item 6: Distinguish between prefix and postfix forms of increment and | |
1514 | decrement operators. | |
1515 | .IP "*" 4 | |
1516 | Item 7: Never overload \f(CW\*(C`&&\*(C'\fR, \f(CW\*(C`||\*(C'\fR, or \f(CW\*(C`,\*(C'\fR. | |
1517 | .RE | |
1518 | .RS 4 | |
1519 | .Sp | |
1520 | When selecting this option, be aware that the standard library | |
1521 | headers do not obey all of these guidelines; use \fBgrep \-v\fR | |
1522 | to filter out those warnings. | |
1523 | .RE | |
1524 | .IP "\fB\-Wno\-deprecated\fR (\*(C+ only)" 4 | |
1525 | .IX Item "-Wno-deprecated ( only)" | |
1526 | Do not warn about usage of deprecated features. | |
1527 | .IP "\fB\-Wno\-non\-template\-friend\fR (\*(C+ only)" 4 | |
1528 | .IX Item "-Wno-non-template-friend ( only)" | |
1529 | Disable warnings when non-templatized friend functions are declared | |
1530 | within a template. Since the advent of explicit template specification | |
1531 | support in G++, if the name of the friend is an unqualified-id (i.e., | |
1532 | \&\fBfriend foo(int)\fR), the \*(C+ language specification demands that the | |
1533 | friend declare or define an ordinary, nontemplate function. (Section | |
1534 | 14.5.3). Before G++ implemented explicit specification, unqualified-ids | |
1535 | could be interpreted as a particular specialization of a templatized | |
1536 | function. Because this non-conforming behavior is no longer the default | |
1537 | behavior for G++, \fB\-Wnon\-template\-friend\fR allows the compiler to | |
1538 | check existing code for potential trouble spots and is on by default. | |
1539 | This new compiler behavior can be turned off with | |
1540 | \&\fB\-Wno\-non\-template\-friend\fR which keeps the conformant compiler code | |
1541 | but disables the helpful warning. | |
1542 | .IP "\fB\-Wold\-style\-cast\fR (\*(C+ only)" 4 | |
1543 | .IX Item "-Wold-style-cast ( only)" | |
1544 | Warn if an old-style (C\-style) cast to a non-void type is used within | |
1545 | a \*(C+ program. The new-style casts (\fBstatic_cast\fR, | |
1546 | \&\fBreinterpret_cast\fR, and \fBconst_cast\fR) are less vulnerable to | |
1547 | unintended effects and much easier to search for. | |
1548 | .IP "\fB\-Woverloaded\-virtual\fR (\*(C+ only)" 4 | |
1549 | .IX Item "-Woverloaded-virtual ( only)" | |
1550 | Warn when a function declaration hides virtual functions from a | |
1551 | base class. For example, in: | |
1552 | .Sp | |
1553 | .Vb 3 | |
1554 | \& struct A { | |
1555 | \& virtual void f(); | |
1556 | \& }; | |
1557 | .Ve | |
1558 | .Sp | |
1559 | .Vb 3 | |
1560 | \& struct B: public A { | |
1561 | \& void f(int); | |
1562 | \& }; | |
1563 | .Ve | |
1564 | .Sp | |
1565 | the \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 | |
1566 | like: | |
1567 | .Sp | |
1568 | .Vb 2 | |
1569 | \& B* b; | |
1570 | \& b->f(); | |
1571 | .Ve | |
1572 | .Sp | |
1573 | will fail to compile. | |
1574 | .IP "\fB\-Wno\-pmf\-conversions\fR (\*(C+ only)" 4 | |
1575 | .IX Item "-Wno-pmf-conversions ( only)" | |
1576 | Disable the diagnostic for converting a bound pointer to member function | |
1577 | to a plain pointer. | |
1578 | .IP "\fB\-Wsign\-promo\fR (\*(C+ only)" 4 | |
1579 | .IX Item "-Wsign-promo ( only)" | |
1580 | Warn when overload resolution chooses a promotion from unsigned or | |
1581 | enumerated type to a signed type, over a conversion to an unsigned type of | |
1582 | the same size. Previous versions of G++ would try to preserve | |
1583 | unsignedness, but the standard mandates the current behavior. | |
1584 | .Sp | |
1585 | .Vb 4 | |
1586 | \& struct A { | |
1587 | \& operator int (); | |
1588 | \& A& operator = (int); | |
1589 | \& }; | |
1590 | .Ve | |
1591 | .Sp | |
1592 | .Vb 5 | |
1593 | \& main () | |
1594 | \& { | |
1595 | \& A a,b; | |
1596 | \& a = b; | |
1597 | \& } | |
1598 | .Ve | |
1599 | .Sp | |
1600 | In this example, G++ will synthesize a default \fBA& operator = | |
1601 | (const A&);\fR, while cfront will use the user-defined \fBoperator =\fR. | |
1602 | .Sh "Options Controlling Objective-C Dialect" | |
1603 | .IX Subsection "Options Controlling Objective-C Dialect" | |
1604 | (\s-1NOTE:\s0 This manual does not describe the Objective-C language itself. See | |
1605 | <\fBhttp://gcc.gnu.org/readings.html\fR> for references.) | |
1606 | .PP | |
1607 | This section describes the command-line options that are only meaningful | |
1608 | for Objective-C programs, but you can also use most of the \s-1GNU\s0 compiler | |
1609 | options regardless of what language your program is in. For example, | |
1610 | you might compile a file \f(CW\*(C`some_class.m\*(C'\fR like this: | |
1611 | .PP | |
1612 | .Vb 1 | |
1613 | \& gcc -g -fgnu-runtime -O -c some_class.m | |
1614 | .Ve | |
1615 | .PP | |
1616 | In this example, \fB\-fgnu\-runtime\fR is an option meant only for | |
1617 | Objective-C programs; you can use the other options with any language | |
1618 | supported by \s-1GCC\s0. | |
1619 | .PP | |
1620 | Here is a list of options that are \fIonly\fR for compiling Objective-C | |
1621 | programs: | |
1622 | .IP "\fB\-fconstant\-string\-class=\fR\fIclass-name\fR" 4 | |
1623 | .IX Item "-fconstant-string-class=class-name" | |
1624 | Use \fIclass-name\fR as the name of the class to instantiate for each | |
1625 | literal string specified with the syntax \f(CW\*(C`@"..."\*(C'\fR. The default | |
1626 | class name is \f(CW\*(C`NXConstantString\*(C'\fR if the \s-1GNU\s0 runtime is being used, and | |
1627 | \&\f(CW\*(C`NSConstantString\*(C'\fR if the NeXT runtime is being used (see below). The | |
1628 | \&\fB\-fconstant\-cfstrings\fR option, if also present, will override the | |
1629 | \&\fB\-fconstant\-string\-class\fR setting and cause \f(CW\*(C`@"..."\*(C'\fR literals | |
1630 | to be laid out as constant CoreFoundation strings. | |
1631 | .IP "\fB\-fgnu\-runtime\fR" 4 | |
1632 | .IX Item "-fgnu-runtime" | |
1633 | Generate object code compatible with the standard \s-1GNU\s0 Objective-C | |
1634 | runtime. This is the default for most types of systems. | |
1635 | .IP "\fB\-fnext\-runtime\fR" 4 | |
1636 | .IX Item "-fnext-runtime" | |
1637 | Generate output compatible with the NeXT runtime. This is the default | |
1638 | for NeXT-based systems, including Darwin and Mac \s-1OS\s0 X. The macro | |
1639 | \&\f(CW\*(C`_\|_NEXT_RUNTIME_\|_\*(C'\fR is predefined if (and only if) this option is | |
1640 | used. | |
1641 | .IP "\fB\-fno\-nil\-receivers\fR" 4 | |
1642 | .IX Item "-fno-nil-receivers" | |
1643 | Assume that all Objective-C message dispatches (e.g., | |
1644 | \&\f(CW\*(C`[receiver message:arg]\*(C'\fR) in this translation unit ensure that the receiver | |
1645 | is not \f(CW\*(C`nil\*(C'\fR. This allows for more efficient entry points in the runtime to be | |
1646 | used. Currently, this option is only available in conjunction with | |
1647 | the NeXT runtime on Mac \s-1OS\s0 X 10.3 and later. | |
1648 | .IP "\fB\-fobjc\-exceptions\fR" 4 | |
1649 | .IX Item "-fobjc-exceptions" | |
1650 | Enable syntactic support for structured exception handling in Objective\-C, | |
1651 | similar to what is offered by \*(C+ and Java. Currently, this option is only | |
1652 | available in conjunction with the NeXT runtime on Mac \s-1OS\s0 X 10.3 and later. | |
1653 | .Sp | |
1654 | .Vb 23 | |
1655 | \& @try { | |
1656 | \& ... | |
1657 | \& @throw expr; | |
1658 | \& ... | |
1659 | \& } | |
1660 | \& @catch (AnObjCClass *exc) { | |
1661 | \& ... | |
1662 | \& @throw expr; | |
1663 | \& ... | |
1664 | \& @throw; | |
1665 | \& ... | |
1666 | \& } | |
1667 | \& @catch (AnotherClass *exc) { | |
1668 | \& ... | |
1669 | \& } | |
1670 | \& @catch (id allOthers) { | |
1671 | \& ... | |
1672 | \& } | |
1673 | \& @finally { | |
1674 | \& ... | |
1675 | \& @throw expr; | |
1676 | \& ... | |
1677 | \& } | |
1678 | .Ve | |
1679 | .Sp | |
1680 | The \f(CW@throw\fR statement may appear anywhere in an Objective-C or | |
1681 | Objective\-\*(C+ program; when used inside of a \f(CW@catch\fR block, the | |
1682 | \&\f(CW@throw\fR may appear without an argument (as shown above), in which case | |
1683 | the object caught by the \f(CW@catch\fR will be rethrown. | |
1684 | .Sp | |
1685 | Note that only (pointers to) Objective-C objects may be thrown and | |
1686 | caught using this scheme. When an object is thrown, it will be caught | |
1687 | by the nearest \f(CW@catch\fR clause capable of handling objects of that type, | |
1688 | analogously to how \f(CW\*(C`catch\*(C'\fR blocks work in \*(C+ and Java. A | |
1689 | \&\f(CW\*(C`@catch(id ...)\*(C'\fR clause (as shown above) may also be provided to catch | |
1690 | any and all Objective-C exceptions not caught by previous \f(CW@catch\fR | |
1691 | clauses (if any). | |
1692 | .Sp | |
1693 | The \f(CW@finally\fR clause, if present, will be executed upon exit from the | |
1694 | immediately preceding \f(CW\*(C`@try ... @catch\*(C'\fR section. This will happen | |
1695 | regardless of whether any exceptions are thrown, caught or rethrown | |
1696 | inside the \f(CW\*(C`@try ... @catch\*(C'\fR section, analogously to the behavior | |
1697 | of the \f(CW\*(C`finally\*(C'\fR clause in Java. | |
1698 | .Sp | |
1699 | There are several caveats to using the new exception mechanism: | |
1700 | .RS 4 | |
1701 | .IP "*" 4 | |
1702 | Although currently designed to be binary compatible with \f(CW\*(C`NS_HANDLER\*(C'\fR\-style | |
1703 | idioms provided by the \f(CW\*(C`NSException\*(C'\fR class, the new | |
1704 | exceptions can only be used on Mac \s-1OS\s0 X 10.3 (Panther) and later | |
1705 | systems, due to additional functionality needed in the (NeXT) Objective-C | |
1706 | runtime. | |
1707 | .IP "*" 4 | |
1708 | As mentioned above, the new exceptions do not support handling | |
1709 | types other than Objective-C objects. Furthermore, when used from | |
1710 | Objective\-\*(C+, the Objective-C exception model does not interoperate with \*(C+ | |
1711 | exceptions at this time. This means you cannot \f(CW@throw\fR an exception | |
1712 | from Objective-C and \f(CW\*(C`catch\*(C'\fR it in \*(C+, or vice versa | |
1713 | (i.e., \f(CW\*(C`throw ... @catch\*(C'\fR). | |
1714 | .RE | |
1715 | .RS 4 | |
1716 | .Sp | |
1717 | The \fB\-fobjc\-exceptions\fR switch also enables the use of synchronization | |
1718 | blocks for thread-safe execution: | |
1719 | .Sp | |
1720 | .Vb 3 | |
1721 | \& @synchronized (ObjCClass *guard) { | |
1722 | \& ... | |
1723 | \& } | |
1724 | .Ve | |
1725 | .Sp | |
1726 | Upon entering the \f(CW@synchronized\fR block, a thread of execution shall | |
1727 | first check whether a lock has been placed on the corresponding \f(CW\*(C`guard\*(C'\fR | |
1728 | object by another thread. If it has, the current thread shall wait until | |
1729 | the other thread relinquishes its lock. Once \f(CW\*(C`guard\*(C'\fR becomes available, | |
1730 | the current thread will place its own lock on it, execute the code contained in | |
1731 | the \f(CW@synchronized\fR block, and finally relinquish the lock (thereby | |
1732 | making \f(CW\*(C`guard\*(C'\fR available to other threads). | |
1733 | .Sp | |
1734 | Unlike Java, Objective-C does not allow for entire methods to be marked | |
1735 | \&\f(CW@synchronized\fR. Note that throwing exceptions out of | |
1736 | \&\f(CW@synchronized\fR blocks is allowed, and will cause the guarding object | |
1737 | to be unlocked properly. | |
1738 | .RE | |
1739 | .IP "\fB\-freplace\-objc\-classes\fR" 4 | |
1740 | .IX Item "-freplace-objc-classes" | |
1741 | Emit a special marker instructing \fB\f(BIld\fB\|(1)\fR not to statically link in | |
1742 | the resulting object file, and allow \fB\f(BIdyld\fB\|(1)\fR to load it in at | |
1743 | run time instead. This is used in conjunction with the Fix-and-Continue | |
1744 | debugging mode, where the object file in question may be recompiled and | |
1745 | dynamically reloaded in the course of program execution, without the need | |
1746 | to restart the program itself. Currently, Fix-and-Continue functionality | |
1747 | is only available in conjunction with the NeXT runtime on Mac \s-1OS\s0 X 10.3 | |
1748 | and later. | |
1749 | .IP "\fB\-fzero\-link\fR" 4 | |
1750 | .IX Item "-fzero-link" | |
1751 | When compiling for the NeXT runtime, the compiler ordinarily replaces calls | |
1752 | to \f(CW\*(C`objc_getClass("...")\*(C'\fR (when the name of the class is known at | |
1753 | compile time) with static class references that get initialized at load time, | |
1754 | which improves run-time performance. Specifying the \fB\-fzero\-link\fR flag | |
1755 | suppresses this behavior and causes calls to \f(CW\*(C`objc_getClass("...")\*(C'\fR | |
1756 | to be retained. This is useful in Zero-Link debugging mode, since it allows | |
1757 | for individual class implementations to be modified during program execution. | |
1758 | .IP "\fB\-gen\-decls\fR" 4 | |
1759 | .IX Item "-gen-decls" | |
1760 | Dump interface declarations for all classes seen in the source file to a | |
1761 | file named \fI\fIsourcename\fI.decl\fR. | |
1762 | .IP "\fB\-Wno\-protocol\fR" 4 | |
1763 | .IX Item "-Wno-protocol" | |
1764 | If a class is declared to implement a protocol, a warning is issued for | |
1765 | every method in the protocol that is not implemented by the class. The | |
1766 | default behavior is to issue a warning for every method not explicitly | |
1767 | implemented in the class, even if a method implementation is inherited | |
1768 | from the superclass. If you use the \f(CW\*(C`\-Wno\-protocol\*(C'\fR option, then | |
1769 | methods inherited from the superclass are considered to be implemented, | |
1770 | and no warning is issued for them. | |
1771 | .IP "\fB\-Wselector\fR" 4 | |
1772 | .IX Item "-Wselector" | |
1773 | Warn if multiple methods of different types for the same selector are | |
1774 | found during compilation. The check is performed on the list of methods | |
1775 | in the final stage of compilation. Additionally, a check is performed | |
1776 | for each selector appearing in a \f(CW\*(C`@selector(...)\*(C'\fR | |
1777 | expression, and a corresponding method for that selector has been found | |
1778 | during compilation. Because these checks scan the method table only at | |
1779 | the end of compilation, these warnings are not produced if the final | |
1780 | stage of compilation is not reached, for example because an error is | |
1781 | found during compilation, or because the \f(CW\*(C`\-fsyntax\-only\*(C'\fR option is | |
1782 | being used. | |
1783 | .IP "\fB\-Wundeclared\-selector\fR" 4 | |
1784 | .IX Item "-Wundeclared-selector" | |
1785 | Warn if a \f(CW\*(C`@selector(...)\*(C'\fR expression referring to an | |
1786 | undeclared selector is found. A selector is considered undeclared if no | |
1787 | method with that name has been declared before the | |
1788 | \&\f(CW\*(C`@selector(...)\*(C'\fR expression, either explicitly in an | |
1789 | \&\f(CW@interface\fR or \f(CW@protocol\fR declaration, or implicitly in | |
1790 | an \f(CW@implementation\fR section. This option always performs its | |
1791 | checks as soon as a \f(CW\*(C`@selector(...)\*(C'\fR expression is found, | |
1792 | while \f(CW\*(C`\-Wselector\*(C'\fR only performs its checks in the final stage of | |
1793 | compilation. This also enforces the coding style convention | |
1794 | that methods and selectors must be declared before being used. | |
1795 | .IP "\fB\-print\-objc\-runtime\-info\fR" 4 | |
1796 | .IX Item "-print-objc-runtime-info" | |
1797 | Generate C header describing the largest structure that is passed by | |
1798 | value, if any. | |
1799 | .Sh "Options to Control Diagnostic Messages Formatting" | |
1800 | .IX Subsection "Options to Control Diagnostic Messages Formatting" | |
1801 | Traditionally, diagnostic messages have been formatted irrespective of | |
1802 | the output device's aspect (e.g. its width, ...). The options described | |
1803 | below can be used to control the diagnostic messages formatting | |
1804 | algorithm, e.g. how many characters per line, how often source location | |
1805 | information should be reported. Right now, only the \*(C+ front end can | |
1806 | honor these options. However it is expected, in the near future, that | |
1807 | the remaining front ends would be able to digest them correctly. | |
1808 | .IP "\fB\-fmessage\-length=\fR\fIn\fR" 4 | |
1809 | .IX Item "-fmessage-length=n" | |
1810 | Try to format error messages so that they fit on lines of about \fIn\fR | |
1811 | characters. The default is 72 characters for \fBg++\fR and 0 for the rest of | |
1812 | the front ends supported by \s-1GCC\s0. If \fIn\fR is zero, then no | |
1813 | line-wrapping will be done; each error message will appear on a single | |
1814 | line. | |
1815 | .IP "\fB\-fdiagnostics\-show\-location=once\fR" 4 | |
1816 | .IX Item "-fdiagnostics-show-location=once" | |
1817 | Only meaningful in line-wrapping mode. Instructs the diagnostic messages | |
1818 | reporter to emit \fIonce\fR source location information; that is, in | |
1819 | case the message is too long to fit on a single physical line and has to | |
1820 | be wrapped, the source location won't be emitted (as prefix) again, | |
1821 | over and over, in subsequent continuation lines. This is the default | |
1822 | behavior. | |
1823 | .IP "\fB\-fdiagnostics\-show\-location=every\-line\fR" 4 | |
1824 | .IX Item "-fdiagnostics-show-location=every-line" | |
1825 | Only meaningful in line-wrapping mode. Instructs the diagnostic | |
1826 | messages reporter to emit the same source location information (as | |
1827 | prefix) for physical lines that result from the process of breaking | |
1828 | a message which is too long to fit on a single line. | |
1829 | .Sh "Options to Request or Suppress Warnings" | |
1830 | .IX Subsection "Options to Request or Suppress Warnings" | |
1831 | Warnings are diagnostic messages that report constructions which | |
1832 | are not inherently erroneous but which are risky or suggest there | |
1833 | may have been an error. | |
1834 | .PP | |
1835 | You can request many specific warnings with options beginning \fB\-W\fR, | |
1836 | for example \fB\-Wimplicit\fR to request warnings on implicit | |
1837 | declarations. Each of these specific warning options also has a | |
1838 | negative form beginning \fB\-Wno\-\fR to turn off warnings; | |
1839 | for example, \fB\-Wno\-implicit\fR. This manual lists only one of the | |
1840 | two forms, whichever is not the default. | |
1841 | .PP | |
1842 | The following options control the amount and kinds of warnings produced | |
1843 | by \s-1GCC\s0; for further, language-specific options also refer to | |
1844 | \&\fB\*(C+ Dialect Options\fR and \fBObjective-C Dialect Options\fR. | |
1845 | .IP "\fB\-fsyntax\-only\fR" 4 | |
1846 | .IX Item "-fsyntax-only" | |
1847 | Check the code for syntax errors, but don't do anything beyond that. | |
1848 | .IP "\fB\-pedantic\fR" 4 | |
1849 | .IX Item "-pedantic" | |
1850 | Issue all the warnings demanded by strict \s-1ISO\s0 C and \s-1ISO\s0 \*(C+; | |
1851 | reject all programs that use forbidden extensions, and some other | |
1852 | programs that do not follow \s-1ISO\s0 C and \s-1ISO\s0 \*(C+. For \s-1ISO\s0 C, follows the | |
1853 | version of the \s-1ISO\s0 C standard specified by any \fB\-std\fR option used. | |
1854 | .Sp | |
1855 | Valid \s-1ISO\s0 C and \s-1ISO\s0 \*(C+ programs should compile properly with or without | |
1856 | this option (though a rare few will require \fB\-ansi\fR or a | |
1857 | \&\fB\-std\fR option specifying the required version of \s-1ISO\s0 C). However, | |
1858 | without this option, certain \s-1GNU\s0 extensions and traditional C and \*(C+ | |
1859 | features are supported as well. With this option, they are rejected. | |
1860 | .Sp | |
1861 | \&\fB\-pedantic\fR does not cause warning messages for use of the | |
1862 | alternate keywords whose names begin and end with \fB_\|_\fR. Pedantic | |
1863 | warnings are also disabled in the expression that follows | |
1864 | \&\f(CW\*(C`_\|_extension_\|_\*(C'\fR. However, only system header files should use | |
1865 | these escape routes; application programs should avoid them. | |
1866 | .Sp | |
1867 | Some users try to use \fB\-pedantic\fR to check programs for strict \s-1ISO\s0 | |
1868 | C conformance. They soon find that it does not do quite what they want: | |
1869 | it finds some non-ISO practices, but not all\-\-\-only those for which | |
1870 | \&\s-1ISO\s0 C \fIrequires\fR a diagnostic, and some others for which | |
1871 | diagnostics have been added. | |
1872 | .Sp | |
1873 | A feature to report any failure to conform to \s-1ISO\s0 C might be useful in | |
1874 | some instances, but would require considerable additional work and would | |
1875 | be quite different from \fB\-pedantic\fR. We don't have plans to | |
1876 | support such a feature in the near future. | |
1877 | .Sp | |
1878 | Where the standard specified with \fB\-std\fR represents a \s-1GNU\s0 | |
1879 | extended dialect of C, such as \fBgnu89\fR or \fBgnu99\fR, there is a | |
1880 | corresponding \fIbase standard\fR, the version of \s-1ISO\s0 C on which the \s-1GNU\s0 | |
1881 | extended dialect is based. Warnings from \fB\-pedantic\fR are given | |
1882 | where they are required by the base standard. (It would not make sense | |
1883 | for such warnings to be given only for features not in the specified \s-1GNU\s0 | |
1884 | C dialect, since by definition the \s-1GNU\s0 dialects of C include all | |
1885 | features the compiler supports with the given option, and there would be | |
1886 | nothing to warn about.) | |
1887 | .IP "\fB\-pedantic\-errors\fR" 4 | |
1888 | .IX Item "-pedantic-errors" | |
1889 | Like \fB\-pedantic\fR, except that errors are produced rather than | |
1890 | warnings. | |
1891 | .IP "\fB\-w\fR" 4 | |
1892 | .IX Item "-w" | |
1893 | Inhibit all warning messages. | |
1894 | .IP "\fB\-Wno\-import\fR" 4 | |
1895 | .IX Item "-Wno-import" | |
1896 | Inhibit warning messages about the use of \fB#import\fR. | |
1897 | .IP "\fB\-Wchar\-subscripts\fR" 4 | |
1898 | .IX Item "-Wchar-subscripts" | |
1899 | Warn if an array subscript has type \f(CW\*(C`char\*(C'\fR. This is a common cause | |
1900 | of error, as programmers often forget that this type is signed on some | |
1901 | machines. | |
1902 | .IP "\fB\-Wcomment\fR" 4 | |
1903 | .IX Item "-Wcomment" | |
1904 | Warn whenever a comment-start sequence \fB/*\fR appears in a \fB/*\fR | |
1905 | comment, or whenever a Backslash-Newline appears in a \fB//\fR comment. | |
1906 | .IP "\fB\-Wformat\fR" 4 | |
1907 | .IX Item "-Wformat" | |
1908 | Check calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR, etc., to make sure that | |
1909 | the arguments supplied have types appropriate to the format string | |
1910 | specified, and that the conversions specified in the format string make | |
1911 | sense. This includes standard functions, and others specified by format | |
1912 | attributes, in the \f(CW\*(C`printf\*(C'\fR, | |
1913 | \&\f(CW\*(C`scanf\*(C'\fR, \f(CW\*(C`strftime\*(C'\fR and \f(CW\*(C`strfmon\*(C'\fR (an X/Open extension, | |
1914 | not in the C standard) families. | |
1915 | .Sp | |
1916 | The formats are checked against the format features supported by \s-1GNU\s0 | |
1917 | libc version 2.2. These include all \s-1ISO\s0 C90 and C99 features, as well | |
1918 | as features from the Single Unix Specification and some \s-1BSD\s0 and \s-1GNU\s0 | |
1919 | extensions. Other library implementations may not support all these | |
1920 | features; \s-1GCC\s0 does not support warning about features that go beyond a | |
1921 | particular library's limitations. However, if \fB\-pedantic\fR is used | |
1922 | with \fB\-Wformat\fR, warnings will be given about format features not | |
1923 | in the selected standard version (but not for \f(CW\*(C`strfmon\*(C'\fR formats, | |
1924 | since those are not in any version of the C standard). | |
1925 | .Sp | |
1926 | Since \fB\-Wformat\fR also checks for null format arguments for | |
1927 | several functions, \fB\-Wformat\fR also implies \fB\-Wnonnull\fR. | |
1928 | .Sp | |
1929 | \&\fB\-Wformat\fR is included in \fB\-Wall\fR. For more control over some | |
1930 | aspects of format checking, the options \fB\-Wformat\-y2k\fR, | |
1931 | \&\fB\-Wno\-format\-extra\-args\fR, \fB\-Wno\-format\-zero\-length\fR, | |
1932 | \&\fB\-Wformat\-nonliteral\fR, \fB\-Wformat\-security\fR, and | |
1933 | \&\fB\-Wformat=2\fR are available, but are not included in \fB\-Wall\fR. | |
1934 | .IP "\fB\-Wformat\-y2k\fR" 4 | |
1935 | .IX Item "-Wformat-y2k" | |
1936 | If \fB\-Wformat\fR is specified, also warn about \f(CW\*(C`strftime\*(C'\fR | |
1937 | formats which may yield only a two-digit year. | |
1938 | .IP "\fB\-Wno\-format\-extra\-args\fR" 4 | |
1939 | .IX Item "-Wno-format-extra-args" | |
1940 | If \fB\-Wformat\fR is specified, do not warn about excess arguments to a | |
1941 | \&\f(CW\*(C`printf\*(C'\fR or \f(CW\*(C`scanf\*(C'\fR format function. The C standard specifies | |
1942 | that such arguments are ignored. | |
1943 | .Sp | |
1944 | Where the unused arguments lie between used arguments that are | |
1945 | specified with \fB$\fR operand number specifications, normally | |
1946 | warnings are still given, since the implementation could not know what | |
1947 | type to pass to \f(CW\*(C`va_arg\*(C'\fR to skip the unused arguments. However, | |
1948 | in the case of \f(CW\*(C`scanf\*(C'\fR formats, this option will suppress the | |
1949 | warning if the unused arguments are all pointers, since the Single | |
1950 | Unix Specification says that such unused arguments are allowed. | |
1951 | .IP "\fB\-Wno\-format\-zero\-length\fR" 4 | |
1952 | .IX Item "-Wno-format-zero-length" | |
1953 | If \fB\-Wformat\fR is specified, do not warn about zero-length formats. | |
1954 | The C standard specifies that zero-length formats are allowed. | |
1955 | .IP "\fB\-Wformat\-nonliteral\fR" 4 | |
1956 | .IX Item "-Wformat-nonliteral" | |
1957 | If \fB\-Wformat\fR is specified, also warn if the format string is not a | |
1958 | string literal and so cannot be checked, unless the format function | |
1959 | takes its format arguments as a \f(CW\*(C`va_list\*(C'\fR. | |
1960 | .IP "\fB\-Wformat\-security\fR" 4 | |
1961 | .IX Item "-Wformat-security" | |
1962 | If \fB\-Wformat\fR is specified, also warn about uses of format | |
1963 | functions that represent possible security problems. At present, this | |
1964 | warns about calls to \f(CW\*(C`printf\*(C'\fR and \f(CW\*(C`scanf\*(C'\fR functions where the | |
1965 | format string is not a string literal and there are no format arguments, | |
1966 | as in \f(CW\*(C`printf (foo);\*(C'\fR. This may be a security hole if the format | |
1967 | string came from untrusted input and contains \fB%n\fR. (This is | |
1968 | currently a subset of what \fB\-Wformat\-nonliteral\fR warns about, but | |
1969 | in future warnings may be added to \fB\-Wformat\-security\fR that are not | |
1970 | included in \fB\-Wformat\-nonliteral\fR.) | |
1971 | .IP "\fB\-Wformat=2\fR" 4 | |
1972 | .IX Item "-Wformat=2" | |
1973 | Enable \fB\-Wformat\fR plus format checks not included in | |
1974 | \&\fB\-Wformat\fR. Currently equivalent to \fB\-Wformat | |
1975 | \&\-Wformat\-nonliteral \-Wformat\-security \-Wformat\-y2k\fR. | |
1976 | .IP "\fB\-Wnonnull\fR" 4 | |
1977 | .IX Item "-Wnonnull" | |
1978 | Warn about passing a null pointer for arguments marked as | |
1979 | requiring a non-null value by the \f(CW\*(C`nonnull\*(C'\fR function attribute. | |
1980 | .Sp | |
1981 | \&\fB\-Wnonnull\fR is included in \fB\-Wall\fR and \fB\-Wformat\fR. It | |
1982 | can be disabled with the \fB\-Wno\-nonnull\fR option. | |
1983 | .IP "\fB\-Winit\-self\fR (C, \*(C+, and Objective-C only)" 4 | |
1984 | .IX Item "-Winit-self (C, , and Objective-C only)" | |
1985 | Warn about uninitialized variables which are initialized with themselves. | |
1986 | Note this option can only be used with the \fB\-Wuninitialized\fR option, | |
1987 | which in turn only works with \fB\-O1\fR and above. | |
1988 | .Sp | |
1989 | For example, \s-1GCC\s0 will warn about \f(CW\*(C`i\*(C'\fR being uninitialized in the | |
1990 | following snippet only when \fB\-Winit\-self\fR has been specified: | |
1991 | .Sp | |
1992 | .Vb 5 | |
1993 | \& int f() | |
1994 | \& { | |
1995 | \& int i = i; | |
1996 | \& return i; | |
1997 | \& } | |
1998 | .Ve | |
1999 | .IP "\fB\-Wimplicit\-int\fR" 4 | |
2000 | .IX Item "-Wimplicit-int" | |
2001 | Warn when a declaration does not specify a type. | |
2002 | .IP "\fB\-Wimplicit\-function\-declaration\fR" 4 | |
2003 | .IX Item "-Wimplicit-function-declaration" | |
2004 | .PD 0 | |
2005 | .IP "\fB\-Werror\-implicit\-function\-declaration\fR" 4 | |
2006 | .IX Item "-Werror-implicit-function-declaration" | |
2007 | .PD | |
2008 | Give a warning (or error) whenever a function is used before being | |
2009 | declared. | |
2010 | .IP "\fB\-Wimplicit\fR" 4 | |
2011 | .IX Item "-Wimplicit" | |
2012 | Same as \fB\-Wimplicit\-int\fR and \fB\-Wimplicit\-function\-declaration\fR. | |
2013 | .IP "\fB\-Wmain\fR" 4 | |
2014 | .IX Item "-Wmain" | |
2015 | Warn if the type of \fBmain\fR is suspicious. \fBmain\fR should be a | |
2016 | function with external linkage, returning int, taking either zero | |
2017 | arguments, two, or three arguments of appropriate types. | |
2018 | .IP "\fB\-Wmissing\-braces\fR" 4 | |
2019 | .IX Item "-Wmissing-braces" | |
2020 | Warn if an aggregate or union initializer is not fully bracketed. In | |
2021 | the following example, the initializer for \fBa\fR is not fully | |
2022 | bracketed, but that for \fBb\fR is fully bracketed. | |
2023 | .Sp | |
2024 | .Vb 2 | |
2025 | \& int a[2][2] = { 0, 1, 2, 3 }; | |
2026 | \& int b[2][2] = { { 0, 1 }, { 2, 3 } }; | |
2027 | .Ve | |
2028 | .IP "\fB\-Wparentheses\fR" 4 | |
2029 | .IX Item "-Wparentheses" | |
2030 | Warn if parentheses are omitted in certain contexts, such | |
2031 | as when there is an assignment in a context where a truth value | |
2032 | is expected, or when operators are nested whose precedence people | |
2033 | often get confused about. | |
2034 | .Sp | |
2035 | Also warn about constructions where there may be confusion to which | |
2036 | \&\f(CW\*(C`if\*(C'\fR statement an \f(CW\*(C`else\*(C'\fR branch belongs. Here is an example of | |
2037 | such a case: | |
2038 | .Sp | |
2039 | .Vb 7 | |
2040 | \& { | |
2041 | \& if (a) | |
2042 | \& if (b) | |
2043 | \& foo (); | |
2044 | \& else | |
2045 | \& bar (); | |
2046 | \& } | |
2047 | .Ve | |
2048 | .Sp | |
2049 | In C, every \f(CW\*(C`else\*(C'\fR branch belongs to the innermost possible \f(CW\*(C`if\*(C'\fR | |
2050 | statement, which in this example is \f(CW\*(C`if (b)\*(C'\fR. This is often not | |
2051 | what the programmer expected, as illustrated in the above example by | |
2052 | indentation the programmer chose. When there is the potential for this | |
2053 | confusion, \s-1GCC\s0 will issue a warning when this flag is specified. | |
2054 | To eliminate the warning, add explicit braces around the innermost | |
2055 | \&\f(CW\*(C`if\*(C'\fR statement so there is no way the \f(CW\*(C`else\*(C'\fR could belong to | |
2056 | the enclosing \f(CW\*(C`if\*(C'\fR. The resulting code would look like this: | |
2057 | .Sp | |
2058 | .Vb 9 | |
2059 | \& { | |
2060 | \& if (a) | |
2061 | \& { | |
2062 | \& if (b) | |
2063 | \& foo (); | |
2064 | \& else | |
2065 | \& bar (); | |
2066 | \& } | |
2067 | \& } | |
2068 | .Ve | |
2069 | .IP "\fB\-Wsequence\-point\fR" 4 | |
2070 | .IX Item "-Wsequence-point" | |
2071 | Warn about code that may have undefined semantics because of violations | |
2072 | of sequence point rules in the C standard. | |
2073 | .Sp | |
2074 | The C standard defines the order in which expressions in a C program are | |
2075 | evaluated in terms of \fIsequence points\fR, which represent a partial | |
2076 | ordering between the execution of parts of the program: those executed | |
2077 | before the sequence point, and those executed after it. These occur | |
2078 | after the evaluation of a full expression (one which is not part of a | |
2079 | larger expression), after the evaluation of the first operand of a | |
2080 | \&\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 | |
2081 | function is called (but after the evaluation of its arguments and the | |
2082 | expression denoting the called function), and in certain other places. | |
2083 | Other than as expressed by the sequence point rules, the order of | |
2084 | evaluation of subexpressions of an expression is not specified. All | |
2085 | these rules describe only a partial order rather than a total order, | |
2086 | since, for example, if two functions are called within one expression | |
2087 | with no sequence point between them, the order in which the functions | |
2088 | are called is not specified. However, the standards committee have | |
2089 | ruled that function calls do not overlap. | |
2090 | .Sp | |
2091 | It is not specified when between sequence points modifications to the | |
2092 | values of objects take effect. Programs whose behavior depends on this | |
2093 | have undefined behavior; the C standard specifies that ``Between the | |
2094 | previous and next sequence point an object shall have its stored value | |
2095 | modified at most once by the evaluation of an expression. Furthermore, | |
2096 | the prior value shall be read only to determine the value to be | |
2097 | stored.''. If a program breaks these rules, the results on any | |
2098 | particular implementation are entirely unpredictable. | |
2099 | .Sp | |
2100 | Examples of code with undefined behavior are \f(CW\*(C`a = a++;\*(C'\fR, \f(CW\*(C`a[n] | |
2101 | = b[n++]\*(C'\fR and \f(CW\*(C`a[i++] = i;\*(C'\fR. Some more complicated cases are not | |
2102 | diagnosed by this option, and it may give an occasional false positive | |
2103 | result, but in general it has been found fairly effective at detecting | |
2104 | this sort of problem in programs. | |
2105 | .Sp | |
2106 | The present implementation of this option only works for C programs. A | |
2107 | future implementation may also work for \*(C+ programs. | |
2108 | .Sp | |
2109 | The C standard is worded confusingly, therefore there is some debate | |
2110 | over the precise meaning of the sequence point rules in subtle cases. | |
2111 | Links to discussions of the problem, including proposed formal | |
2112 | definitions, may be found on the \s-1GCC\s0 readings page, at | |
2113 | <\fBhttp://gcc.gnu.org/readings.html\fR>. | |
2114 | .IP "\fB\-Wreturn\-type\fR" 4 | |
2115 | .IX Item "-Wreturn-type" | |
2116 | Warn whenever a function is defined with a return-type that defaults to | |
2117 | \&\f(CW\*(C`int\*(C'\fR. Also warn about any \f(CW\*(C`return\*(C'\fR statement with no | |
2118 | return-value in a function whose return-type is not \f(CW\*(C`void\*(C'\fR. | |
2119 | .Sp | |
2120 | For \*(C+, a function without return type always produces a diagnostic | |
2121 | message, even when \fB\-Wno\-return\-type\fR is specified. The only | |
2122 | exceptions are \fBmain\fR and functions defined in system headers. | |
2123 | .IP "\fB\-Wswitch\fR" 4 | |
2124 | .IX Item "-Wswitch" | |
2125 | Warn whenever a \f(CW\*(C`switch\*(C'\fR statement has an index of enumerated type | |
2126 | and lacks a \f(CW\*(C`case\*(C'\fR for one or more of the named codes of that | |
2127 | enumeration. (The presence of a \f(CW\*(C`default\*(C'\fR label prevents this | |
2128 | warning.) \f(CW\*(C`case\*(C'\fR labels outside the enumeration range also | |
2129 | provoke warnings when this option is used. | |
2130 | .IP "\fB\-Wswitch\-default\fR" 4 | |
2131 | .IX Item "-Wswitch-default" | |
2132 | Warn whenever a \f(CW\*(C`switch\*(C'\fR statement does not have a \f(CW\*(C`default\*(C'\fR | |
2133 | case. | |
2134 | .IP "\fB\-Wswitch\-enum\fR" 4 | |
2135 | .IX Item "-Wswitch-enum" | |
2136 | Warn whenever a \f(CW\*(C`switch\*(C'\fR statement has an index of enumerated type | |
2137 | and lacks a \f(CW\*(C`case\*(C'\fR for one or more of the named codes of that | |
2138 | enumeration. \f(CW\*(C`case\*(C'\fR labels outside the enumeration range also | |
2139 | provoke warnings when this option is used. | |
2140 | .IP "\fB\-Wtrigraphs\fR" 4 | |
2141 | .IX Item "-Wtrigraphs" | |
2142 | Warn if any trigraphs are encountered that might change the meaning of | |
2143 | the program (trigraphs within comments are not warned about). | |
2144 | .IP "\fB\-Wunused\-function\fR" 4 | |
2145 | .IX Item "-Wunused-function" | |
2146 | Warn whenever a static function is declared but not defined or a | |
2147 | non\e\-inline static function is unused. | |
2148 | .IP "\fB\-Wunused\-label\fR" 4 | |
2149 | .IX Item "-Wunused-label" | |
2150 | Warn whenever a label is declared but not used. | |
2151 | .Sp | |
2152 | To suppress this warning use the \fBunused\fR attribute. | |
2153 | .IP "\fB\-Wunused\-parameter\fR" 4 | |
2154 | .IX Item "-Wunused-parameter" | |
2155 | Warn whenever a function parameter is unused aside from its declaration. | |
2156 | .Sp | |
2157 | To suppress this warning use the \fBunused\fR attribute. | |
2158 | .IP "\fB\-Wunused\-variable\fR" 4 | |
2159 | .IX Item "-Wunused-variable" | |
2160 | Warn whenever a local variable or non-constant static variable is unused | |
2161 | aside from its declaration | |
2162 | .Sp | |
2163 | To suppress this warning use the \fBunused\fR attribute. | |
2164 | .IP "\fB\-Wunused\-value\fR" 4 | |
2165 | .IX Item "-Wunused-value" | |
2166 | Warn whenever a statement computes a result that is explicitly not used. | |
2167 | .Sp | |
2168 | To suppress this warning cast the expression to \fBvoid\fR. | |
2169 | .IP "\fB\-Wunused\fR" 4 | |
2170 | .IX Item "-Wunused" | |
2171 | All the above \fB\-Wunused\fR options combined. | |
2172 | .Sp | |
2173 | In order to get a warning about an unused function parameter, you must | |
2174 | either specify \fB\-Wextra \-Wunused\fR (note that \fB\-Wall\fR implies | |
2175 | \&\fB\-Wunused\fR), or separately specify \fB\-Wunused\-parameter\fR. | |
2176 | .IP "\fB\-Wuninitialized\fR" 4 | |
2177 | .IX Item "-Wuninitialized" | |
2178 | Warn if an automatic variable is used without first being initialized or | |
2179 | if a variable may be clobbered by a \f(CW\*(C`setjmp\*(C'\fR call. | |
2180 | .Sp | |
2181 | These warnings are possible only in optimizing compilation, | |
2182 | because they require data flow information that is computed only | |
2183 | when optimizing. If you don't specify \fB\-O\fR, you simply won't | |
2184 | get these warnings. | |
2185 | .Sp | |
2186 | If you want to warn about code which uses the uninitialized value of the | |
2187 | variable in its own initializer, use the \fB\-Winit\-self\fR option. | |
2188 | .Sp | |
2189 | These warnings occur only for variables that are candidates for | |
2190 | register allocation. Therefore, they do not occur for a variable that | |
2191 | is declared \f(CW\*(C`volatile\*(C'\fR, or whose address is taken, or whose size | |
2192 | is other than 1, 2, 4 or 8 bytes. Also, they do not occur for | |
2193 | structures, unions or arrays, even when they are in registers. | |
2194 | .Sp | |
2195 | Note that there may be no warning about a variable that is used only | |
2196 | to compute a value that itself is never used, because such | |
2197 | computations may be deleted by data flow analysis before the warnings | |
2198 | are printed. | |
2199 | .Sp | |
2200 | These warnings are made optional because \s-1GCC\s0 is not smart | |
2201 | enough to see all the reasons why the code might be correct | |
2202 | despite appearing to have an error. Here is one example of how | |
2203 | this can happen: | |
2204 | .Sp | |
2205 | .Vb 12 | |
2206 | \& { | |
2207 | \& int x; | |
2208 | \& switch (y) | |
2209 | \& { | |
2210 | \& case 1: x = 1; | |
2211 | \& break; | |
2212 | \& case 2: x = 4; | |
2213 | \& break; | |
2214 | \& case 3: x = 5; | |
2215 | \& } | |
2216 | \& foo (x); | |
2217 | \& } | |
2218 | .Ve | |
2219 | .Sp | |
2220 | If the value of \f(CW\*(C`y\*(C'\fR is always 1, 2 or 3, then \f(CW\*(C`x\*(C'\fR is | |
2221 | always initialized, but \s-1GCC\s0 doesn't know this. Here is | |
2222 | another common case: | |
2223 | .Sp | |
2224 | .Vb 6 | |
2225 | \& { | |
2226 | \& int save_y; | |
2227 | \& if (change_y) save_y = y, y = new_y; | |
2228 | \& ... | |
2229 | \& if (change_y) y = save_y; | |
2230 | \& } | |
2231 | .Ve | |
2232 | .Sp | |
2233 | This has no bug because \f(CW\*(C`save_y\*(C'\fR is used only if it is set. | |
2234 | .Sp | |
2235 | This option also warns when a non-volatile automatic variable might be | |
2236 | changed by a call to \f(CW\*(C`longjmp\*(C'\fR. These warnings as well are possible | |
2237 | only in optimizing compilation. | |
2238 | .Sp | |
2239 | The compiler sees only the calls to \f(CW\*(C`setjmp\*(C'\fR. It cannot know | |
2240 | where \f(CW\*(C`longjmp\*(C'\fR will be called; in fact, a signal handler could | |
2241 | call it at any point in the code. As a result, you may get a warning | |
2242 | even when there is in fact no problem because \f(CW\*(C`longjmp\*(C'\fR cannot | |
2243 | in fact be called at the place which would cause a problem. | |
2244 | .Sp | |
2245 | Some spurious warnings can be avoided if you declare all the functions | |
2246 | you use that never return as \f(CW\*(C`noreturn\*(C'\fR. | |
2247 | .IP "\fB\-Wunknown\-pragmas\fR" 4 | |
2248 | .IX Item "-Wunknown-pragmas" | |
2249 | Warn when a #pragma directive is encountered which is not understood by | |
2250 | \&\s-1GCC\s0. If this command line option is used, warnings will even be issued | |
2251 | for unknown pragmas in system header files. This is not the case if | |
2252 | the warnings were only enabled by the \fB\-Wall\fR command line option. | |
2253 | .IP "\fB\-Wstrict\-aliasing\fR" 4 | |
2254 | .IX Item "-Wstrict-aliasing" | |
2255 | This option is only active when \fB\-fstrict\-aliasing\fR is active. | |
2256 | It warns about code which might break the strict aliasing rules that the | |
2257 | compiler is using for optimization. The warning does not catch all | |
2258 | cases, but does attempt to catch the more common pitfalls. It is | |
2259 | included in \fB\-Wall\fR. | |
2260 | .IP "\fB\-Wall\fR" 4 | |
2261 | .IX Item "-Wall" | |
2262 | All of the above \fB\-W\fR options combined. This enables all the | |
2263 | warnings about constructions that some users consider questionable, and | |
2264 | that are easy to avoid (or modify to prevent the warning), even in | |
2265 | conjunction with macros. This also enables some language-specific | |
2266 | warnings described in \fB\*(C+ Dialect Options\fR and | |
2267 | \&\fBObjective-C Dialect Options\fR. | |
2268 | .PP | |
2269 | The following \fB\-W...\fR options are not implied by \fB\-Wall\fR. | |
2270 | Some of them warn about constructions that users generally do not | |
2271 | consider questionable, but which occasionally you might wish to check | |
2272 | for; others warn about constructions that are necessary or hard to avoid | |
2273 | in some cases, and there is no simple way to modify the code to suppress | |
2274 | the warning. | |
2275 | .IP "\fB\-Wextra\fR" 4 | |
2276 | .IX Item "-Wextra" | |
2277 | (This option used to be called \fB\-W\fR. The older name is still | |
2278 | supported, but the newer name is more descriptive.) Print extra warning | |
2279 | messages for these events: | |
2280 | .RS 4 | |
2281 | .IP "*" 4 | |
2282 | A function can return either with or without a value. (Falling | |
2283 | off the end of the function body is considered returning without | |
2284 | a value.) For example, this function would evoke such a | |
2285 | warning: | |
2286 | .Sp | |
2287 | .Vb 5 | |
2288 | \& foo (a) | |
2289 | \& { | |
2290 | \& if (a > 0) | |
2291 | \& return a; | |
2292 | \& } | |
2293 | .Ve | |
2294 | .IP "*" 4 | |
2295 | An expression-statement or the left-hand side of a comma expression | |
2296 | contains no side effects. | |
2297 | To suppress the warning, cast the unused expression to void. | |
2298 | For example, an expression such as \fBx[i,j]\fR will cause a warning, | |
2299 | but \fBx[(void)i,j]\fR will not. | |
2300 | .IP "*" 4 | |
2301 | An unsigned value is compared against zero with \fB<\fR or \fB>=\fR. | |
2302 | .IP "*" 4 | |
2303 | A comparison like \fBx<=y<=z\fR appears; this is equivalent to | |
2304 | \&\fB(x<=y ? 1 : 0) <= z\fR, which is a different interpretation from | |
2305 | that of ordinary mathematical notation. | |
2306 | .IP "*" 4 | |
2307 | Storage-class specifiers like \f(CW\*(C`static\*(C'\fR are not the first things in | |
2308 | a declaration. According to the C Standard, this usage is obsolescent. | |
2309 | .IP "*" 4 | |
2310 | The return type of a function has a type qualifier such as \f(CW\*(C`const\*(C'\fR. | |
2311 | Such a type qualifier has no effect, since the value returned by a | |
2312 | function is not an lvalue. (But don't warn about the \s-1GNU\s0 extension of | |
2313 | \&\f(CW\*(C`volatile void\*(C'\fR return types. That extension will be warned about | |
2314 | if \fB\-pedantic\fR is specified.) | |
2315 | .IP "*" 4 | |
2316 | If \fB\-Wall\fR or \fB\-Wunused\fR is also specified, warn about unused | |
2317 | arguments. | |
2318 | .IP "*" 4 | |
2319 | A comparison between signed and unsigned values could produce an | |
2320 | incorrect result when the signed value is converted to unsigned. | |
2321 | (But don't warn if \fB\-Wno\-sign\-compare\fR is also specified.) | |
2322 | .IP "*" 4 | |
2323 | An aggregate has an initializer which does not initialize all members. | |
2324 | For example, the following code would cause such a warning, because | |
2325 | \&\f(CW\*(C`x.h\*(C'\fR would be implicitly initialized to zero: | |
2326 | .Sp | |
2327 | .Vb 2 | |
2328 | \& struct s { int f, g, h; }; | |
2329 | \& struct s x = { 3, 4 }; | |
2330 | .Ve | |
2331 | .IP "*" 4 | |
2332 | A function parameter is declared without a type specifier in K&R\-style | |
2333 | functions: | |
2334 | .Sp | |
2335 | .Vb 1 | |
2336 | \& void foo(bar) { } | |
2337 | .Ve | |
2338 | .IP "*" 4 | |
2339 | An empty body occurs in an \fBif\fR or \fBelse\fR statement. | |
2340 | .IP "*" 4 | |
2341 | A pointer is compared against integer zero with \fB<\fR, \fB<=\fR, | |
2342 | \&\fB>\fR, or \fB>=\fR. | |
2343 | .IP "*" 4 | |
2344 | A variable might be changed by \fBlongjmp\fR or \fBvfork\fR. | |
2345 | .IP "*" 4 | |
2346 | Any of several floating-point events that often indicate errors, such as | |
2347 | overflow, underflow, loss of precision, etc. | |
2348 | .IP "*<(\*(C+ only)>" 4 | |
2349 | .IX Item "*<( only)>" | |
2350 | An enumerator and a non-enumerator both appear in a conditional expression. | |
2351 | .IP "*<(\*(C+ only)>" 4 | |
2352 | .IX Item "*<( only)>" | |
2353 | A non-static reference or non-static \fBconst\fR member appears in a | |
2354 | class without constructors. | |
2355 | .IP "*<(\*(C+ only)>" 4 | |
2356 | .IX Item "*<( only)>" | |
2357 | Ambiguous virtual bases. | |
2358 | .IP "*<(\*(C+ only)>" 4 | |
2359 | .IX Item "*<( only)>" | |
2360 | Subscripting an array which has been declared \fBregister\fR. | |
2361 | .IP "*<(\*(C+ only)>" 4 | |
2362 | .IX Item "*<( only)>" | |
2363 | Taking the address of a variable which has been declared \fBregister\fR. | |
2364 | .IP "*<(\*(C+ only)>" 4 | |
2365 | .IX Item "*<( only)>" | |
2366 | A base class is not initialized in a derived class' copy constructor. | |
2367 | .RE | |
2368 | .RS 4 | |
2369 | .RE | |
2370 | .IP "\fB\-Wno\-div\-by\-zero\fR" 4 | |
2371 | .IX Item "-Wno-div-by-zero" | |
2372 | Do not warn about compile-time integer division by zero. Floating point | |
2373 | division by zero is not warned about, as it can be a legitimate way of | |
2374 | obtaining infinities and NaNs. | |
2375 | .IP "\fB\-Wsystem\-headers\fR" 4 | |
2376 | .IX Item "-Wsystem-headers" | |
2377 | Print warning messages for constructs found in system header files. | |
2378 | Warnings from system headers are normally suppressed, on the assumption | |
2379 | that they usually do not indicate real problems and would only make the | |
2380 | compiler output harder to read. Using this command line option tells | |
2381 | \&\s-1GCC\s0 to emit warnings from system headers as if they occurred in user | |
2382 | code. However, note that using \fB\-Wall\fR in conjunction with this | |
2383 | option will \fInot\fR warn about unknown pragmas in system | |
2384 | headers\-\-\-for that, \fB\-Wunknown\-pragmas\fR must also be used. | |
2385 | .IP "\fB\-Wfloat\-equal\fR" 4 | |
2386 | .IX Item "-Wfloat-equal" | |
2387 | Warn if floating point values are used in equality comparisons. | |
2388 | .Sp | |
2389 | The idea behind this is that sometimes it is convenient (for the | |
2390 | programmer) to consider floating-point values as approximations to | |
2391 | infinitely precise real numbers. If you are doing this, then you need | |
2392 | to compute (by analyzing the code, or in some other way) the maximum or | |
2393 | likely maximum error that the computation introduces, and allow for it | |
2394 | when performing comparisons (and when producing output, but that's a | |
2395 | different problem). In particular, instead of testing for equality, you | |
2396 | would check to see whether the two values have ranges that overlap; and | |
2397 | this is done with the relational operators, so equality comparisons are | |
2398 | probably mistaken. | |
2399 | .IP "\fB\-Wtraditional\fR (C only)" 4 | |
2400 | .IX Item "-Wtraditional (C only)" | |
2401 | Warn about certain constructs that behave differently in traditional and | |
2402 | \&\s-1ISO\s0 C. Also warn about \s-1ISO\s0 C constructs that have no traditional C | |
2403 | equivalent, and/or problematic constructs which should be avoided. | |
2404 | .RS 4 | |
2405 | .IP "*" 4 | |
2406 | Macro parameters that appear within string literals in the macro body. | |
2407 | In traditional C macro replacement takes place within string literals, | |
2408 | but does not in \s-1ISO\s0 C. | |
2409 | .IP "*" 4 | |
2410 | In traditional C, some preprocessor directives did not exist. | |
2411 | Traditional preprocessors would only consider a line to be a directive | |
2412 | if the \fB#\fR appeared in column 1 on the line. Therefore | |
2413 | \&\fB\-Wtraditional\fR warns about directives that traditional C | |
2414 | understands but would ignore because the \fB#\fR does not appear as the | |
2415 | first character on the line. It also suggests you hide directives like | |
2416 | \&\fB#pragma\fR not understood by traditional C by indenting them. Some | |
2417 | traditional implementations would not recognize \fB#elif\fR, so it | |
2418 | suggests avoiding it altogether. | |
2419 | .IP "*" 4 | |
2420 | A function-like macro that appears without arguments. | |
2421 | .IP "*" 4 | |
2422 | The unary plus operator. | |
2423 | .IP "*" 4 | |
2424 | The \fBU\fR integer constant suffix, or the \fBF\fR or \fBL\fR floating point | |
2425 | constant suffixes. (Traditional C does support the \fBL\fR suffix on integer | |
2426 | constants.) Note, these suffixes appear in macros defined in the system | |
2427 | headers of most modern systems, e.g. the \fB_MIN\fR/\fB_MAX\fR macros in \f(CW\*(C`<limits.h>\*(C'\fR. | |
2428 | Use of these macros in user code might normally lead to spurious | |
2429 | warnings, however \s-1GCC\s0's integrated preprocessor has enough context to | |
2430 | avoid warning in these cases. | |
2431 | .IP "*" 4 | |
2432 | A function declared external in one block and then used after the end of | |
2433 | the block. | |
2434 | .IP "*" 4 | |
2435 | A \f(CW\*(C`switch\*(C'\fR statement has an operand of type \f(CW\*(C`long\*(C'\fR. | |
2436 | .IP "*" 4 | |
2437 | A non\-\f(CW\*(C`static\*(C'\fR function declaration follows a \f(CW\*(C`static\*(C'\fR one. | |
2438 | This construct is not accepted by some traditional C compilers. | |
2439 | .IP "*" 4 | |
2440 | The \s-1ISO\s0 type of an integer constant has a different width or | |
2441 | signedness from its traditional type. This warning is only issued if | |
2442 | the base of the constant is ten. I.e. hexadecimal or octal values, which | |
2443 | typically represent bit patterns, are not warned about. | |
2444 | .IP "*" 4 | |
2445 | Usage of \s-1ISO\s0 string concatenation is detected. | |
2446 | .IP "*" 4 | |
2447 | Initialization of automatic aggregates. | |
2448 | .IP "*" 4 | |
2449 | Identifier conflicts with labels. Traditional C lacks a separate | |
2450 | namespace for labels. | |
2451 | .IP "*" 4 | |
2452 | Initialization of unions. If the initializer is zero, the warning is | |
2453 | omitted. This is done under the assumption that the zero initializer in | |
2454 | user code appears conditioned on e.g. \f(CW\*(C`_\|_STDC_\|_\*(C'\fR to avoid missing | |
2455 | initializer warnings and relies on default initialization to zero in the | |
2456 | traditional C case. | |
2457 | .IP "*" 4 | |
2458 | Conversions by prototypes between fixed/floating point values and vice | |
2459 | versa. The absence of these prototypes when compiling with traditional | |
2460 | C would cause serious problems. This is a subset of the possible | |
2461 | conversion warnings, for the full set use \fB\-Wconversion\fR. | |
2462 | .IP "*" 4 | |
2463 | Use of \s-1ISO\s0 C style function definitions. This warning intentionally is | |
2464 | \&\fInot\fR issued for prototype declarations or variadic functions | |
2465 | because these \s-1ISO\s0 C features will appear in your code when using | |
2466 | libiberty's traditional C compatibility macros, \f(CW\*(C`PARAMS\*(C'\fR and | |
2467 | \&\f(CW\*(C`VPARAMS\*(C'\fR. This warning is also bypassed for nested functions | |
2468 | because that feature is already a \s-1GCC\s0 extension and thus not relevant to | |
2469 | traditional C compatibility. | |
2470 | .RE | |
2471 | .RS 4 | |
2472 | .RE | |
2473 | .IP "\fB\-Wdeclaration\-after\-statement\fR (C only)" 4 | |
2474 | .IX Item "-Wdeclaration-after-statement (C only)" | |
2475 | Warn when a declaration is found after a statement in a block. This | |
2476 | construct, known from \*(C+, was introduced with \s-1ISO\s0 C99 and is by default | |
2477 | allowed in \s-1GCC\s0. It is not supported by \s-1ISO\s0 C90 and was not supported by | |
2478 | \&\s-1GCC\s0 versions before \s-1GCC\s0 3.0. | |
2479 | .IP "\fB\-Wundef\fR" 4 | |
2480 | .IX Item "-Wundef" | |
2481 | Warn if an undefined identifier is evaluated in an \fB#if\fR directive. | |
2482 | .IP "\fB\-Wendif\-labels\fR" 4 | |
2483 | .IX Item "-Wendif-labels" | |
2484 | Warn whenever an \fB#else\fR or an \fB#endif\fR are followed by text. | |
2485 | .IP "\fB\-Wshadow\fR" 4 | |
2486 | .IX Item "-Wshadow" | |
2487 | Warn whenever a local variable shadows another local variable, parameter or | |
2488 | global variable or whenever a built-in function is shadowed. | |
2489 | .IP "\fB\-Wlarger\-than\-\fR\fIlen\fR" 4 | |
2490 | .IX Item "-Wlarger-than-len" | |
2491 | Warn whenever an object of larger than \fIlen\fR bytes is defined. | |
2492 | .IP "\fB\-Wpointer\-arith\fR" 4 | |
2493 | .IX Item "-Wpointer-arith" | |
2494 | Warn about anything that depends on the ``size of'' a function type or | |
2495 | of \f(CW\*(C`void\*(C'\fR. \s-1GNU\s0 C assigns these types a size of 1, for | |
2496 | convenience in calculations with \f(CW\*(C`void *\*(C'\fR pointers and pointers | |
2497 | to functions. | |
2498 | .IP "\fB\-Wbad\-function\-cast\fR (C only)" 4 | |
2499 | .IX Item "-Wbad-function-cast (C only)" | |
2500 | Warn whenever a function call is cast to a non-matching type. | |
2501 | For example, warn if \f(CW\*(C`int malloc()\*(C'\fR is cast to \f(CW\*(C`anything *\*(C'\fR. | |
2502 | .IP "\fB\-Wcast\-qual\fR" 4 | |
2503 | .IX Item "-Wcast-qual" | |
2504 | Warn whenever a pointer is cast so as to remove a type qualifier from | |
2505 | the target type. For example, warn if a \f(CW\*(C`const char *\*(C'\fR is cast | |
2506 | to an ordinary \f(CW\*(C`char *\*(C'\fR. | |
2507 | .IP "\fB\-Wcast\-align\fR" 4 | |
2508 | .IX Item "-Wcast-align" | |
2509 | Warn whenever a pointer is cast such that the required alignment of the | |
2510 | target is increased. For example, warn if a \f(CW\*(C`char *\*(C'\fR is cast to | |
2511 | an \f(CW\*(C`int *\*(C'\fR on machines where integers can only be accessed at | |
2512 | two\- or four-byte boundaries. | |
2513 | .IP "\fB\-Wwrite\-strings\fR" 4 | |
2514 | .IX Item "-Wwrite-strings" | |
2515 | When compiling C, give string constants the type \f(CW\*(C`const | |
2516 | char[\f(CIlength\f(CW]\*(C'\fR so that | |
2517 | copying the address of one into a non\-\f(CW\*(C`const\*(C'\fR \f(CW\*(C`char *\*(C'\fR | |
2518 | pointer will get a warning; when compiling \*(C+, warn about the | |
2519 | deprecated conversion from string constants to \f(CW\*(C`char *\*(C'\fR. | |
2520 | These warnings will help you find at | |
2521 | compile time code that can try to write into a string constant, but | |
2522 | only if you have been very careful about using \f(CW\*(C`const\*(C'\fR in | |
2523 | declarations and prototypes. Otherwise, it will just be a nuisance; | |
2524 | this is why we did not make \fB\-Wall\fR request these warnings. | |
2525 | .IP "\fB\-Wconversion\fR" 4 | |
2526 | .IX Item "-Wconversion" | |
2527 | Warn if a prototype causes a type conversion that is different from what | |
2528 | would happen to the same argument in the absence of a prototype. This | |
2529 | includes conversions of fixed point to floating and vice versa, and | |
2530 | conversions changing the width or signedness of a fixed point argument | |
2531 | except when the same as the default promotion. | |
2532 | .Sp | |
2533 | Also, warn if a negative integer constant expression is implicitly | |
2534 | converted to an unsigned type. For example, warn about the assignment | |
2535 | \&\f(CW\*(C`x = \-1\*(C'\fR if \f(CW\*(C`x\*(C'\fR is unsigned. But do not warn about explicit | |
2536 | casts like \f(CW\*(C`(unsigned) \-1\*(C'\fR. | |
2537 | .IP "\fB\-Wsign\-compare\fR" 4 | |
2538 | .IX Item "-Wsign-compare" | |
2539 | Warn when a comparison between signed and unsigned values could produce | |
2540 | an incorrect result when the signed value is converted to unsigned. | |
2541 | This warning is also enabled by \fB\-Wextra\fR; to get the other warnings | |
2542 | of \fB\-Wextra\fR without this warning, use \fB\-Wextra \-Wno\-sign\-compare\fR. | |
2543 | .IP "\fB\-Waggregate\-return\fR" 4 | |
2544 | .IX Item "-Waggregate-return" | |
2545 | Warn if any functions that return structures or unions are defined or | |
2546 | called. (In languages where you can return an array, this also elicits | |
2547 | a warning.) | |
2548 | .IP "\fB\-Wstrict\-prototypes\fR (C only)" 4 | |
2549 | .IX Item "-Wstrict-prototypes (C only)" | |
2550 | Warn if a function is declared or defined without specifying the | |
2551 | argument types. (An old-style function definition is permitted without | |
2552 | a warning if preceded by a declaration which specifies the argument | |
2553 | types.) | |
2554 | .IP "\fB\-Wold\-style\-definition\fR (C only)" 4 | |
2555 | .IX Item "-Wold-style-definition (C only)" | |
2556 | Warn if an old-style function definition is used. A warning is given | |
2557 | even if there is a previous prototype. | |
2558 | .IP "\fB\-Wmissing\-prototypes\fR (C only)" 4 | |
2559 | .IX Item "-Wmissing-prototypes (C only)" | |
2560 | Warn if a global function is defined without a previous prototype | |
2561 | declaration. This warning is issued even if the definition itself | |
2562 | provides a prototype. The aim is to detect global functions that fail | |
2563 | to be declared in header files. | |
2564 | .IP "\fB\-Wmissing\-declarations\fR (C only)" 4 | |
2565 | .IX Item "-Wmissing-declarations (C only)" | |
2566 | Warn if a global function is defined without a previous declaration. | |
2567 | Do so even if the definition itself provides a prototype. | |
2568 | Use this option to detect global functions that are not declared in | |
2569 | header files. | |
2570 | .IP "\fB\-Wmissing\-noreturn\fR" 4 | |
2571 | .IX Item "-Wmissing-noreturn" | |
2572 | Warn about functions which might be candidates for attribute \f(CW\*(C`noreturn\*(C'\fR. | |
2573 | Note these are only possible candidates, not absolute ones. Care should | |
2574 | be taken to manually verify functions actually do not ever return before | |
2575 | adding the \f(CW\*(C`noreturn\*(C'\fR attribute, otherwise subtle code generation | |
2576 | bugs could be introduced. You will not get a warning for \f(CW\*(C`main\*(C'\fR in | |
2577 | hosted C environments. | |
2578 | .IP "\fB\-Wmissing\-format\-attribute\fR" 4 | |
2579 | .IX Item "-Wmissing-format-attribute" | |
2580 | If \fB\-Wformat\fR is enabled, also warn about functions which might be | |
2581 | candidates for \f(CW\*(C`format\*(C'\fR attributes. Note these are only possible | |
2582 | candidates, not absolute ones. \s-1GCC\s0 will guess that \f(CW\*(C`format\*(C'\fR | |
2583 | attributes might be appropriate for any function that calls a function | |
2584 | like \f(CW\*(C`vprintf\*(C'\fR or \f(CW\*(C`vscanf\*(C'\fR, but this might not always be the | |
2585 | case, and some functions for which \f(CW\*(C`format\*(C'\fR attributes are | |
2586 | appropriate may not be detected. This option has no effect unless | |
2587 | \&\fB\-Wformat\fR is enabled (possibly by \fB\-Wall\fR). | |
2588 | .IP "\fB\-Wno\-multichar\fR" 4 | |
2589 | .IX Item "-Wno-multichar" | |
2590 | Do not warn if a multicharacter constant (\fB'\s-1FOOF\s0'\fR) is used. | |
2591 | Usually they indicate a typo in the user's code, as they have | |
2592 | implementation-defined values, and should not be used in portable code. | |
2593 | .IP "\fB\-Wno\-deprecated\-declarations\fR" 4 | |
2594 | .IX Item "-Wno-deprecated-declarations" | |
2595 | Do not warn about uses of functions, variables, and types marked as | |
2596 | deprecated by using the \f(CW\*(C`deprecated\*(C'\fR attribute. | |
2597 | (@pxref{Function Attributes}, \f(CW@pxref\fR{Variable Attributes}, | |
2598 | \&\f(CW@pxref\fR{Type Attributes}.) | |
2599 | .IP "\fB\-Wpacked\fR" 4 | |
2600 | .IX Item "-Wpacked" | |
2601 | Warn if a structure is given the packed attribute, but the packed | |
2602 | attribute has no effect on the layout or size of the structure. | |
2603 | Such structures may be mis-aligned for little benefit. For | |
2604 | instance, in this code, the variable \f(CW\*(C`f.x\*(C'\fR in \f(CW\*(C`struct bar\*(C'\fR | |
2605 | will be misaligned even though \f(CW\*(C`struct bar\*(C'\fR does not itself | |
2606 | have the packed attribute: | |
2607 | .Sp | |
2608 | .Vb 8 | |
2609 | \& struct foo { | |
2610 | \& int x; | |
2611 | \& char a, b, c, d; | |
2612 | \& } __attribute__((packed)); | |
2613 | \& struct bar { | |
2614 | \& char z; | |
2615 | \& struct foo f; | |
2616 | \& }; | |
2617 | .Ve | |
2618 | .IP "\fB\-Wpadded\fR" 4 | |
2619 | .IX Item "-Wpadded" | |
2620 | Warn if padding is included in a structure, either to align an element | |
2621 | of the structure or to align the whole structure. Sometimes when this | |
2622 | happens it is possible to rearrange the fields of the structure to | |
2623 | reduce the padding and so make the structure smaller. | |
2624 | .IP "\fB\-Wredundant\-decls\fR" 4 | |
2625 | .IX Item "-Wredundant-decls" | |
2626 | Warn if anything is declared more than once in the same scope, even in | |
2627 | cases where multiple declaration is valid and changes nothing. | |
2628 | .IP "\fB\-Wnested\-externs\fR (C only)" 4 | |
2629 | .IX Item "-Wnested-externs (C only)" | |
2630 | Warn if an \f(CW\*(C`extern\*(C'\fR declaration is encountered within a function. | |
2631 | .IP "\fB\-Wunreachable\-code\fR" 4 | |
2632 | .IX Item "-Wunreachable-code" | |
2633 | Warn if the compiler detects that code will never be executed. | |
2634 | .Sp | |
2635 | This option is intended to warn when the compiler detects that at | |
2636 | least a whole line of source code will never be executed, because | |
2637 | some condition is never satisfied or because it is after a | |
2638 | procedure that never returns. | |
2639 | .Sp | |
2640 | It is possible for this option to produce a warning even though there | |
2641 | are circumstances under which part of the affected line can be executed, | |
2642 | so care should be taken when removing apparently-unreachable code. | |
2643 | .Sp | |
2644 | For instance, when a function is inlined, a warning may mean that the | |
2645 | line is unreachable in only one inlined copy of the function. | |
2646 | .Sp | |
2647 | This option is not made part of \fB\-Wall\fR because in a debugging | |
2648 | version of a program there is often substantial code which checks | |
2649 | correct functioning of the program and is, hopefully, unreachable | |
2650 | because the program does work. Another common use of unreachable | |
2651 | code is to provide behavior which is selectable at compile\-time. | |
2652 | .IP "\fB\-Winline\fR" 4 | |
2653 | .IX Item "-Winline" | |
2654 | Warn if a function can not be inlined and it was declared as inline. | |
2655 | Even with this option, the compiler will not warn about failures to | |
2656 | inline functions declared in system headers. | |
2657 | .Sp | |
2658 | The compiler uses a variety of heuristics to determine whether or not | |
2659 | to inline a function. For example, the compiler takes into account | |
2660 | the size of the function being inlined and the the amount of inlining | |
2661 | that has already been done in the current function. Therefore, | |
2662 | seemingly insignificant changes in the source program can cause the | |
2663 | warnings produced by \fB\-Winline\fR to appear or disappear. | |
2664 | .IP "\fB\-Wno\-invalid\-offsetof\fR (\*(C+ only)" 4 | |
2665 | .IX Item "-Wno-invalid-offsetof ( only)" | |
2666 | Suppress warnings from applying the \fBoffsetof\fR macro to a non-POD | |
2667 | type. According to the 1998 \s-1ISO\s0 \*(C+ standard, applying \fBoffsetof\fR | |
2668 | to a non-POD type is undefined. In existing \*(C+ implementations, | |
2669 | however, \fBoffsetof\fR typically gives meaningful results even when | |
2670 | applied to certain kinds of non-POD types. (Such as a simple | |
2671 | \&\fBstruct\fR that fails to be a \s-1POD\s0 type only by virtue of having a | |
2672 | constructor.) This flag is for users who are aware that they are | |
2673 | writing nonportable code and who have deliberately chosen to ignore the | |
2674 | warning about it. | |
2675 | .Sp | |
2676 | The restrictions on \fBoffsetof\fR may be relaxed in a future version | |
2677 | of the \*(C+ standard. | |
2678 | .IP "\fB\-Winvalid\-pch\fR" 4 | |
2679 | .IX Item "-Winvalid-pch" | |
2680 | Warn if a precompiled header is found in | |
2681 | the search path but can't be used. | |
2682 | .IP "\fB\-Wlong\-long\fR" 4 | |
2683 | .IX Item "-Wlong-long" | |
2684 | Warn if \fBlong long\fR type is used. This is default. To inhibit | |
2685 | the warning messages, use \fB\-Wno\-long\-long\fR. Flags | |
2686 | \&\fB\-Wlong\-long\fR and \fB\-Wno\-long\-long\fR are taken into account | |
2687 | only when \fB\-pedantic\fR flag is used. | |
2688 | .IP "\fB\-Wdisabled\-optimization\fR" 4 | |
2689 | .IX Item "-Wdisabled-optimization" | |
2690 | Warn if a requested optimization pass is disabled. This warning does | |
2691 | not generally indicate that there is anything wrong with your code; it | |
2692 | merely indicates that \s-1GCC\s0's optimizers were unable to handle the code | |
2693 | effectively. Often, the problem is that your code is too big or too | |
2694 | complex; \s-1GCC\s0 will refuse to optimize programs when the optimization | |
2695 | itself is likely to take inordinate amounts of time. | |
2696 | .IP "\fB\-Werror\fR" 4 | |
2697 | .IX Item "-Werror" | |
2698 | Make all warnings into errors. | |
2699 | .Sh "Options for Debugging Your Program or \s-1GCC\s0" | |
2700 | .IX Subsection "Options for Debugging Your Program or GCC" | |
2701 | \&\s-1GCC\s0 has various special options that are used for debugging | |
2702 | either your program or \s-1GCC:\s0 | |
2703 | .IP "\fB\-g\fR" 4 | |
2704 | .IX Item "-g" | |
2705 | Produce debugging information in the operating system's native format | |
2706 | (stabs, \s-1COFF\s0, \s-1XCOFF\s0, or \s-1DWARF\s0). \s-1GDB\s0 can work with this debugging | |
2707 | information. | |
2708 | .Sp | |
2709 | On most systems that use stabs format, \fB\-g\fR enables use of extra | |
2710 | debugging information that only \s-1GDB\s0 can use; this extra information | |
2711 | makes debugging work better in \s-1GDB\s0 but will probably make other debuggers | |
2712 | crash or | |
2713 | refuse to read the program. If you want to control for certain whether | |
2714 | to generate the extra information, use \fB\-gstabs+\fR, \fB\-gstabs\fR, | |
2715 | \&\fB\-gxcoff+\fR, \fB\-gxcoff\fR, or \fB\-gvms\fR (see below). | |
2716 | .Sp | |
2717 | Unlike most other C compilers, \s-1GCC\s0 allows you to use \fB\-g\fR with | |
2718 | \&\fB\-O\fR. The shortcuts taken by optimized code may occasionally | |
2719 | produce surprising results: some variables you declared may not exist | |
2720 | at all; flow of control may briefly move where you did not expect it; | |
2721 | some statements may not be executed because they compute constant | |
2722 | results or their values were already at hand; some statements may | |
2723 | execute in different places because they were moved out of loops. | |
2724 | .Sp | |
2725 | Nevertheless it proves possible to debug optimized output. This makes | |
2726 | it reasonable to use the optimizer for programs that might have bugs. | |
2727 | .Sp | |
2728 | The following options are useful when \s-1GCC\s0 is generated with the | |
2729 | capability for more than one debugging format. | |
2730 | .IP "\fB\-ggdb\fR" 4 | |
2731 | .IX Item "-ggdb" | |
2732 | Produce debugging information for use by \s-1GDB\s0. This means to use the | |
2733 | most expressive format available (\s-1DWARF\s0 2, stabs, or the native format | |
2734 | if neither of those are supported), including \s-1GDB\s0 extensions if at all | |
2735 | possible. | |
2736 | .IP "\fB\-gstabs\fR" 4 | |
2737 | .IX Item "-gstabs" | |
2738 | Produce debugging information in stabs format (if that is supported), | |
2739 | without \s-1GDB\s0 extensions. This is the format used by \s-1DBX\s0 on most \s-1BSD\s0 | |
2740 | systems. On \s-1MIPS\s0, Alpha and System V Release 4 systems this option | |
2741 | produces stabs debugging output which is not understood by \s-1DBX\s0 or \s-1SDB\s0. | |
2742 | On System V Release 4 systems this option requires the \s-1GNU\s0 assembler. | |
2743 | .IP "\fB\-feliminate\-unused\-debug\-symbols\fR" 4 | |
2744 | .IX Item "-feliminate-unused-debug-symbols" | |
2745 | Produce debugging information in stabs format (if that is supported), | |
2746 | for only symbols that are actually used. | |
2747 | .IP "\fB\-gstabs+\fR" 4 | |
2748 | .IX Item "-gstabs+" | |
2749 | Produce debugging information in stabs format (if that is supported), | |
2750 | using \s-1GNU\s0 extensions understood only by the \s-1GNU\s0 debugger (\s-1GDB\s0). The | |
2751 | use of these extensions is likely to make other debuggers crash or | |
2752 | refuse to read the program. | |
2753 | .IP "\fB\-gcoff\fR" 4 | |
2754 | .IX Item "-gcoff" | |
2755 | Produce debugging information in \s-1COFF\s0 format (if that is supported). | |
2756 | This is the format used by \s-1SDB\s0 on most System V systems prior to | |
2757 | System V Release 4. | |
2758 | .IP "\fB\-gxcoff\fR" 4 | |
2759 | .IX Item "-gxcoff" | |
2760 | Produce debugging information in \s-1XCOFF\s0 format (if that is supported). | |
2761 | This is the format used by the \s-1DBX\s0 debugger on \s-1IBM\s0 \s-1RS/6000\s0 systems. | |
2762 | .IP "\fB\-gxcoff+\fR" 4 | |
2763 | .IX Item "-gxcoff+" | |
2764 | Produce debugging information in \s-1XCOFF\s0 format (if that is supported), | |
2765 | using \s-1GNU\s0 extensions understood only by the \s-1GNU\s0 debugger (\s-1GDB\s0). The | |
2766 | use of these extensions is likely to make other debuggers crash or | |
2767 | refuse to read the program, and may cause assemblers other than the \s-1GNU\s0 | |
2768 | assembler (\s-1GAS\s0) to fail with an error. | |