1 @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2 @c 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
3 @c Free Software Foundation, Inc.
4 @c This is part of the GCC manual.
5 @c For copying conditions, see the file gcc.texi.
12 @c man begin COPYRIGHT
13 Copyright @copyright{} 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
14 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
15 Free Software Foundation, Inc.
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU Free Documentation License, Version 1.2 or
19 any later version published by the Free Software Foundation; with the
20 Invariant Sections being ``GNU General Public License'' and ``Funding
21 Free Software'', the Front-Cover texts being (a) (see below), and with
22 the Back-Cover Texts being (b) (see below). A copy of the license is
23 included in the gfdl(7) man page.
25 (a) The FSF's Front-Cover Text is:
29 (b) The FSF's Back-Cover Text is:
31 You have freedom to copy and modify this GNU Manual, like GNU
32 software. Copies published by the Free Software Foundation raise
33 funds for GNU development.
35 @c Set file name and title for the man page.
37 @settitle GNU project C and C++ compiler
39 gcc [@option{-c}|@option{-S}|@option{-E}] [@option{-std=}@var{standard}]
40 [@option{-g}] [@option{-pg}] [@option{-O}@var{level}]
41 [@option{-W}@var{warn}@dots{}] [@option{-pedantic}]
42 [@option{-I}@var{dir}@dots{}] [@option{-L}@var{dir}@dots{}]
43 [@option{-D}@var{macro}[=@var{defn}]@dots{}] [@option{-U}@var{macro}]
44 [@option{-f}@var{option}@dots{}] [@option{-m}@var{machine-option}@dots{}]
45 [@option{-o} @var{outfile}] [@@@var{file}] @var{infile}@dots{}
47 Only the most useful options are listed here; see below for the
48 remainder. @samp{g++} accepts mostly the same options as @samp{gcc}.
51 gpl(7), gfdl(7), fsf-funding(7),
52 cpp(1), gcov(1), as(1), ld(1), gdb(1), adb(1), dbx(1), sdb(1)
53 and the Info entries for @file{gcc}, @file{cpp}, @file{as},
54 @file{ld}, @file{binutils} and @file{gdb}.
57 For instructions on reporting bugs, see
61 See the Info entry for @command{gcc}, or
62 @w{@uref{http://gcc.gnu.org/onlinedocs/gcc/Contributors.html}},
63 for contributors to GCC@.
68 @chapter GCC Command Options
69 @cindex GCC command options
70 @cindex command options
71 @cindex options, GCC command
73 @c man begin DESCRIPTION
74 When you invoke GCC, it normally does preprocessing, compilation,
75 assembly and linking. The ``overall options'' allow you to stop this
76 process at an intermediate stage. For example, the @option{-c} option
77 says not to run the linker. Then the output consists of object files
78 output by the assembler.
80 Other options are passed on to one stage of processing. Some options
81 control the preprocessor and others the compiler itself. Yet other
82 options control the assembler and linker; most of these are not
83 documented here, since you rarely need to use any of them.
85 @cindex C compilation options
86 Most of the command line options that you can use with GCC are useful
87 for C programs; when an option is only useful with another language
88 (usually C++), the explanation says so explicitly. If the description
89 for a particular option does not mention a source language, you can use
90 that option with all supported languages.
92 @cindex C++ compilation options
93 @xref{Invoking G++,,Compiling C++ Programs}, for a summary of special
94 options for compiling C++ programs.
96 @cindex grouping options
97 @cindex options, grouping
98 The @command{gcc} program accepts options and file names as operands. Many
99 options have multi-letter names; therefore multiple single-letter options
100 may @emph{not} be grouped: @option{-dv} is very different from @w{@samp{-d
103 @cindex order of options
104 @cindex options, order
105 You can mix options and other arguments. For the most part, the order
106 you use doesn't matter. Order does matter when you use several
107 options of the same kind; for example, if you specify @option{-L} more
108 than once, the directories are searched in the order specified. Also,
109 the placement of the @option{-l} option is significant.
111 Many options have long names starting with @samp{-f} or with
112 @samp{-W}---for example,
113 @option{-fmove-loop-invariants}, @option{-Wformat} and so on. Most of
114 these have both positive and negative forms; the negative form of
115 @option{-ffoo} would be @option{-fno-foo}. This manual documents
116 only one of these two forms, whichever one is not the default.
120 @xref{Option Index}, for an index to GCC's options.
123 * Option Summary:: Brief list of all options, without explanations.
124 * Overall Options:: Controlling the kind of output:
125 an executable, object files, assembler files,
126 or preprocessed source.
127 * Invoking G++:: Compiling C++ programs.
128 * C Dialect Options:: Controlling the variant of C language compiled.
129 * C++ Dialect Options:: Variations on C++.
130 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
132 * Language Independent Options:: Controlling how diagnostics should be
134 * Warning Options:: How picky should the compiler be?
135 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
136 * Optimize Options:: How much optimization?
137 * Preprocessor Options:: Controlling header files and macro definitions.
138 Also, getting dependency information for Make.
139 * Assembler Options:: Passing options to the assembler.
140 * Link Options:: Specifying libraries and so on.
141 * Directory Options:: Where to find header files and libraries.
142 Where to find the compiler executable files.
143 * Spec Files:: How to pass switches to sub-processes.
144 * Target Options:: Running a cross-compiler, or an old version of GCC.
145 * Submodel Options:: Specifying minor hardware or convention variations,
146 such as 68010 vs 68020.
147 * Code Gen Options:: Specifying conventions for function calls, data layout
149 * Environment Variables:: Env vars that affect GCC.
150 * Precompiled Headers:: Compiling a header once, and using it many times.
156 @section Option Summary
158 Here is a summary of all the options, grouped by type. Explanations are
159 in the following sections.
162 @item Overall Options
163 @xref{Overall Options,,Options Controlling the Kind of Output}.
164 @gccoptlist{-c -S -E -o @var{file} -combine -no-canonical-prefixes @gol
165 -pipe -pass-exit-codes @gol
166 -x @var{language} -v -### --help@r{[}=@var{class}@r{[},@dots{}@r{]]} --target-help @gol
167 --version -wrapper@@@var{file} -fplugin=@var{file} -fplugin-arg-@var{name}=@var{arg}}
169 @item C Language Options
170 @xref{C Dialect Options,,Options Controlling C Dialect}.
171 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
172 -aux-info @var{filename} @gol
173 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
174 -fhosted -ffreestanding -fopenmp -fms-extensions @gol
175 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
176 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
177 -fsigned-bitfields -fsigned-char @gol
178 -funsigned-bitfields -funsigned-char}
180 @item C++ Language Options
181 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
182 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
183 -fconserve-space -ffriend-injection @gol
184 -fno-elide-constructors @gol
185 -fno-enforce-eh-specs @gol
186 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
187 -fno-implicit-templates @gol
188 -fno-implicit-inline-templates @gol
189 -fno-implement-inlines -fms-extensions @gol
190 -fno-nonansi-builtins -fno-operator-names @gol
191 -fno-optional-diags -fpermissive @gol
192 -fno-pretty-templates @gol
193 -frepo -fno-rtti -fstats -ftemplate-depth-@var{n} @gol
194 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
195 -fno-default-inline -fvisibility-inlines-hidden @gol
196 -fvisibility-ms-compat @gol
197 -Wabi -Wctor-dtor-privacy @gol
198 -Wnon-virtual-dtor -Wreorder @gol
199 -Weffc++ -Wstrict-null-sentinel @gol
200 -Wno-non-template-friend -Wold-style-cast @gol
201 -Woverloaded-virtual -Wno-pmf-conversions @gol
204 @item Objective-C and Objective-C++ Language Options
205 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
206 Objective-C and Objective-C++ Dialects}.
207 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
208 -fgnu-runtime -fnext-runtime @gol
209 -fno-nil-receivers @gol
210 -fobjc-call-cxx-cdtors @gol
211 -fobjc-direct-dispatch @gol
212 -fobjc-exceptions @gol
214 -freplace-objc-classes @gol
217 -Wassign-intercept @gol
218 -Wno-protocol -Wselector @gol
219 -Wstrict-selector-match @gol
220 -Wundeclared-selector}
222 @item Language Independent Options
223 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
224 @gccoptlist{-fmessage-length=@var{n} @gol
225 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
226 -fdiagnostics-show-option}
228 @item Warning Options
229 @xref{Warning Options,,Options to Request or Suppress Warnings}.
230 @gccoptlist{-fsyntax-only -pedantic -pedantic-errors @gol
231 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
232 -Wno-attributes -Wno-builtin-macro-redefined @gol
233 -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
234 -Wchar-subscripts -Wclobbered -Wcomment @gol
235 -Wconversion -Wcoverage-mismatch -Wno-deprecated @gol
236 -Wno-deprecated-declarations -Wdisabled-optimization @gol
237 -Wno-div-by-zero -Wempty-body -Wenum-compare -Wno-endif-labels @gol
238 -Werror -Werror=* @gol
239 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
240 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
241 -Wformat-security -Wformat-y2k @gol
242 -Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
243 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
244 -Winit-self -Winline @gol
245 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
246 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
247 -Wlogical-op -Wlong-long @gol
248 -Wmain -Wmissing-braces -Wmissing-field-initializers @gol
249 -Wmissing-format-attribute -Wmissing-include-dirs @gol
250 -Wmissing-noreturn -Wno-mudflap @gol
251 -Wno-multichar -Wnonnull -Wno-overflow @gol
252 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
253 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
254 -Wpointer-arith -Wno-pointer-to-int-cast @gol
255 -Wredundant-decls @gol
256 -Wreturn-type -Wsequence-point -Wshadow @gol
257 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
258 -Wstrict-aliasing -Wstrict-aliasing=n @gol
259 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
260 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
261 -Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
262 -Wunknown-pragmas -Wno-pragmas @gol
263 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
264 -Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol
265 -Wvariadic-macros -Wvla @gol
266 -Wvolatile-register-var -Wwrite-strings}
268 @item C and Objective-C-only Warning Options
269 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
270 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
271 -Wold-style-declaration -Wold-style-definition @gol
272 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
273 -Wdeclaration-after-statement -Wpointer-sign}
275 @item Debugging Options
276 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
277 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
278 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
279 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
280 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
281 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
282 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
283 -fdump-statistics @gol
285 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
286 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
287 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
289 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
290 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
291 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
292 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
294 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
295 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
297 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
298 -fdump-tree-nrv -fdump-tree-vect @gol
299 -fdump-tree-sink @gol
300 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
303 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
304 -ftree-vectorizer-verbose=@var{n} @gol
305 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
306 -fdump-final-insns=@var{file} @gol
307 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
308 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
309 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
310 -fenable-icf-debug @gol
311 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
312 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
313 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
314 -ftest-coverage -ftime-report -fvar-tracking @gol
315 -fvar-tracking-assigments -fvar-tracking-assignments-toggle @gol
316 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
317 -ggdb -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
318 -gvms -gxcoff -gxcoff+ @gol
319 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
320 -fdebug-prefix-map=@var{old}=@var{new} @gol
321 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
322 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
323 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
324 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
325 -print-prog-name=@var{program} -print-search-dirs -Q @gol
326 -print-sysroot -print-sysroot-headers-suffix @gol
327 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
329 @item Optimization Options
330 @xref{Optimize Options,,Options that Control Optimization}.
332 -falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
333 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
334 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
335 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
336 -fcheck-data-deps -fconserve-stack -fcprop-registers -fcrossjumping @gol
337 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules -fcx-limited-range @gol
338 -fdata-sections -fdce -fdce @gol
339 -fdelayed-branch -fdelete-null-pointer-checks -fdse -fdse @gol
340 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
341 -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
342 -fforward-propagate -ffunction-sections @gol
343 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
344 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
345 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
346 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol
347 -fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
348 -fipa-type-escape -fira-algorithm=@var{algorithm} @gol
349 -fira-region=@var{region} -fira-coalesce @gol
350 -fira-loop-pressure -fno-ira-share-save-slots @gol
351 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
352 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
353 -floop-block -floop-interchange -floop-strip-mine -fgraphite-identity @gol
354 -floop-parallelize-all -flto -flto-compression-level -flto-report -fltrans @gol
355 -fltrans-output-list -fmerge-all-constants -fmerge-constants -fmodulo-sched @gol
356 -fmodulo-sched-allow-regmoves -fmove-loop-invariants -fmudflap @gol
357 -fmudflapir -fmudflapth -fno-branch-count-reg -fno-default-inline @gol
358 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
359 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
360 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
361 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
362 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
363 -fpeel-loops -fpredictive-commoning -fprefetch-loop-arrays @gol
364 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
365 -fprofile-generate=@var{path} @gol
366 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
367 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
368 -freorder-blocks-and-partition -freorder-functions @gol
369 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
370 -frounding-math -fsched2-use-superblocks @gol
371 -fsched2-use-traces -fsched-pressure @gol
372 -fsched-spec-load -fsched-spec-load-dangerous @gol
373 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
374 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
375 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
376 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
377 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
378 -fselective-scheduling -fselective-scheduling2 @gol
379 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
380 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
381 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
382 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
383 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
384 -ftree-copyrename -ftree-dce @gol
385 -ftree-dominator-opts -ftree-dse -ftree-forwprop -ftree-fre -ftree-loop-im @gol
386 -ftree-phiprop -ftree-loop-distribution @gol
387 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
388 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
389 -ftree-sink -ftree-sra -ftree-switch-conversion @gol
390 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
391 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
392 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
393 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
394 -fwhole-program -fwhopr -fwpa -fuse-linker-plugin @gol
395 --param @var{name}=@var{value}
396 -O -O0 -O1 -O2 -O3 -Os}
398 @item Preprocessor Options
399 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
400 @gccoptlist{-A@var{question}=@var{answer} @gol
401 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
402 -C -dD -dI -dM -dN @gol
403 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
404 -idirafter @var{dir} @gol
405 -include @var{file} -imacros @var{file} @gol
406 -iprefix @var{file} -iwithprefix @var{dir} @gol
407 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
408 -imultilib @var{dir} -isysroot @var{dir} @gol
409 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
410 -P -fworking-directory -remap @gol
411 -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
412 -Xpreprocessor @var{option}}
414 @item Assembler Option
415 @xref{Assembler Options,,Passing Options to the Assembler}.
416 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
419 @xref{Link Options,,Options for Linking}.
420 @gccoptlist{@var{object-file-name} -l@var{library} @gol
421 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
422 -s -static -static-libgcc -static-libstdc++ -shared @gol
423 -shared-libgcc -symbolic @gol
424 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
427 @item Directory Options
428 @xref{Directory Options,,Options for Directory Search}.
429 @gccoptlist{-B@var{prefix} -I@var{dir} -iquote@var{dir} -L@var{dir}
430 -specs=@var{file} -I- --sysroot=@var{dir}}
433 @c I wrote this xref this way to avoid overfull hbox. -- rms
434 @xref{Target Options}.
435 @gccoptlist{-V @var{version} -b @var{machine}}
437 @item Machine Dependent Options
438 @xref{Submodel Options,,Hardware Models and Configurations}.
439 @c This list is ordered alphanumerically by subsection name.
440 @c Try and put the significant identifier (CPU or system) first,
441 @c so users have a clue at guessing where the ones they want will be.
444 @gccoptlist{-EB -EL @gol
445 -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
446 -mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
449 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
450 -mabi=@var{name} @gol
451 -mapcs-stack-check -mno-apcs-stack-check @gol
452 -mapcs-float -mno-apcs-float @gol
453 -mapcs-reentrant -mno-apcs-reentrant @gol
454 -msched-prolog -mno-sched-prolog @gol
455 -mlittle-endian -mbig-endian -mwords-little-endian @gol
456 -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
457 -mfp16-format=@var{name}
458 -mthumb-interwork -mno-thumb-interwork @gol
459 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
460 -mstructure-size-boundary=@var{n} @gol
461 -mabort-on-noreturn @gol
462 -mlong-calls -mno-long-calls @gol
463 -msingle-pic-base -mno-single-pic-base @gol
464 -mpic-register=@var{reg} @gol
465 -mnop-fun-dllimport @gol
466 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
467 -mpoke-function-name @gol
469 -mtpcs-frame -mtpcs-leaf-frame @gol
470 -mcaller-super-interworking -mcallee-super-interworking @gol
472 -mword-relocations @gol
473 -mfix-cortex-m3-ldrd}
476 @gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
477 -mcall-prologues -mtiny-stack -mint8}
479 @emph{Blackfin Options}
480 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
481 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
482 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
483 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
484 -mno-id-shared-library -mshared-library-id=@var{n} @gol
485 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
486 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
487 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
491 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
492 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
493 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
494 -mstack-align -mdata-align -mconst-align @gol
495 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
496 -melf -maout -melinux -mlinux -sim -sim2 @gol
497 -mmul-bug-workaround -mno-mul-bug-workaround}
500 @gccoptlist{-mmac -mpush-args}
502 @emph{Darwin Options}
503 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
504 -arch_only -bind_at_load -bundle -bundle_loader @gol
505 -client_name -compatibility_version -current_version @gol
507 -dependency-file -dylib_file -dylinker_install_name @gol
508 -dynamic -dynamiclib -exported_symbols_list @gol
509 -filelist -flat_namespace -force_cpusubtype_ALL @gol
510 -force_flat_namespace -headerpad_max_install_names @gol
512 -image_base -init -install_name -keep_private_externs @gol
513 -multi_module -multiply_defined -multiply_defined_unused @gol
514 -noall_load -no_dead_strip_inits_and_terms @gol
515 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
516 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
517 -private_bundle -read_only_relocs -sectalign @gol
518 -sectobjectsymbols -whyload -seg1addr @gol
519 -sectcreate -sectobjectsymbols -sectorder @gol
520 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
521 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
522 -segprot -segs_read_only_addr -segs_read_write_addr @gol
523 -single_module -static -sub_library -sub_umbrella @gol
524 -twolevel_namespace -umbrella -undefined @gol
525 -unexported_symbols_list -weak_reference_mismatches @gol
526 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
527 -mkernel -mone-byte-bool}
529 @emph{DEC Alpha Options}
530 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
531 -mieee -mieee-with-inexact -mieee-conformant @gol
532 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
533 -mtrap-precision=@var{mode} -mbuild-constants @gol
534 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
535 -mbwx -mmax -mfix -mcix @gol
536 -mfloat-vax -mfloat-ieee @gol
537 -mexplicit-relocs -msmall-data -mlarge-data @gol
538 -msmall-text -mlarge-text @gol
539 -mmemory-latency=@var{time}}
541 @emph{DEC Alpha/VMS Options}
542 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
545 @gccoptlist{-msmall-model -mno-lsim}
548 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
549 -mhard-float -msoft-float @gol
550 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
551 -mdouble -mno-double @gol
552 -mmedia -mno-media -mmuladd -mno-muladd @gol
553 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
554 -mlinked-fp -mlong-calls -malign-labels @gol
555 -mlibrary-pic -macc-4 -macc-8 @gol
556 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
557 -moptimize-membar -mno-optimize-membar @gol
558 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
559 -mvliw-branch -mno-vliw-branch @gol
560 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
561 -mno-nested-cond-exec -mtomcat-stats @gol
565 @emph{GNU/Linux Options}
566 @gccoptlist{-muclibc}
568 @emph{H8/300 Options}
569 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
572 @gccoptlist{-march=@var{architecture-type} @gol
573 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
574 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
575 -mfixed-range=@var{register-range} @gol
576 -mjump-in-delay -mlinker-opt -mlong-calls @gol
577 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
578 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
579 -mno-jump-in-delay -mno-long-load-store @gol
580 -mno-portable-runtime -mno-soft-float @gol
581 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
582 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
583 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
584 -munix=@var{unix-std} -nolibdld -static -threads}
586 @emph{i386 and x86-64 Options}
587 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
588 -mfpmath=@var{unit} @gol
589 -masm=@var{dialect} -mno-fancy-math-387 @gol
590 -mno-fp-ret-in-387 -msoft-float @gol
591 -mno-wide-multiply -mrtd -malign-double @gol
592 -mpreferred-stack-boundary=@var{num}
593 -mincoming-stack-boundary=@var{num}
594 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip @gol
595 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
596 -maes -mpclmul -mfused-madd @gol
597 -msse4a -m3dnow -mpopcnt -mabm -mfma4 -mxop -mlwp @gol
598 -mthreads -mno-align-stringops -minline-all-stringops @gol
599 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
600 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
601 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
602 -mveclibabi=@var{type} -mpc32 -mpc64 -mpc80 -mstackrealign @gol
603 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
604 -mcmodel=@var{code-model} -mabi=@var{name} @gol
605 -m32 -m64 -mlarge-data-threshold=@var{num} @gol
609 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
610 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
611 -mconstant-gp -mauto-pic -mfused-madd @gol
612 -minline-float-divide-min-latency @gol
613 -minline-float-divide-max-throughput @gol
614 -mno-inline-float-divide @gol
615 -minline-int-divide-min-latency @gol
616 -minline-int-divide-max-throughput @gol
617 -mno-inline-int-divide @gol
618 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
619 -mno-inline-sqrt @gol
620 -mdwarf2-asm -mearly-stop-bits @gol
621 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
622 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
623 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
624 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
625 -msched-spec-ldc -msched-spec-control-ldc @gol
626 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
627 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
628 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
629 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
631 @emph{IA-64/VMS Options}
632 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
635 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
636 -msign-extend-enabled -muser-enabled}
638 @emph{M32R/D Options}
639 @gccoptlist{-m32r2 -m32rx -m32r @gol
641 -malign-loops -mno-align-loops @gol
642 -missue-rate=@var{number} @gol
643 -mbranch-cost=@var{number} @gol
644 -mmodel=@var{code-size-model-type} @gol
645 -msdata=@var{sdata-type} @gol
646 -mno-flush-func -mflush-func=@var{name} @gol
647 -mno-flush-trap -mflush-trap=@var{number} @gol
651 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
653 @emph{M680x0 Options}
654 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
655 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
656 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
657 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
658 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
659 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
660 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
661 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
664 @emph{M68hc1x Options}
665 @gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
666 -mauto-incdec -minmax -mlong-calls -mshort @gol
667 -msoft-reg-count=@var{count}}
670 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
671 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
672 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
673 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
674 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
677 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
678 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
679 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
680 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
684 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
685 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
686 -mips64 -mips64r2 @gol
687 -mips16 -mno-mips16 -mflip-mips16 @gol
688 -minterlink-mips16 -mno-interlink-mips16 @gol
689 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
690 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
691 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
692 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
693 -mfpu=@var{fpu-type} @gol
694 -msmartmips -mno-smartmips @gol
695 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
696 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
697 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
698 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
699 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
700 -membedded-data -mno-embedded-data @gol
701 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
702 -mcode-readable=@var{setting} @gol
703 -msplit-addresses -mno-split-addresses @gol
704 -mexplicit-relocs -mno-explicit-relocs @gol
705 -mcheck-zero-division -mno-check-zero-division @gol
706 -mdivide-traps -mdivide-breaks @gol
707 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
708 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
709 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
710 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
711 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
712 -mflush-func=@var{func} -mno-flush-func @gol
713 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
714 -mfp-exceptions -mno-fp-exceptions @gol
715 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
716 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
719 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
720 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
721 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
722 -mno-base-addresses -msingle-exit -mno-single-exit}
724 @emph{MN10300 Options}
725 @gccoptlist{-mmult-bug -mno-mult-bug @gol
726 -mam33 -mno-am33 @gol
727 -mam33-2 -mno-am33-2 @gol
728 -mreturn-pointer-on-d0 @gol
731 @emph{PDP-11 Options}
732 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
733 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
734 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
735 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
736 -mbranch-expensive -mbranch-cheap @gol
737 -msplit -mno-split -munix-asm -mdec-asm}
739 @emph{picoChip Options}
740 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N}
741 -msymbol-as-address -mno-inefficient-warnings}
743 @emph{PowerPC Options}
744 See RS/6000 and PowerPC Options.
746 @emph{RS/6000 and PowerPC Options}
747 @gccoptlist{-mcpu=@var{cpu-type} @gol
748 -mtune=@var{cpu-type} @gol
749 -mpower -mno-power -mpower2 -mno-power2 @gol
750 -mpowerpc -mpowerpc64 -mno-powerpc @gol
751 -maltivec -mno-altivec @gol
752 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
753 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
754 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
755 -mfprnd -mno-fprnd @gol
756 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
757 -mnew-mnemonics -mold-mnemonics @gol
758 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
759 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
760 -malign-power -malign-natural @gol
761 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
762 -msingle-float -mdouble-float -msimple-fpu @gol
763 -mstring -mno-string -mupdate -mno-update @gol
764 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
765 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
766 -mstrict-align -mno-strict-align -mrelocatable @gol
767 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
768 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
769 -mdynamic-no-pic -maltivec -mswdiv @gol
770 -mprioritize-restricted-insns=@var{priority} @gol
771 -msched-costly-dep=@var{dependence_type} @gol
772 -minsert-sched-nops=@var{scheme} @gol
773 -mcall-sysv -mcall-netbsd @gol
774 -maix-struct-return -msvr4-struct-return @gol
775 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
776 -misel -mno-isel @gol
777 -misel=yes -misel=no @gol
779 -mspe=yes -mspe=no @gol
781 -mgen-cell-microcode -mwarn-cell-microcode @gol
782 -mvrsave -mno-vrsave @gol
783 -mmulhw -mno-mulhw @gol
784 -mdlmzb -mno-dlmzb @gol
785 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
786 -mprototype -mno-prototype @gol
787 -msim -mmvme -mads -myellowknife -memb -msdata @gol
788 -msdata=@var{opt} -mvxworks -G @var{num} -pthread}
791 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
793 -mbig-endian-data -mlittle-endian-data @gol
796 -mas100-syntax -mno-as100-syntax@gol
798 -mmax-constant-size=@gol
800 -msave-acc-in-interrupts}
802 @emph{S/390 and zSeries Options}
803 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
804 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
805 -mlong-double-64 -mlong-double-128 @gol
806 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
807 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
808 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
809 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
810 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
813 @gccoptlist{-meb -mel @gol
817 -mscore5 -mscore5u -mscore7 -mscore7d}
820 @gccoptlist{-m1 -m2 -m2e @gol
821 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
823 -m4-nofpu -m4-single-only -m4-single -m4 @gol
824 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
825 -m5-64media -m5-64media-nofpu @gol
826 -m5-32media -m5-32media-nofpu @gol
827 -m5-compact -m5-compact-nofpu @gol
828 -mb -ml -mdalign -mrelax @gol
829 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
830 -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
831 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
832 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
833 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
837 @gccoptlist{-mcpu=@var{cpu-type} @gol
838 -mtune=@var{cpu-type} @gol
839 -mcmodel=@var{code-model} @gol
840 -m32 -m64 -mapp-regs -mno-app-regs @gol
841 -mfaster-structs -mno-faster-structs @gol
842 -mfpu -mno-fpu -mhard-float -msoft-float @gol
843 -mhard-quad-float -msoft-quad-float @gol
844 -mimpure-text -mno-impure-text -mlittle-endian @gol
845 -mstack-bias -mno-stack-bias @gol
846 -munaligned-doubles -mno-unaligned-doubles @gol
847 -mv8plus -mno-v8plus -mvis -mno-vis
848 -threads -pthreads -pthread}
851 @gccoptlist{-mwarn-reloc -merror-reloc @gol
852 -msafe-dma -munsafe-dma @gol
854 -msmall-mem -mlarge-mem -mstdmain @gol
855 -mfixed-range=@var{register-range} @gol
857 -maddress-space-conversion -mno-address-space-conversion @gol
858 -mcache-size=@var{cache-size} @gol
859 -matomic-updates -mno-atomic-updates}
861 @emph{System V Options}
862 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
865 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
866 -mprolog-function -mno-prolog-function -mspace @gol
867 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
868 -mapp-regs -mno-app-regs @gol
869 -mdisable-callt -mno-disable-callt @gol
875 @gccoptlist{-mg -mgnu -munix}
877 @emph{VxWorks Options}
878 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
879 -Xbind-lazy -Xbind-now}
881 @emph{x86-64 Options}
882 See i386 and x86-64 Options.
884 @emph{i386 and x86-64 Windows Options}
885 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
886 -mnop-fun-dllimport -mthread -municode -mwin32 -mwindows
887 -fno-set-stack-executable}
889 @emph{Xstormy16 Options}
892 @emph{Xtensa Options}
893 @gccoptlist{-mconst16 -mno-const16 @gol
894 -mfused-madd -mno-fused-madd @gol
895 -mserialize-volatile -mno-serialize-volatile @gol
896 -mtext-section-literals -mno-text-section-literals @gol
897 -mtarget-align -mno-target-align @gol
898 -mlongcalls -mno-longcalls}
900 @emph{zSeries Options}
901 See S/390 and zSeries Options.
903 @item Code Generation Options
904 @xref{Code Gen Options,,Options for Code Generation Conventions}.
905 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
906 -ffixed-@var{reg} -fexceptions @gol
907 -fnon-call-exceptions -funwind-tables @gol
908 -fasynchronous-unwind-tables @gol
909 -finhibit-size-directive -finstrument-functions @gol
910 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
911 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
912 -fno-common -fno-ident @gol
913 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
914 -fno-jump-tables @gol
915 -frecord-gcc-switches @gol
916 -freg-struct-return -fshort-enums @gol
917 -fshort-double -fshort-wchar @gol
918 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
919 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
920 -fno-stack-limit -fargument-alias -fargument-noalias @gol
921 -fargument-noalias-global -fargument-noalias-anything @gol
922 -fleading-underscore -ftls-model=@var{model} @gol
923 -ftrapv -fwrapv -fbounds-check @gol
928 * Overall Options:: Controlling the kind of output:
929 an executable, object files, assembler files,
930 or preprocessed source.
931 * C Dialect Options:: Controlling the variant of C language compiled.
932 * C++ Dialect Options:: Variations on C++.
933 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
935 * Language Independent Options:: Controlling how diagnostics should be
937 * Warning Options:: How picky should the compiler be?
938 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
939 * Optimize Options:: How much optimization?
940 * Preprocessor Options:: Controlling header files and macro definitions.
941 Also, getting dependency information for Make.
942 * Assembler Options:: Passing options to the assembler.
943 * Link Options:: Specifying libraries and so on.
944 * Directory Options:: Where to find header files and libraries.
945 Where to find the compiler executable files.
946 * Spec Files:: How to pass switches to sub-processes.
947 * Target Options:: Running a cross-compiler, or an old version of GCC.
950 @node Overall Options
951 @section Options Controlling the Kind of Output
953 Compilation can involve up to four stages: preprocessing, compilation
954 proper, assembly and linking, always in that order. GCC is capable of
955 preprocessing and compiling several files either into several
956 assembler input files, or into one assembler input file; then each
957 assembler input file produces an object file, and linking combines all
958 the object files (those newly compiled, and those specified as input)
959 into an executable file.
961 @cindex file name suffix
962 For any given input file, the file name suffix determines what kind of
967 C source code which must be preprocessed.
970 C source code which should not be preprocessed.
973 C++ source code which should not be preprocessed.
976 Objective-C source code. Note that you must link with the @file{libobjc}
977 library to make an Objective-C program work.
980 Objective-C source code which should not be preprocessed.
984 Objective-C++ source code. Note that you must link with the @file{libobjc}
985 library to make an Objective-C++ program work. Note that @samp{.M} refers
986 to a literal capital M@.
989 Objective-C++ source code which should not be preprocessed.
992 C, C++, Objective-C or Objective-C++ header file to be turned into a
997 @itemx @var{file}.cxx
998 @itemx @var{file}.cpp
999 @itemx @var{file}.CPP
1000 @itemx @var{file}.c++
1002 C++ source code which must be preprocessed. Note that in @samp{.cxx},
1003 the last two letters must both be literally @samp{x}. Likewise,
1004 @samp{.C} refers to a literal capital C@.
1008 Objective-C++ source code which must be preprocessed.
1010 @item @var{file}.mii
1011 Objective-C++ source code which should not be preprocessed.
1015 @itemx @var{file}.hp
1016 @itemx @var{file}.hxx
1017 @itemx @var{file}.hpp
1018 @itemx @var{file}.HPP
1019 @itemx @var{file}.h++
1020 @itemx @var{file}.tcc
1021 C++ header file to be turned into a precompiled header.
1024 @itemx @var{file}.for
1025 @itemx @var{file}.ftn
1026 Fixed form Fortran source code which should not be preprocessed.
1029 @itemx @var{file}.FOR
1030 @itemx @var{file}.fpp
1031 @itemx @var{file}.FPP
1032 @itemx @var{file}.FTN
1033 Fixed form Fortran source code which must be preprocessed (with the traditional
1036 @item @var{file}.f90
1037 @itemx @var{file}.f95
1038 @itemx @var{file}.f03
1039 @itemx @var{file}.f08
1040 Free form Fortran source code which should not be preprocessed.
1042 @item @var{file}.F90
1043 @itemx @var{file}.F95
1044 @itemx @var{file}.F03
1045 @itemx @var{file}.F08
1046 Free form Fortran source code which must be preprocessed (with the
1047 traditional preprocessor).
1049 @c FIXME: Descriptions of Java file types.
1055 @item @var{file}.ads
1056 Ada source code file which contains a library unit declaration (a
1057 declaration of a package, subprogram, or generic, or a generic
1058 instantiation), or a library unit renaming declaration (a package,
1059 generic, or subprogram renaming declaration). Such files are also
1062 @item @var{file}.adb
1063 Ada source code file containing a library unit body (a subprogram or
1064 package body). Such files are also called @dfn{bodies}.
1066 @c GCC also knows about some suffixes for languages not yet included:
1077 @itemx @var{file}.sx
1078 Assembler code which must be preprocessed.
1081 An object file to be fed straight into linking.
1082 Any file name with no recognized suffix is treated this way.
1086 You can specify the input language explicitly with the @option{-x} option:
1089 @item -x @var{language}
1090 Specify explicitly the @var{language} for the following input files
1091 (rather than letting the compiler choose a default based on the file
1092 name suffix). This option applies to all following input files until
1093 the next @option{-x} option. Possible values for @var{language} are:
1095 c c-header c-cpp-output
1096 c++ c++-header c++-cpp-output
1097 objective-c objective-c-header objective-c-cpp-output
1098 objective-c++ objective-c++-header objective-c++-cpp-output
1099 assembler assembler-with-cpp
1101 f77 f77-cpp-input f95 f95-cpp-input
1106 Turn off any specification of a language, so that subsequent files are
1107 handled according to their file name suffixes (as they are if @option{-x}
1108 has not been used at all).
1110 @item -pass-exit-codes
1111 @opindex pass-exit-codes
1112 Normally the @command{gcc} program will exit with the code of 1 if any
1113 phase of the compiler returns a non-success return code. If you specify
1114 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1115 numerically highest error produced by any phase that returned an error
1116 indication. The C, C++, and Fortran frontends return 4, if an internal
1117 compiler error is encountered.
1120 If you only want some of the stages of compilation, you can use
1121 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1122 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1123 @command{gcc} is to stop. Note that some combinations (for example,
1124 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1129 Compile or assemble the source files, but do not link. The linking
1130 stage simply is not done. The ultimate output is in the form of an
1131 object file for each source file.
1133 By default, the object file name for a source file is made by replacing
1134 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1136 Unrecognized input files, not requiring compilation or assembly, are
1141 Stop after the stage of compilation proper; do not assemble. The output
1142 is in the form of an assembler code file for each non-assembler input
1145 By default, the assembler file name for a source file is made by
1146 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1148 Input files that don't require compilation are ignored.
1152 Stop after the preprocessing stage; do not run the compiler proper. The
1153 output is in the form of preprocessed source code, which is sent to the
1156 Input files which don't require preprocessing are ignored.
1158 @cindex output file option
1161 Place output in file @var{file}. This applies regardless to whatever
1162 sort of output is being produced, whether it be an executable file,
1163 an object file, an assembler file or preprocessed C code.
1165 If @option{-o} is not specified, the default is to put an executable
1166 file in @file{a.out}, the object file for
1167 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1168 assembler file in @file{@var{source}.s}, a precompiled header file in
1169 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1174 Print (on standard error output) the commands executed to run the stages
1175 of compilation. Also print the version number of the compiler driver
1176 program and of the preprocessor and the compiler proper.
1180 Like @option{-v} except the commands are not executed and all command
1181 arguments are quoted. This is useful for shell scripts to capture the
1182 driver-generated command lines.
1186 Use pipes rather than temporary files for communication between the
1187 various stages of compilation. This fails to work on some systems where
1188 the assembler is unable to read from a pipe; but the GNU assembler has
1193 If you are compiling multiple source files, this option tells the driver
1194 to pass all the source files to the compiler at once (for those
1195 languages for which the compiler can handle this). This will allow
1196 intermodule analysis (IMA) to be performed by the compiler. Currently the only
1197 language for which this is supported is C@. If you pass source files for
1198 multiple languages to the driver, using this option, the driver will invoke
1199 the compiler(s) that support IMA once each, passing each compiler all the
1200 source files appropriate for it. For those languages that do not support
1201 IMA this option will be ignored, and the compiler will be invoked once for
1202 each source file in that language. If you use this option in conjunction
1203 with @option{-save-temps}, the compiler will generate multiple
1205 (one for each source file), but only one (combined) @file{.o} or
1210 Print (on the standard output) a description of the command line options
1211 understood by @command{gcc}. If the @option{-v} option is also specified
1212 then @option{--help} will also be passed on to the various processes
1213 invoked by @command{gcc}, so that they can display the command line options
1214 they accept. If the @option{-Wextra} option has also been specified
1215 (prior to the @option{--help} option), then command line options which
1216 have no documentation associated with them will also be displayed.
1219 @opindex target-help
1220 Print (on the standard output) a description of target-specific command
1221 line options for each tool. For some targets extra target-specific
1222 information may also be printed.
1224 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1225 Print (on the standard output) a description of the command line
1226 options understood by the compiler that fit into all specified classes
1227 and qualifiers. These are the supported classes:
1230 @item @samp{optimizers}
1231 This will display all of the optimization options supported by the
1234 @item @samp{warnings}
1235 This will display all of the options controlling warning messages
1236 produced by the compiler.
1239 This will display target-specific options. Unlike the
1240 @option{--target-help} option however, target-specific options of the
1241 linker and assembler will not be displayed. This is because those
1242 tools do not currently support the extended @option{--help=} syntax.
1245 This will display the values recognized by the @option{--param}
1248 @item @var{language}
1249 This will display the options supported for @var{language}, where
1250 @var{language} is the name of one of the languages supported in this
1254 This will display the options that are common to all languages.
1257 These are the supported qualifiers:
1260 @item @samp{undocumented}
1261 Display only those options which are undocumented.
1264 Display options which take an argument that appears after an equal
1265 sign in the same continuous piece of text, such as:
1266 @samp{--help=target}.
1268 @item @samp{separate}
1269 Display options which take an argument that appears as a separate word
1270 following the original option, such as: @samp{-o output-file}.
1273 Thus for example to display all the undocumented target-specific
1274 switches supported by the compiler the following can be used:
1277 --help=target,undocumented
1280 The sense of a qualifier can be inverted by prefixing it with the
1281 @samp{^} character, so for example to display all binary warning
1282 options (i.e., ones that are either on or off and that do not take an
1283 argument), which have a description the following can be used:
1286 --help=warnings,^joined,^undocumented
1289 The argument to @option{--help=} should not consist solely of inverted
1292 Combining several classes is possible, although this usually
1293 restricts the output by so much that there is nothing to display. One
1294 case where it does work however is when one of the classes is
1295 @var{target}. So for example to display all the target-specific
1296 optimization options the following can be used:
1299 --help=target,optimizers
1302 The @option{--help=} option can be repeated on the command line. Each
1303 successive use will display its requested class of options, skipping
1304 those that have already been displayed.
1306 If the @option{-Q} option appears on the command line before the
1307 @option{--help=} option, then the descriptive text displayed by
1308 @option{--help=} is changed. Instead of describing the displayed
1309 options, an indication is given as to whether the option is enabled,
1310 disabled or set to a specific value (assuming that the compiler
1311 knows this at the point where the @option{--help=} option is used).
1313 Here is a truncated example from the ARM port of @command{gcc}:
1316 % gcc -Q -mabi=2 --help=target -c
1317 The following options are target specific:
1319 -mabort-on-noreturn [disabled]
1323 The output is sensitive to the effects of previous command line
1324 options, so for example it is possible to find out which optimizations
1325 are enabled at @option{-O2} by using:
1328 -Q -O2 --help=optimizers
1331 Alternatively you can discover which binary optimizations are enabled
1332 by @option{-O3} by using:
1335 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1336 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1337 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1340 @item -no-canonical-prefixes
1341 @opindex no-canonical-prefixes
1342 Do not expand any symbolic links, resolve references to @samp{/../}
1343 or @samp{/./}, or make the path absolute when generating a relative
1348 Display the version number and copyrights of the invoked GCC@.
1352 Invoke all subcommands under a wrapper program. It takes a single
1353 comma separated list as an argument, which will be used to invoke
1357 gcc -c t.c -wrapper gdb,--args
1360 This will invoke all subprograms of gcc under "gdb --args",
1361 thus cc1 invocation will be "gdb --args cc1 ...".
1363 @item -fplugin=@var{name}.so
1364 Load the plugin code in file @var{name}.so, assumed to be a
1365 shared object to be dlopen'd by the compiler. The base name of
1366 the shared object file is used to identify the plugin for the
1367 purposes of argument parsing (See
1368 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1369 Each plugin should define the callback functions specified in the
1372 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1373 Define an argument called @var{key} with a value of @var{value}
1374 for the plugin called @var{name}.
1376 @include @value{srcdir}/../libiberty/at-file.texi
1380 @section Compiling C++ Programs
1382 @cindex suffixes for C++ source
1383 @cindex C++ source file suffixes
1384 C++ source files conventionally use one of the suffixes @samp{.C},
1385 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1386 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1387 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1388 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1389 files with these names and compiles them as C++ programs even if you
1390 call the compiler the same way as for compiling C programs (usually
1391 with the name @command{gcc}).
1395 However, the use of @command{gcc} does not add the C++ library.
1396 @command{g++} is a program that calls GCC and treats @samp{.c},
1397 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1398 files unless @option{-x} is used, and automatically specifies linking
1399 against the C++ library. This program is also useful when
1400 precompiling a C header file with a @samp{.h} extension for use in C++
1401 compilations. On many systems, @command{g++} is also installed with
1402 the name @command{c++}.
1404 @cindex invoking @command{g++}
1405 When you compile C++ programs, you may specify many of the same
1406 command-line options that you use for compiling programs in any
1407 language; or command-line options meaningful for C and related
1408 languages; or options that are meaningful only for C++ programs.
1409 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1410 explanations of options for languages related to C@.
1411 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1412 explanations of options that are meaningful only for C++ programs.
1414 @node C Dialect Options
1415 @section Options Controlling C Dialect
1416 @cindex dialect options
1417 @cindex language dialect options
1418 @cindex options, dialect
1420 The following options control the dialect of C (or languages derived
1421 from C, such as C++, Objective-C and Objective-C++) that the compiler
1425 @cindex ANSI support
1429 In C mode, this is equivalent to @samp{-std=c89}. In C++ mode, it is
1430 equivalent to @samp{-std=c++98}.
1432 This turns off certain features of GCC that are incompatible with ISO
1433 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1434 such as the @code{asm} and @code{typeof} keywords, and
1435 predefined macros such as @code{unix} and @code{vax} that identify the
1436 type of system you are using. It also enables the undesirable and
1437 rarely used ISO trigraph feature. For the C compiler,
1438 it disables recognition of C++ style @samp{//} comments as well as
1439 the @code{inline} keyword.
1441 The alternate keywords @code{__asm__}, @code{__extension__},
1442 @code{__inline__} and @code{__typeof__} continue to work despite
1443 @option{-ansi}. You would not want to use them in an ISO C program, of
1444 course, but it is useful to put them in header files that might be included
1445 in compilations done with @option{-ansi}. Alternate predefined macros
1446 such as @code{__unix__} and @code{__vax__} are also available, with or
1447 without @option{-ansi}.
1449 The @option{-ansi} option does not cause non-ISO programs to be
1450 rejected gratuitously. For that, @option{-pedantic} is required in
1451 addition to @option{-ansi}. @xref{Warning Options}.
1453 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1454 option is used. Some header files may notice this macro and refrain
1455 from declaring certain functions or defining certain macros that the
1456 ISO standard doesn't call for; this is to avoid interfering with any
1457 programs that might use these names for other things.
1459 Functions that would normally be built in but do not have semantics
1460 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1461 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1462 built-in functions provided by GCC}, for details of the functions
1467 Determine the language standard. @xref{Standards,,Language Standards
1468 Supported by GCC}, for details of these standard versions. This option
1469 is currently only supported when compiling C or C++.
1471 The compiler can accept several base standards, such as @samp{c89} or
1472 @samp{c++98}, and GNU dialects of those standards, such as
1473 @samp{gnu89} or @samp{gnu++98}. By specifying a base standard, the
1474 compiler will accept all programs following that standard and those
1475 using GNU extensions that do not contradict it. For example,
1476 @samp{-std=c89} turns off certain features of GCC that are
1477 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1478 keywords, but not other GNU extensions that do not have a meaning in
1479 ISO C90, such as omitting the middle term of a @code{?:}
1480 expression. On the other hand, by specifying a GNU dialect of a
1481 standard, all features the compiler support are enabled, even when
1482 those features change the meaning of the base standard and some
1483 strict-conforming programs may be rejected. The particular standard
1484 is used by @option{-pedantic} to identify which features are GNU
1485 extensions given that version of the standard. For example
1486 @samp{-std=gnu89 -pedantic} would warn about C++ style @samp{//}
1487 comments, while @samp{-std=gnu99 -pedantic} would not.
1489 A value for this option must be provided; possible values are
1494 Support all ISO C90 programs (certain GNU extensions that conflict
1495 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1497 @item iso9899:199409
1498 ISO C90 as modified in amendment 1.
1504 ISO C99. Note that this standard is not yet fully supported; see
1505 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1506 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1509 GNU dialect of ISO C90 (including some C99 features). This
1510 is the default for C code.
1514 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1515 this will become the default. The name @samp{gnu9x} is deprecated.
1518 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1522 GNU dialect of @option{-std=c++98}. This is the default for
1526 The working draft of the upcoming ISO C++0x standard. This option
1527 enables experimental features that are likely to be included in
1528 C++0x. The working draft is constantly changing, and any feature that is
1529 enabled by this flag may be removed from future versions of GCC if it is
1530 not part of the C++0x standard.
1533 GNU dialect of @option{-std=c++0x}. This option enables
1534 experimental features that may be removed in future versions of GCC.
1537 @item -fgnu89-inline
1538 @opindex fgnu89-inline
1539 The option @option{-fgnu89-inline} tells GCC to use the traditional
1540 GNU semantics for @code{inline} functions when in C99 mode.
1541 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1542 is accepted and ignored by GCC versions 4.1.3 up to but not including
1543 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1544 C99 mode. Using this option is roughly equivalent to adding the
1545 @code{gnu_inline} function attribute to all inline functions
1546 (@pxref{Function Attributes}).
1548 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1549 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1550 specifies the default behavior). This option was first supported in
1551 GCC 4.3. This option is not supported in C89 or gnu89 mode.
1553 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1554 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1555 in effect for @code{inline} functions. @xref{Common Predefined
1556 Macros,,,cpp,The C Preprocessor}.
1558 @item -aux-info @var{filename}
1560 Output to the given filename prototyped declarations for all functions
1561 declared and/or defined in a translation unit, including those in header
1562 files. This option is silently ignored in any language other than C@.
1564 Besides declarations, the file indicates, in comments, the origin of
1565 each declaration (source file and line), whether the declaration was
1566 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1567 @samp{O} for old, respectively, in the first character after the line
1568 number and the colon), and whether it came from a declaration or a
1569 definition (@samp{C} or @samp{F}, respectively, in the following
1570 character). In the case of function definitions, a K&R-style list of
1571 arguments followed by their declarations is also provided, inside
1572 comments, after the declaration.
1576 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1577 keyword, so that code can use these words as identifiers. You can use
1578 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1579 instead. @option{-ansi} implies @option{-fno-asm}.
1581 In C++, this switch only affects the @code{typeof} keyword, since
1582 @code{asm} and @code{inline} are standard keywords. You may want to
1583 use the @option{-fno-gnu-keywords} flag instead, which has the same
1584 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1585 switch only affects the @code{asm} and @code{typeof} keywords, since
1586 @code{inline} is a standard keyword in ISO C99.
1589 @itemx -fno-builtin-@var{function}
1590 @opindex fno-builtin
1591 @cindex built-in functions
1592 Don't recognize built-in functions that do not begin with
1593 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1594 functions provided by GCC}, for details of the functions affected,
1595 including those which are not built-in functions when @option{-ansi} or
1596 @option{-std} options for strict ISO C conformance are used because they
1597 do not have an ISO standard meaning.
1599 GCC normally generates special code to handle certain built-in functions
1600 more efficiently; for instance, calls to @code{alloca} may become single
1601 instructions that adjust the stack directly, and calls to @code{memcpy}
1602 may become inline copy loops. The resulting code is often both smaller
1603 and faster, but since the function calls no longer appear as such, you
1604 cannot set a breakpoint on those calls, nor can you change the behavior
1605 of the functions by linking with a different library. In addition,
1606 when a function is recognized as a built-in function, GCC may use
1607 information about that function to warn about problems with calls to
1608 that function, or to generate more efficient code, even if the
1609 resulting code still contains calls to that function. For example,
1610 warnings are given with @option{-Wformat} for bad calls to
1611 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1612 known not to modify global memory.
1614 With the @option{-fno-builtin-@var{function}} option
1615 only the built-in function @var{function} is
1616 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1617 function is named that is not built-in in this version of GCC, this
1618 option is ignored. There is no corresponding
1619 @option{-fbuiltin-@var{function}} option; if you wish to enable
1620 built-in functions selectively when using @option{-fno-builtin} or
1621 @option{-ffreestanding}, you may define macros such as:
1624 #define abs(n) __builtin_abs ((n))
1625 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1630 @cindex hosted environment
1632 Assert that compilation takes place in a hosted environment. This implies
1633 @option{-fbuiltin}. A hosted environment is one in which the
1634 entire standard library is available, and in which @code{main} has a return
1635 type of @code{int}. Examples are nearly everything except a kernel.
1636 This is equivalent to @option{-fno-freestanding}.
1638 @item -ffreestanding
1639 @opindex ffreestanding
1640 @cindex hosted environment
1642 Assert that compilation takes place in a freestanding environment. This
1643 implies @option{-fno-builtin}. A freestanding environment
1644 is one in which the standard library may not exist, and program startup may
1645 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1646 This is equivalent to @option{-fno-hosted}.
1648 @xref{Standards,,Language Standards Supported by GCC}, for details of
1649 freestanding and hosted environments.
1653 @cindex openmp parallel
1654 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1655 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1656 compiler generates parallel code according to the OpenMP Application
1657 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1658 implies @option{-pthread}, and thus is only supported on targets that
1659 have support for @option{-pthread}.
1661 @item -fms-extensions
1662 @opindex fms-extensions
1663 Accept some non-standard constructs used in Microsoft header files.
1665 Some cases of unnamed fields in structures and unions are only
1666 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1667 fields within structs/unions}, for details.
1671 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1672 options for strict ISO C conformance) implies @option{-trigraphs}.
1674 @item -no-integrated-cpp
1675 @opindex no-integrated-cpp
1676 Performs a compilation in two passes: preprocessing and compiling. This
1677 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1678 @option{-B} option. The user supplied compilation step can then add in
1679 an additional preprocessing step after normal preprocessing but before
1680 compiling. The default is to use the integrated cpp (internal cpp)
1682 The semantics of this option will change if "cc1", "cc1plus", and
1683 "cc1obj" are merged.
1685 @cindex traditional C language
1686 @cindex C language, traditional
1688 @itemx -traditional-cpp
1689 @opindex traditional-cpp
1690 @opindex traditional
1691 Formerly, these options caused GCC to attempt to emulate a pre-standard
1692 C compiler. They are now only supported with the @option{-E} switch.
1693 The preprocessor continues to support a pre-standard mode. See the GNU
1694 CPP manual for details.
1696 @item -fcond-mismatch
1697 @opindex fcond-mismatch
1698 Allow conditional expressions with mismatched types in the second and
1699 third arguments. The value of such an expression is void. This option
1700 is not supported for C++.
1702 @item -flax-vector-conversions
1703 @opindex flax-vector-conversions
1704 Allow implicit conversions between vectors with differing numbers of
1705 elements and/or incompatible element types. This option should not be
1708 @item -funsigned-char
1709 @opindex funsigned-char
1710 Let the type @code{char} be unsigned, like @code{unsigned char}.
1712 Each kind of machine has a default for what @code{char} should
1713 be. It is either like @code{unsigned char} by default or like
1714 @code{signed char} by default.
1716 Ideally, a portable program should always use @code{signed char} or
1717 @code{unsigned char} when it depends on the signedness of an object.
1718 But many programs have been written to use plain @code{char} and
1719 expect it to be signed, or expect it to be unsigned, depending on the
1720 machines they were written for. This option, and its inverse, let you
1721 make such a program work with the opposite default.
1723 The type @code{char} is always a distinct type from each of
1724 @code{signed char} or @code{unsigned char}, even though its behavior
1725 is always just like one of those two.
1728 @opindex fsigned-char
1729 Let the type @code{char} be signed, like @code{signed char}.
1731 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1732 the negative form of @option{-funsigned-char}. Likewise, the option
1733 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1735 @item -fsigned-bitfields
1736 @itemx -funsigned-bitfields
1737 @itemx -fno-signed-bitfields
1738 @itemx -fno-unsigned-bitfields
1739 @opindex fsigned-bitfields
1740 @opindex funsigned-bitfields
1741 @opindex fno-signed-bitfields
1742 @opindex fno-unsigned-bitfields
1743 These options control whether a bit-field is signed or unsigned, when the
1744 declaration does not use either @code{signed} or @code{unsigned}. By
1745 default, such a bit-field is signed, because this is consistent: the
1746 basic integer types such as @code{int} are signed types.
1749 @node C++ Dialect Options
1750 @section Options Controlling C++ Dialect
1752 @cindex compiler options, C++
1753 @cindex C++ options, command line
1754 @cindex options, C++
1755 This section describes the command-line options that are only meaningful
1756 for C++ programs; but you can also use most of the GNU compiler options
1757 regardless of what language your program is in. For example, you
1758 might compile a file @code{firstClass.C} like this:
1761 g++ -g -frepo -O -c firstClass.C
1765 In this example, only @option{-frepo} is an option meant
1766 only for C++ programs; you can use the other options with any
1767 language supported by GCC@.
1769 Here is a list of options that are @emph{only} for compiling C++ programs:
1773 @item -fabi-version=@var{n}
1774 @opindex fabi-version
1775 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1776 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1777 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1778 the version that conforms most closely to the C++ ABI specification.
1779 Therefore, the ABI obtained using version 0 will change as ABI bugs
1782 The default is version 2.
1784 @item -fno-access-control
1785 @opindex fno-access-control
1786 Turn off all access checking. This switch is mainly useful for working
1787 around bugs in the access control code.
1791 Check that the pointer returned by @code{operator new} is non-null
1792 before attempting to modify the storage allocated. This check is
1793 normally unnecessary because the C++ standard specifies that
1794 @code{operator new} will only return @code{0} if it is declared
1795 @samp{throw()}, in which case the compiler will always check the
1796 return value even without this option. In all other cases, when
1797 @code{operator new} has a non-empty exception specification, memory
1798 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1799 @samp{new (nothrow)}.
1801 @item -fconserve-space
1802 @opindex fconserve-space
1803 Put uninitialized or runtime-initialized global variables into the
1804 common segment, as C does. This saves space in the executable at the
1805 cost of not diagnosing duplicate definitions. If you compile with this
1806 flag and your program mysteriously crashes after @code{main()} has
1807 completed, you may have an object that is being destroyed twice because
1808 two definitions were merged.
1810 This option is no longer useful on most targets, now that support has
1811 been added for putting variables into BSS without making them common.
1813 @item -fno-deduce-init-list
1814 @opindex fno-deduce-init-list
1815 Disable deduction of a template type parameter as
1816 std::initializer_list from a brace-enclosed initializer list, i.e.
1819 template <class T> auto forward(T t) -> decltype (realfn (t))
1826 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1830 This option is present because this deduction is an extension to the
1831 current specification in the C++0x working draft, and there was
1832 some concern about potential overload resolution problems.
1834 @item -ffriend-injection
1835 @opindex ffriend-injection
1836 Inject friend functions into the enclosing namespace, so that they are
1837 visible outside the scope of the class in which they are declared.
1838 Friend functions were documented to work this way in the old Annotated
1839 C++ Reference Manual, and versions of G++ before 4.1 always worked
1840 that way. However, in ISO C++ a friend function which is not declared
1841 in an enclosing scope can only be found using argument dependent
1842 lookup. This option causes friends to be injected as they were in
1845 This option is for compatibility, and may be removed in a future
1848 @item -fno-elide-constructors
1849 @opindex fno-elide-constructors
1850 The C++ standard allows an implementation to omit creating a temporary
1851 which is only used to initialize another object of the same type.
1852 Specifying this option disables that optimization, and forces G++ to
1853 call the copy constructor in all cases.
1855 @item -fno-enforce-eh-specs
1856 @opindex fno-enforce-eh-specs
1857 Don't generate code to check for violation of exception specifications
1858 at runtime. This option violates the C++ standard, but may be useful
1859 for reducing code size in production builds, much like defining
1860 @samp{NDEBUG}. This does not give user code permission to throw
1861 exceptions in violation of the exception specifications; the compiler
1862 will still optimize based on the specifications, so throwing an
1863 unexpected exception will result in undefined behavior.
1866 @itemx -fno-for-scope
1868 @opindex fno-for-scope
1869 If @option{-ffor-scope} is specified, the scope of variables declared in
1870 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1871 as specified by the C++ standard.
1872 If @option{-fno-for-scope} is specified, the scope of variables declared in
1873 a @i{for-init-statement} extends to the end of the enclosing scope,
1874 as was the case in old versions of G++, and other (traditional)
1875 implementations of C++.
1877 The default if neither flag is given to follow the standard,
1878 but to allow and give a warning for old-style code that would
1879 otherwise be invalid, or have different behavior.
1881 @item -fno-gnu-keywords
1882 @opindex fno-gnu-keywords
1883 Do not recognize @code{typeof} as a keyword, so that code can use this
1884 word as an identifier. You can use the keyword @code{__typeof__} instead.
1885 @option{-ansi} implies @option{-fno-gnu-keywords}.
1887 @item -fno-implicit-templates
1888 @opindex fno-implicit-templates
1889 Never emit code for non-inline templates which are instantiated
1890 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1891 @xref{Template Instantiation}, for more information.
1893 @item -fno-implicit-inline-templates
1894 @opindex fno-implicit-inline-templates
1895 Don't emit code for implicit instantiations of inline templates, either.
1896 The default is to handle inlines differently so that compiles with and
1897 without optimization will need the same set of explicit instantiations.
1899 @item -fno-implement-inlines
1900 @opindex fno-implement-inlines
1901 To save space, do not emit out-of-line copies of inline functions
1902 controlled by @samp{#pragma implementation}. This will cause linker
1903 errors if these functions are not inlined everywhere they are called.
1905 @item -fms-extensions
1906 @opindex fms-extensions
1907 Disable pedantic warnings about constructs used in MFC, such as implicit
1908 int and getting a pointer to member function via non-standard syntax.
1910 @item -fno-nonansi-builtins
1911 @opindex fno-nonansi-builtins
1912 Disable built-in declarations of functions that are not mandated by
1913 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
1914 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1916 @item -fno-operator-names
1917 @opindex fno-operator-names
1918 Do not treat the operator name keywords @code{and}, @code{bitand},
1919 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
1920 synonyms as keywords.
1922 @item -fno-optional-diags
1923 @opindex fno-optional-diags
1924 Disable diagnostics that the standard says a compiler does not need to
1925 issue. Currently, the only such diagnostic issued by G++ is the one for
1926 a name having multiple meanings within a class.
1929 @opindex fpermissive
1930 Downgrade some diagnostics about nonconformant code from errors to
1931 warnings. Thus, using @option{-fpermissive} will allow some
1932 nonconforming code to compile.
1934 @item -fno-pretty-templates
1935 @opindex fno-pretty-templates
1936 When an error message refers to a specialization of a function
1937 template, the compiler will normally print the signature of the
1938 template followed by the template arguments and any typedefs or
1939 typenames in the signature (e.g. @code{void f(T) [with T = int]}
1940 rather than @code{void f(int)}) so that it's clear which template is
1941 involved. When an error message refers to a specialization of a class
1942 template, the compiler will omit any template arguments which match
1943 the default template arguments for that template. If either of these
1944 behaviors make it harder to understand the error message rather than
1945 easier, using @option{-fno-pretty-templates} will disable them.
1949 Enable automatic template instantiation at link time. This option also
1950 implies @option{-fno-implicit-templates}. @xref{Template
1951 Instantiation}, for more information.
1955 Disable generation of information about every class with virtual
1956 functions for use by the C++ runtime type identification features
1957 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
1958 of the language, you can save some space by using this flag. Note that
1959 exception handling uses the same information, but it will generate it as
1960 needed. The @samp{dynamic_cast} operator can still be used for casts that
1961 do not require runtime type information, i.e.@: casts to @code{void *} or to
1962 unambiguous base classes.
1966 Emit statistics about front-end processing at the end of the compilation.
1967 This information is generally only useful to the G++ development team.
1969 @item -ftemplate-depth-@var{n}
1970 @opindex ftemplate-depth
1971 Set the maximum instantiation depth for template classes to @var{n}.
1972 A limit on the template instantiation depth is needed to detect
1973 endless recursions during template class instantiation. ANSI/ISO C++
1974 conforming programs must not rely on a maximum depth greater than 17
1975 (changed to 1024 in C++0x).
1977 @item -fno-threadsafe-statics
1978 @opindex fno-threadsafe-statics
1979 Do not emit the extra code to use the routines specified in the C++
1980 ABI for thread-safe initialization of local statics. You can use this
1981 option to reduce code size slightly in code that doesn't need to be
1984 @item -fuse-cxa-atexit
1985 @opindex fuse-cxa-atexit
1986 Register destructors for objects with static storage duration with the
1987 @code{__cxa_atexit} function rather than the @code{atexit} function.
1988 This option is required for fully standards-compliant handling of static
1989 destructors, but will only work if your C library supports
1990 @code{__cxa_atexit}.
1992 @item -fno-use-cxa-get-exception-ptr
1993 @opindex fno-use-cxa-get-exception-ptr
1994 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
1995 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
1996 if the runtime routine is not available.
1998 @item -fvisibility-inlines-hidden
1999 @opindex fvisibility-inlines-hidden
2000 This switch declares that the user does not attempt to compare
2001 pointers to inline methods where the addresses of the two functions
2002 were taken in different shared objects.
2004 The effect of this is that GCC may, effectively, mark inline methods with
2005 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2006 appear in the export table of a DSO and do not require a PLT indirection
2007 when used within the DSO@. Enabling this option can have a dramatic effect
2008 on load and link times of a DSO as it massively reduces the size of the
2009 dynamic export table when the library makes heavy use of templates.
2011 The behavior of this switch is not quite the same as marking the
2012 methods as hidden directly, because it does not affect static variables
2013 local to the function or cause the compiler to deduce that
2014 the function is defined in only one shared object.
2016 You may mark a method as having a visibility explicitly to negate the
2017 effect of the switch for that method. For example, if you do want to
2018 compare pointers to a particular inline method, you might mark it as
2019 having default visibility. Marking the enclosing class with explicit
2020 visibility will have no effect.
2022 Explicitly instantiated inline methods are unaffected by this option
2023 as their linkage might otherwise cross a shared library boundary.
2024 @xref{Template Instantiation}.
2026 @item -fvisibility-ms-compat
2027 @opindex fvisibility-ms-compat
2028 This flag attempts to use visibility settings to make GCC's C++
2029 linkage model compatible with that of Microsoft Visual Studio.
2031 The flag makes these changes to GCC's linkage model:
2035 It sets the default visibility to @code{hidden}, like
2036 @option{-fvisibility=hidden}.
2039 Types, but not their members, are not hidden by default.
2042 The One Definition Rule is relaxed for types without explicit
2043 visibility specifications which are defined in more than one different
2044 shared object: those declarations are permitted if they would have
2045 been permitted when this option was not used.
2048 In new code it is better to use @option{-fvisibility=hidden} and
2049 export those classes which are intended to be externally visible.
2050 Unfortunately it is possible for code to rely, perhaps accidentally,
2051 on the Visual Studio behavior.
2053 Among the consequences of these changes are that static data members
2054 of the same type with the same name but defined in different shared
2055 objects will be different, so changing one will not change the other;
2056 and that pointers to function members defined in different shared
2057 objects may not compare equal. When this flag is given, it is a
2058 violation of the ODR to define types with the same name differently.
2062 Do not use weak symbol support, even if it is provided by the linker.
2063 By default, G++ will use weak symbols if they are available. This
2064 option exists only for testing, and should not be used by end-users;
2065 it will result in inferior code and has no benefits. This option may
2066 be removed in a future release of G++.
2070 Do not search for header files in the standard directories specific to
2071 C++, but do still search the other standard directories. (This option
2072 is used when building the C++ library.)
2075 In addition, these optimization, warning, and code generation options
2076 have meanings only for C++ programs:
2079 @item -fno-default-inline
2080 @opindex fno-default-inline
2081 Do not assume @samp{inline} for functions defined inside a class scope.
2082 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2083 functions will have linkage like inline functions; they just won't be
2086 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2089 Warn when G++ generates code that is probably not compatible with the
2090 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2091 all such cases, there are probably some cases that are not warned about,
2092 even though G++ is generating incompatible code. There may also be
2093 cases where warnings are emitted even though the code that is generated
2096 You should rewrite your code to avoid these warnings if you are
2097 concerned about the fact that code generated by G++ may not be binary
2098 compatible with code generated by other compilers.
2100 The known incompatibilities at this point include:
2105 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2106 pack data into the same byte as a base class. For example:
2109 struct A @{ virtual void f(); int f1 : 1; @};
2110 struct B : public A @{ int f2 : 1; @};
2114 In this case, G++ will place @code{B::f2} into the same byte
2115 as@code{A::f1}; other compilers will not. You can avoid this problem
2116 by explicitly padding @code{A} so that its size is a multiple of the
2117 byte size on your platform; that will cause G++ and other compilers to
2118 layout @code{B} identically.
2121 Incorrect handling of tail-padding for virtual bases. G++ does not use
2122 tail padding when laying out virtual bases. For example:
2125 struct A @{ virtual void f(); char c1; @};
2126 struct B @{ B(); char c2; @};
2127 struct C : public A, public virtual B @{@};
2131 In this case, G++ will not place @code{B} into the tail-padding for
2132 @code{A}; other compilers will. You can avoid this problem by
2133 explicitly padding @code{A} so that its size is a multiple of its
2134 alignment (ignoring virtual base classes); that will cause G++ and other
2135 compilers to layout @code{C} identically.
2138 Incorrect handling of bit-fields with declared widths greater than that
2139 of their underlying types, when the bit-fields appear in a union. For
2143 union U @{ int i : 4096; @};
2147 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2148 union too small by the number of bits in an @code{int}.
2151 Empty classes can be placed at incorrect offsets. For example:
2161 struct C : public B, public A @{@};
2165 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2166 it should be placed at offset zero. G++ mistakenly believes that the
2167 @code{A} data member of @code{B} is already at offset zero.
2170 Names of template functions whose types involve @code{typename} or
2171 template template parameters can be mangled incorrectly.
2174 template <typename Q>
2175 void f(typename Q::X) @{@}
2177 template <template <typename> class Q>
2178 void f(typename Q<int>::X) @{@}
2182 Instantiations of these templates may be mangled incorrectly.
2186 It also warns psABI related changes. The known psABI changes at this
2192 For SYSV/x86-64, when passing union with long double, it is changed to
2193 pass in memory as specified in psABI. For example:
2203 @code{union U} will always be passed in memory.
2207 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2208 @opindex Wctor-dtor-privacy
2209 @opindex Wno-ctor-dtor-privacy
2210 Warn when a class seems unusable because all the constructors or
2211 destructors in that class are private, and it has neither friends nor
2212 public static member functions.
2214 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2215 @opindex Wnon-virtual-dtor
2216 @opindex Wno-non-virtual-dtor
2217 Warn when a class has virtual functions and accessible non-virtual
2218 destructor, in which case it would be possible but unsafe to delete
2219 an instance of a derived class through a pointer to the base class.
2220 This warning is also enabled if -Weffc++ is specified.
2222 @item -Wreorder @r{(C++ and Objective-C++ only)}
2224 @opindex Wno-reorder
2225 @cindex reordering, warning
2226 @cindex warning for reordering of member initializers
2227 Warn when the order of member initializers given in the code does not
2228 match the order in which they must be executed. For instance:
2234 A(): j (0), i (1) @{ @}
2238 The compiler will rearrange the member initializers for @samp{i}
2239 and @samp{j} to match the declaration order of the members, emitting
2240 a warning to that effect. This warning is enabled by @option{-Wall}.
2243 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2246 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2249 Warn about violations of the following style guidelines from Scott Meyers'
2250 @cite{Effective C++} book:
2254 Item 11: Define a copy constructor and an assignment operator for classes
2255 with dynamically allocated memory.
2258 Item 12: Prefer initialization to assignment in constructors.
2261 Item 14: Make destructors virtual in base classes.
2264 Item 15: Have @code{operator=} return a reference to @code{*this}.
2267 Item 23: Don't try to return a reference when you must return an object.
2271 Also warn about violations of the following style guidelines from
2272 Scott Meyers' @cite{More Effective C++} book:
2276 Item 6: Distinguish between prefix and postfix forms of increment and
2277 decrement operators.
2280 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2284 When selecting this option, be aware that the standard library
2285 headers do not obey all of these guidelines; use @samp{grep -v}
2286 to filter out those warnings.
2288 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2289 @opindex Wstrict-null-sentinel
2290 @opindex Wno-strict-null-sentinel
2291 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2292 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2293 to @code{__null}. Although it is a null pointer constant not a null pointer,
2294 it is guaranteed to be of the same size as a pointer. But this use is
2295 not portable across different compilers.
2297 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2298 @opindex Wno-non-template-friend
2299 @opindex Wnon-template-friend
2300 Disable warnings when non-templatized friend functions are declared
2301 within a template. Since the advent of explicit template specification
2302 support in G++, if the name of the friend is an unqualified-id (i.e.,
2303 @samp{friend foo(int)}), the C++ language specification demands that the
2304 friend declare or define an ordinary, nontemplate function. (Section
2305 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2306 could be interpreted as a particular specialization of a templatized
2307 function. Because this non-conforming behavior is no longer the default
2308 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2309 check existing code for potential trouble spots and is on by default.
2310 This new compiler behavior can be turned off with
2311 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2312 but disables the helpful warning.
2314 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2315 @opindex Wold-style-cast
2316 @opindex Wno-old-style-cast
2317 Warn if an old-style (C-style) cast to a non-void type is used within
2318 a C++ program. The new-style casts (@samp{dynamic_cast},
2319 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2320 less vulnerable to unintended effects and much easier to search for.
2322 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2323 @opindex Woverloaded-virtual
2324 @opindex Wno-overloaded-virtual
2325 @cindex overloaded virtual fn, warning
2326 @cindex warning for overloaded virtual fn
2327 Warn when a function declaration hides virtual functions from a
2328 base class. For example, in:
2335 struct B: public A @{
2340 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2348 will fail to compile.
2350 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2351 @opindex Wno-pmf-conversions
2352 @opindex Wpmf-conversions
2353 Disable the diagnostic for converting a bound pointer to member function
2356 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2357 @opindex Wsign-promo
2358 @opindex Wno-sign-promo
2359 Warn when overload resolution chooses a promotion from unsigned or
2360 enumerated type to a signed type, over a conversion to an unsigned type of
2361 the same size. Previous versions of G++ would try to preserve
2362 unsignedness, but the standard mandates the current behavior.
2367 A& operator = (int);
2377 In this example, G++ will synthesize a default @samp{A& operator =
2378 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2381 @node Objective-C and Objective-C++ Dialect Options
2382 @section Options Controlling Objective-C and Objective-C++ Dialects
2384 @cindex compiler options, Objective-C and Objective-C++
2385 @cindex Objective-C and Objective-C++ options, command line
2386 @cindex options, Objective-C and Objective-C++
2387 (NOTE: This manual does not describe the Objective-C and Objective-C++
2388 languages themselves. See @xref{Standards,,Language Standards
2389 Supported by GCC}, for references.)
2391 This section describes the command-line options that are only meaningful
2392 for Objective-C and Objective-C++ programs, but you can also use most of
2393 the language-independent GNU compiler options.
2394 For example, you might compile a file @code{some_class.m} like this:
2397 gcc -g -fgnu-runtime -O -c some_class.m
2401 In this example, @option{-fgnu-runtime} is an option meant only for
2402 Objective-C and Objective-C++ programs; you can use the other options with
2403 any language supported by GCC@.
2405 Note that since Objective-C is an extension of the C language, Objective-C
2406 compilations may also use options specific to the C front-end (e.g.,
2407 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2408 C++-specific options (e.g., @option{-Wabi}).
2410 Here is a list of options that are @emph{only} for compiling Objective-C
2411 and Objective-C++ programs:
2414 @item -fconstant-string-class=@var{class-name}
2415 @opindex fconstant-string-class
2416 Use @var{class-name} as the name of the class to instantiate for each
2417 literal string specified with the syntax @code{@@"@dots{}"}. The default
2418 class name is @code{NXConstantString} if the GNU runtime is being used, and
2419 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2420 @option{-fconstant-cfstrings} option, if also present, will override the
2421 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2422 to be laid out as constant CoreFoundation strings.
2425 @opindex fgnu-runtime
2426 Generate object code compatible with the standard GNU Objective-C
2427 runtime. This is the default for most types of systems.
2429 @item -fnext-runtime
2430 @opindex fnext-runtime
2431 Generate output compatible with the NeXT runtime. This is the default
2432 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2433 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2436 @item -fno-nil-receivers
2437 @opindex fno-nil-receivers
2438 Assume that all Objective-C message dispatches (e.g.,
2439 @code{[receiver message:arg]}) in this translation unit ensure that the receiver
2440 is not @code{nil}. This allows for more efficient entry points in the runtime
2441 to be used. Currently, this option is only available in conjunction with
2442 the NeXT runtime on Mac OS X 10.3 and later.
2444 @item -fobjc-call-cxx-cdtors
2445 @opindex fobjc-call-cxx-cdtors
2446 For each Objective-C class, check if any of its instance variables is a
2447 C++ object with a non-trivial default constructor. If so, synthesize a
2448 special @code{- (id) .cxx_construct} instance method that will run
2449 non-trivial default constructors on any such instance variables, in order,
2450 and then return @code{self}. Similarly, check if any instance variable
2451 is a C++ object with a non-trivial destructor, and if so, synthesize a
2452 special @code{- (void) .cxx_destruct} method that will run
2453 all such default destructors, in reverse order.
2455 The @code{- (id) .cxx_construct} and/or @code{- (void) .cxx_destruct} methods
2456 thusly generated will only operate on instance variables declared in the
2457 current Objective-C class, and not those inherited from superclasses. It
2458 is the responsibility of the Objective-C runtime to invoke all such methods
2459 in an object's inheritance hierarchy. The @code{- (id) .cxx_construct} methods
2460 will be invoked by the runtime immediately after a new object
2461 instance is allocated; the @code{- (void) .cxx_destruct} methods will
2462 be invoked immediately before the runtime deallocates an object instance.
2464 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2465 support for invoking the @code{- (id) .cxx_construct} and
2466 @code{- (void) .cxx_destruct} methods.
2468 @item -fobjc-direct-dispatch
2469 @opindex fobjc-direct-dispatch
2470 Allow fast jumps to the message dispatcher. On Darwin this is
2471 accomplished via the comm page.
2473 @item -fobjc-exceptions
2474 @opindex fobjc-exceptions
2475 Enable syntactic support for structured exception handling in Objective-C,
2476 similar to what is offered by C++ and Java. This option is
2477 unavailable in conjunction with the NeXT runtime on Mac OS X 10.2 and
2486 @@catch (AnObjCClass *exc) @{
2493 @@catch (AnotherClass *exc) @{
2496 @@catch (id allOthers) @{
2506 The @code{@@throw} statement may appear anywhere in an Objective-C or
2507 Objective-C++ program; when used inside of a @code{@@catch} block, the
2508 @code{@@throw} may appear without an argument (as shown above), in which case
2509 the object caught by the @code{@@catch} will be rethrown.
2511 Note that only (pointers to) Objective-C objects may be thrown and
2512 caught using this scheme. When an object is thrown, it will be caught
2513 by the nearest @code{@@catch} clause capable of handling objects of that type,
2514 analogously to how @code{catch} blocks work in C++ and Java. A
2515 @code{@@catch(id @dots{})} clause (as shown above) may also be provided to catch
2516 any and all Objective-C exceptions not caught by previous @code{@@catch}
2519 The @code{@@finally} clause, if present, will be executed upon exit from the
2520 immediately preceding @code{@@try @dots{} @@catch} section. This will happen
2521 regardless of whether any exceptions are thrown, caught or rethrown
2522 inside the @code{@@try @dots{} @@catch} section, analogously to the behavior
2523 of the @code{finally} clause in Java.
2525 There are several caveats to using the new exception mechanism:
2529 Although currently designed to be binary compatible with @code{NS_HANDLER}-style
2530 idioms provided by the @code{NSException} class, the new
2531 exceptions can only be used on Mac OS X 10.3 (Panther) and later
2532 systems, due to additional functionality needed in the (NeXT) Objective-C
2536 As mentioned above, the new exceptions do not support handling
2537 types other than Objective-C objects. Furthermore, when used from
2538 Objective-C++, the Objective-C exception model does not interoperate with C++
2539 exceptions at this time. This means you cannot @code{@@throw} an exception
2540 from Objective-C and @code{catch} it in C++, or vice versa
2541 (i.e., @code{throw @dots{} @@catch}).
2544 The @option{-fobjc-exceptions} switch also enables the use of synchronization
2545 blocks for thread-safe execution:
2548 @@synchronized (ObjCClass *guard) @{
2553 Upon entering the @code{@@synchronized} block, a thread of execution shall
2554 first check whether a lock has been placed on the corresponding @code{guard}
2555 object by another thread. If it has, the current thread shall wait until
2556 the other thread relinquishes its lock. Once @code{guard} becomes available,
2557 the current thread will place its own lock on it, execute the code contained in
2558 the @code{@@synchronized} block, and finally relinquish the lock (thereby
2559 making @code{guard} available to other threads).
2561 Unlike Java, Objective-C does not allow for entire methods to be marked
2562 @code{@@synchronized}. Note that throwing exceptions out of
2563 @code{@@synchronized} blocks is allowed, and will cause the guarding object
2564 to be unlocked properly.
2568 Enable garbage collection (GC) in Objective-C and Objective-C++ programs.
2570 @item -freplace-objc-classes
2571 @opindex freplace-objc-classes
2572 Emit a special marker instructing @command{ld(1)} not to statically link in
2573 the resulting object file, and allow @command{dyld(1)} to load it in at
2574 run time instead. This is used in conjunction with the Fix-and-Continue
2575 debugging mode, where the object file in question may be recompiled and
2576 dynamically reloaded in the course of program execution, without the need
2577 to restart the program itself. Currently, Fix-and-Continue functionality
2578 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2583 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2584 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2585 compile time) with static class references that get initialized at load time,
2586 which improves run-time performance. Specifying the @option{-fzero-link} flag
2587 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2588 to be retained. This is useful in Zero-Link debugging mode, since it allows
2589 for individual class implementations to be modified during program execution.
2593 Dump interface declarations for all classes seen in the source file to a
2594 file named @file{@var{sourcename}.decl}.
2596 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2597 @opindex Wassign-intercept
2598 @opindex Wno-assign-intercept
2599 Warn whenever an Objective-C assignment is being intercepted by the
2602 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2603 @opindex Wno-protocol
2605 If a class is declared to implement a protocol, a warning is issued for
2606 every method in the protocol that is not implemented by the class. The
2607 default behavior is to issue a warning for every method not explicitly
2608 implemented in the class, even if a method implementation is inherited
2609 from the superclass. If you use the @option{-Wno-protocol} option, then
2610 methods inherited from the superclass are considered to be implemented,
2611 and no warning is issued for them.
2613 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2615 @opindex Wno-selector
2616 Warn if multiple methods of different types for the same selector are
2617 found during compilation. The check is performed on the list of methods
2618 in the final stage of compilation. Additionally, a check is performed
2619 for each selector appearing in a @code{@@selector(@dots{})}
2620 expression, and a corresponding method for that selector has been found
2621 during compilation. Because these checks scan the method table only at
2622 the end of compilation, these warnings are not produced if the final
2623 stage of compilation is not reached, for example because an error is
2624 found during compilation, or because the @option{-fsyntax-only} option is
2627 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2628 @opindex Wstrict-selector-match
2629 @opindex Wno-strict-selector-match
2630 Warn if multiple methods with differing argument and/or return types are
2631 found for a given selector when attempting to send a message using this
2632 selector to a receiver of type @code{id} or @code{Class}. When this flag
2633 is off (which is the default behavior), the compiler will omit such warnings
2634 if any differences found are confined to types which share the same size
2637 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2638 @opindex Wundeclared-selector
2639 @opindex Wno-undeclared-selector
2640 Warn if a @code{@@selector(@dots{})} expression referring to an
2641 undeclared selector is found. A selector is considered undeclared if no
2642 method with that name has been declared before the
2643 @code{@@selector(@dots{})} expression, either explicitly in an
2644 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2645 an @code{@@implementation} section. This option always performs its
2646 checks as soon as a @code{@@selector(@dots{})} expression is found,
2647 while @option{-Wselector} only performs its checks in the final stage of
2648 compilation. This also enforces the coding style convention
2649 that methods and selectors must be declared before being used.
2651 @item -print-objc-runtime-info
2652 @opindex print-objc-runtime-info
2653 Generate C header describing the largest structure that is passed by
2658 @node Language Independent Options
2659 @section Options to Control Diagnostic Messages Formatting
2660 @cindex options to control diagnostics formatting
2661 @cindex diagnostic messages
2662 @cindex message formatting
2664 Traditionally, diagnostic messages have been formatted irrespective of
2665 the output device's aspect (e.g.@: its width, @dots{}). The options described
2666 below can be used to control the diagnostic messages formatting
2667 algorithm, e.g.@: how many characters per line, how often source location
2668 information should be reported. Right now, only the C++ front end can
2669 honor these options. However it is expected, in the near future, that
2670 the remaining front ends would be able to digest them correctly.
2673 @item -fmessage-length=@var{n}
2674 @opindex fmessage-length
2675 Try to format error messages so that they fit on lines of about @var{n}
2676 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2677 the front ends supported by GCC@. If @var{n} is zero, then no
2678 line-wrapping will be done; each error message will appear on a single
2681 @opindex fdiagnostics-show-location
2682 @item -fdiagnostics-show-location=once
2683 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2684 reporter to emit @emph{once} source location information; that is, in
2685 case the message is too long to fit on a single physical line and has to
2686 be wrapped, the source location won't be emitted (as prefix) again,
2687 over and over, in subsequent continuation lines. This is the default
2690 @item -fdiagnostics-show-location=every-line
2691 Only meaningful in line-wrapping mode. Instructs the diagnostic
2692 messages reporter to emit the same source location information (as
2693 prefix) for physical lines that result from the process of breaking
2694 a message which is too long to fit on a single line.
2696 @item -fdiagnostics-show-option
2697 @opindex fdiagnostics-show-option
2698 This option instructs the diagnostic machinery to add text to each
2699 diagnostic emitted, which indicates which command line option directly
2700 controls that diagnostic, when such an option is known to the
2701 diagnostic machinery.
2703 @item -Wcoverage-mismatch
2704 @opindex Wcoverage-mismatch
2705 Warn if feedback profiles do not match when using the
2706 @option{-fprofile-use} option.
2707 If a source file was changed between @option{-fprofile-gen} and
2708 @option{-fprofile-use}, the files with the profile feedback can fail
2709 to match the source file and GCC can not use the profile feedback
2710 information. By default, GCC emits an error message in this case.
2711 The option @option{-Wcoverage-mismatch} emits a warning instead of an
2712 error. GCC does not use appropriate feedback profiles, so using this
2713 option can result in poorly optimized code. This option is useful
2714 only in the case of very minor changes such as bug fixes to an
2719 @node Warning Options
2720 @section Options to Request or Suppress Warnings
2721 @cindex options to control warnings
2722 @cindex warning messages
2723 @cindex messages, warning
2724 @cindex suppressing warnings
2726 Warnings are diagnostic messages that report constructions which
2727 are not inherently erroneous but which are risky or suggest there
2728 may have been an error.
2730 The following language-independent options do not enable specific
2731 warnings but control the kinds of diagnostics produced by GCC.
2734 @cindex syntax checking
2736 @opindex fsyntax-only
2737 Check the code for syntax errors, but don't do anything beyond that.
2741 Inhibit all warning messages.
2746 Make all warnings into errors.
2751 Make the specified warning into an error. The specifier for a warning
2752 is appended, for example @option{-Werror=switch} turns the warnings
2753 controlled by @option{-Wswitch} into errors. This switch takes a
2754 negative form, to be used to negate @option{-Werror} for specific
2755 warnings, for example @option{-Wno-error=switch} makes
2756 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2757 is in effect. You can use the @option{-fdiagnostics-show-option}
2758 option to have each controllable warning amended with the option which
2759 controls it, to determine what to use with this option.
2761 Note that specifying @option{-Werror=}@var{foo} automatically implies
2762 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2765 @item -Wfatal-errors
2766 @opindex Wfatal-errors
2767 @opindex Wno-fatal-errors
2768 This option causes the compiler to abort compilation on the first error
2769 occurred rather than trying to keep going and printing further error
2774 You can request many specific warnings with options beginning
2775 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2776 implicit declarations. Each of these specific warning options also
2777 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2778 example, @option{-Wno-implicit}. This manual lists only one of the
2779 two forms, whichever is not the default. For further,
2780 language-specific options also refer to @ref{C++ Dialect Options} and
2781 @ref{Objective-C and Objective-C++ Dialect Options}.
2786 Issue all the warnings demanded by strict ISO C and ISO C++;
2787 reject all programs that use forbidden extensions, and some other
2788 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2789 version of the ISO C standard specified by any @option{-std} option used.
2791 Valid ISO C and ISO C++ programs should compile properly with or without
2792 this option (though a rare few will require @option{-ansi} or a
2793 @option{-std} option specifying the required version of ISO C)@. However,
2794 without this option, certain GNU extensions and traditional C and C++
2795 features are supported as well. With this option, they are rejected.
2797 @option{-pedantic} does not cause warning messages for use of the
2798 alternate keywords whose names begin and end with @samp{__}. Pedantic
2799 warnings are also disabled in the expression that follows
2800 @code{__extension__}. However, only system header files should use
2801 these escape routes; application programs should avoid them.
2802 @xref{Alternate Keywords}.
2804 Some users try to use @option{-pedantic} to check programs for strict ISO
2805 C conformance. They soon find that it does not do quite what they want:
2806 it finds some non-ISO practices, but not all---only those for which
2807 ISO C @emph{requires} a diagnostic, and some others for which
2808 diagnostics have been added.
2810 A feature to report any failure to conform to ISO C might be useful in
2811 some instances, but would require considerable additional work and would
2812 be quite different from @option{-pedantic}. We don't have plans to
2813 support such a feature in the near future.
2815 Where the standard specified with @option{-std} represents a GNU
2816 extended dialect of C, such as @samp{gnu89} or @samp{gnu99}, there is a
2817 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2818 extended dialect is based. Warnings from @option{-pedantic} are given
2819 where they are required by the base standard. (It would not make sense
2820 for such warnings to be given only for features not in the specified GNU
2821 C dialect, since by definition the GNU dialects of C include all
2822 features the compiler supports with the given option, and there would be
2823 nothing to warn about.)
2825 @item -pedantic-errors
2826 @opindex pedantic-errors
2827 Like @option{-pedantic}, except that errors are produced rather than
2833 This enables all the warnings about constructions that some users
2834 consider questionable, and that are easy to avoid (or modify to
2835 prevent the warning), even in conjunction with macros. This also
2836 enables some language-specific warnings described in @ref{C++ Dialect
2837 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2839 @option{-Wall} turns on the following warning flags:
2841 @gccoptlist{-Waddress @gol
2842 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
2844 -Wchar-subscripts @gol
2845 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2847 -Wimplicit-function-declaration @gol
2850 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
2851 -Wmissing-braces @gol
2857 -Wsequence-point @gol
2858 -Wsign-compare @r{(only in C++)} @gol
2859 -Wstrict-aliasing @gol
2860 -Wstrict-overflow=1 @gol
2863 -Wuninitialized @gol
2864 -Wunknown-pragmas @gol
2865 -Wunused-function @gol
2868 -Wunused-variable @gol
2869 -Wvolatile-register-var @gol
2872 Note that some warning flags are not implied by @option{-Wall}. Some of
2873 them warn about constructions that users generally do not consider
2874 questionable, but which occasionally you might wish to check for;
2875 others warn about constructions that are necessary or hard to avoid in
2876 some cases, and there is no simple way to modify the code to suppress
2877 the warning. Some of them are enabled by @option{-Wextra} but many of
2878 them must be enabled individually.
2884 This enables some extra warning flags that are not enabled by
2885 @option{-Wall}. (This option used to be called @option{-W}. The older
2886 name is still supported, but the newer name is more descriptive.)
2888 @gccoptlist{-Wclobbered @gol
2890 -Wignored-qualifiers @gol
2891 -Wmissing-field-initializers @gol
2892 -Wmissing-parameter-type @r{(C only)} @gol
2893 -Wold-style-declaration @r{(C only)} @gol
2894 -Woverride-init @gol
2897 -Wuninitialized @gol
2898 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
2901 The option @option{-Wextra} also prints warning messages for the
2907 A pointer is compared against integer zero with @samp{<}, @samp{<=},
2908 @samp{>}, or @samp{>=}.
2911 (C++ only) An enumerator and a non-enumerator both appear in a
2912 conditional expression.
2915 (C++ only) Ambiguous virtual bases.
2918 (C++ only) Subscripting an array which has been declared @samp{register}.
2921 (C++ only) Taking the address of a variable which has been declared
2925 (C++ only) A base class is not initialized in a derived class' copy
2930 @item -Wchar-subscripts
2931 @opindex Wchar-subscripts
2932 @opindex Wno-char-subscripts
2933 Warn if an array subscript has type @code{char}. This is a common cause
2934 of error, as programmers often forget that this type is signed on some
2936 This warning is enabled by @option{-Wall}.
2940 @opindex Wno-comment
2941 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
2942 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
2943 This warning is enabled by @option{-Wall}.
2948 @opindex ffreestanding
2949 @opindex fno-builtin
2950 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
2951 the arguments supplied have types appropriate to the format string
2952 specified, and that the conversions specified in the format string make
2953 sense. This includes standard functions, and others specified by format
2954 attributes (@pxref{Function Attributes}), in the @code{printf},
2955 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
2956 not in the C standard) families (or other target-specific families).
2957 Which functions are checked without format attributes having been
2958 specified depends on the standard version selected, and such checks of
2959 functions without the attribute specified are disabled by
2960 @option{-ffreestanding} or @option{-fno-builtin}.
2962 The formats are checked against the format features supported by GNU
2963 libc version 2.2. These include all ISO C90 and C99 features, as well
2964 as features from the Single Unix Specification and some BSD and GNU
2965 extensions. Other library implementations may not support all these
2966 features; GCC does not support warning about features that go beyond a
2967 particular library's limitations. However, if @option{-pedantic} is used
2968 with @option{-Wformat}, warnings will be given about format features not
2969 in the selected standard version (but not for @code{strfmon} formats,
2970 since those are not in any version of the C standard). @xref{C Dialect
2971 Options,,Options Controlling C Dialect}.
2973 Since @option{-Wformat} also checks for null format arguments for
2974 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
2976 @option{-Wformat} is included in @option{-Wall}. For more control over some
2977 aspects of format checking, the options @option{-Wformat-y2k},
2978 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
2979 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
2980 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
2983 @opindex Wformat-y2k
2984 @opindex Wno-format-y2k
2985 If @option{-Wformat} is specified, also warn about @code{strftime}
2986 formats which may yield only a two-digit year.
2988 @item -Wno-format-contains-nul
2989 @opindex Wno-format-contains-nul
2990 @opindex Wformat-contains-nul
2991 If @option{-Wformat} is specified, do not warn about format strings that
2994 @item -Wno-format-extra-args
2995 @opindex Wno-format-extra-args
2996 @opindex Wformat-extra-args
2997 If @option{-Wformat} is specified, do not warn about excess arguments to a
2998 @code{printf} or @code{scanf} format function. The C standard specifies
2999 that such arguments are ignored.
3001 Where the unused arguments lie between used arguments that are
3002 specified with @samp{$} operand number specifications, normally
3003 warnings are still given, since the implementation could not know what
3004 type to pass to @code{va_arg} to skip the unused arguments. However,
3005 in the case of @code{scanf} formats, this option will suppress the
3006 warning if the unused arguments are all pointers, since the Single
3007 Unix Specification says that such unused arguments are allowed.
3009 @item -Wno-format-zero-length @r{(C and Objective-C only)}
3010 @opindex Wno-format-zero-length
3011 @opindex Wformat-zero-length
3012 If @option{-Wformat} is specified, do not warn about zero-length formats.
3013 The C standard specifies that zero-length formats are allowed.
3015 @item -Wformat-nonliteral
3016 @opindex Wformat-nonliteral
3017 @opindex Wno-format-nonliteral
3018 If @option{-Wformat} is specified, also warn if the format string is not a
3019 string literal and so cannot be checked, unless the format function
3020 takes its format arguments as a @code{va_list}.
3022 @item -Wformat-security
3023 @opindex Wformat-security
3024 @opindex Wno-format-security
3025 If @option{-Wformat} is specified, also warn about uses of format
3026 functions that represent possible security problems. At present, this
3027 warns about calls to @code{printf} and @code{scanf} functions where the
3028 format string is not a string literal and there are no format arguments,
3029 as in @code{printf (foo);}. This may be a security hole if the format
3030 string came from untrusted input and contains @samp{%n}. (This is
3031 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3032 in future warnings may be added to @option{-Wformat-security} that are not
3033 included in @option{-Wformat-nonliteral}.)
3037 @opindex Wno-format=2
3038 Enable @option{-Wformat} plus format checks not included in
3039 @option{-Wformat}. Currently equivalent to @samp{-Wformat
3040 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3042 @item -Wnonnull @r{(C and Objective-C only)}
3044 @opindex Wno-nonnull
3045 Warn about passing a null pointer for arguments marked as
3046 requiring a non-null value by the @code{nonnull} function attribute.
3048 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3049 can be disabled with the @option{-Wno-nonnull} option.
3051 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3053 @opindex Wno-init-self
3054 Warn about uninitialized variables which are initialized with themselves.
3055 Note this option can only be used with the @option{-Wuninitialized} option.
3057 For example, GCC will warn about @code{i} being uninitialized in the
3058 following snippet only when @option{-Winit-self} has been specified:
3069 @item -Wimplicit-int @r{(C and Objective-C only)}
3070 @opindex Wimplicit-int
3071 @opindex Wno-implicit-int
3072 Warn when a declaration does not specify a type.
3073 This warning is enabled by @option{-Wall}.
3075 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3076 @opindex Wimplicit-function-declaration
3077 @opindex Wno-implicit-function-declaration
3078 Give a warning whenever a function is used before being declared. In
3079 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3080 enabled by default and it is made into an error by
3081 @option{-pedantic-errors}. This warning is also enabled by
3086 @opindex Wno-implicit
3087 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3088 This warning is enabled by @option{-Wall}.
3090 @item -Wignored-qualifiers @r{(C and C++ only)}
3091 @opindex Wignored-qualifiers
3092 @opindex Wno-ignored-qualifiers
3093 Warn if the return type of a function has a type qualifier
3094 such as @code{const}. For ISO C such a type qualifier has no effect,
3095 since the value returned by a function is not an lvalue.
3096 For C++, the warning is only emitted for scalar types or @code{void}.
3097 ISO C prohibits qualified @code{void} return types on function
3098 definitions, so such return types always receive a warning
3099 even without this option.
3101 This warning is also enabled by @option{-Wextra}.
3106 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3107 a function with external linkage, returning int, taking either zero
3108 arguments, two, or three arguments of appropriate types. This warning
3109 is enabled by default in C++ and is enabled by either @option{-Wall}
3110 or @option{-pedantic}.
3112 @item -Wmissing-braces
3113 @opindex Wmissing-braces
3114 @opindex Wno-missing-braces
3115 Warn if an aggregate or union initializer is not fully bracketed. In
3116 the following example, the initializer for @samp{a} is not fully
3117 bracketed, but that for @samp{b} is fully bracketed.
3120 int a[2][2] = @{ 0, 1, 2, 3 @};
3121 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3124 This warning is enabled by @option{-Wall}.
3126 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3127 @opindex Wmissing-include-dirs
3128 @opindex Wno-missing-include-dirs
3129 Warn if a user-supplied include directory does not exist.
3132 @opindex Wparentheses
3133 @opindex Wno-parentheses
3134 Warn if parentheses are omitted in certain contexts, such
3135 as when there is an assignment in a context where a truth value
3136 is expected, or when operators are nested whose precedence people
3137 often get confused about.
3139 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3140 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3141 interpretation from that of ordinary mathematical notation.
3143 Also warn about constructions where there may be confusion to which
3144 @code{if} statement an @code{else} branch belongs. Here is an example of
3159 In C/C++, every @code{else} branch belongs to the innermost possible
3160 @code{if} statement, which in this example is @code{if (b)}. This is
3161 often not what the programmer expected, as illustrated in the above
3162 example by indentation the programmer chose. When there is the
3163 potential for this confusion, GCC will issue a warning when this flag
3164 is specified. To eliminate the warning, add explicit braces around
3165 the innermost @code{if} statement so there is no way the @code{else}
3166 could belong to the enclosing @code{if}. The resulting code would
3183 This warning is enabled by @option{-Wall}.
3185 @item -Wsequence-point
3186 @opindex Wsequence-point
3187 @opindex Wno-sequence-point
3188 Warn about code that may have undefined semantics because of violations
3189 of sequence point rules in the C and C++ standards.
3191 The C and C++ standards defines the order in which expressions in a C/C++
3192 program are evaluated in terms of @dfn{sequence points}, which represent
3193 a partial ordering between the execution of parts of the program: those
3194 executed before the sequence point, and those executed after it. These
3195 occur after the evaluation of a full expression (one which is not part
3196 of a larger expression), after the evaluation of the first operand of a
3197 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3198 function is called (but after the evaluation of its arguments and the
3199 expression denoting the called function), and in certain other places.
3200 Other than as expressed by the sequence point rules, the order of
3201 evaluation of subexpressions of an expression is not specified. All
3202 these rules describe only a partial order rather than a total order,
3203 since, for example, if two functions are called within one expression
3204 with no sequence point between them, the order in which the functions
3205 are called is not specified. However, the standards committee have
3206 ruled that function calls do not overlap.
3208 It is not specified when between sequence points modifications to the
3209 values of objects take effect. Programs whose behavior depends on this
3210 have undefined behavior; the C and C++ standards specify that ``Between
3211 the previous and next sequence point an object shall have its stored
3212 value modified at most once by the evaluation of an expression.
3213 Furthermore, the prior value shall be read only to determine the value
3214 to be stored.''. If a program breaks these rules, the results on any
3215 particular implementation are entirely unpredictable.
3217 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3218 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3219 diagnosed by this option, and it may give an occasional false positive
3220 result, but in general it has been found fairly effective at detecting
3221 this sort of problem in programs.
3223 The standard is worded confusingly, therefore there is some debate
3224 over the precise meaning of the sequence point rules in subtle cases.
3225 Links to discussions of the problem, including proposed formal
3226 definitions, may be found on the GCC readings page, at
3227 @w{@uref{http://gcc.gnu.org/readings.html}}.
3229 This warning is enabled by @option{-Wall} for C and C++.
3232 @opindex Wreturn-type
3233 @opindex Wno-return-type
3234 Warn whenever a function is defined with a return-type that defaults
3235 to @code{int}. Also warn about any @code{return} statement with no
3236 return-value in a function whose return-type is not @code{void}
3237 (falling off the end of the function body is considered returning
3238 without a value), and about a @code{return} statement with an
3239 expression in a function whose return-type is @code{void}.
3241 For C++, a function without return type always produces a diagnostic
3242 message, even when @option{-Wno-return-type} is specified. The only
3243 exceptions are @samp{main} and functions defined in system headers.
3245 This warning is enabled by @option{-Wall}.
3250 Warn whenever a @code{switch} statement has an index of enumerated type
3251 and lacks a @code{case} for one or more of the named codes of that
3252 enumeration. (The presence of a @code{default} label prevents this
3253 warning.) @code{case} labels outside the enumeration range also
3254 provoke warnings when this option is used (even if there is a
3255 @code{default} label).
3256 This warning is enabled by @option{-Wall}.
3258 @item -Wswitch-default
3259 @opindex Wswitch-default
3260 @opindex Wno-switch-default
3261 Warn whenever a @code{switch} statement does not have a @code{default}
3265 @opindex Wswitch-enum
3266 @opindex Wno-switch-enum
3267 Warn whenever a @code{switch} statement has an index of enumerated type
3268 and lacks a @code{case} for one or more of the named codes of that
3269 enumeration. @code{case} labels outside the enumeration range also
3270 provoke warnings when this option is used. The only difference
3271 between @option{-Wswitch} and this option is that this option gives a
3272 warning about an omitted enumeration code even if there is a
3273 @code{default} label.
3275 @item -Wsync-nand @r{(C and C++ only)}
3277 @opindex Wno-sync-nand
3278 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3279 built-in functions are used. These functions changed semantics in GCC 4.4.
3283 @opindex Wno-trigraphs
3284 Warn if any trigraphs are encountered that might change the meaning of
3285 the program (trigraphs within comments are not warned about).
3286 This warning is enabled by @option{-Wall}.
3288 @item -Wunused-function
3289 @opindex Wunused-function
3290 @opindex Wno-unused-function
3291 Warn whenever a static function is declared but not defined or a
3292 non-inline static function is unused.
3293 This warning is enabled by @option{-Wall}.
3295 @item -Wunused-label
3296 @opindex Wunused-label
3297 @opindex Wno-unused-label
3298 Warn whenever a label is declared but not used.
3299 This warning is enabled by @option{-Wall}.
3301 To suppress this warning use the @samp{unused} attribute
3302 (@pxref{Variable Attributes}).
3304 @item -Wunused-parameter
3305 @opindex Wunused-parameter
3306 @opindex Wno-unused-parameter
3307 Warn whenever a function parameter is unused aside from its declaration.
3309 To suppress this warning use the @samp{unused} attribute
3310 (@pxref{Variable Attributes}).
3312 @item -Wno-unused-result
3313 @opindex Wunused-result
3314 @opindex Wno-unused-result
3315 Do not warn if a caller of a function marked with attribute
3316 @code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3317 its return value. The default is @option{-Wunused-result}.
3319 @item -Wunused-variable
3320 @opindex Wunused-variable
3321 @opindex Wno-unused-variable
3322 Warn whenever a local variable or non-constant static variable is unused
3323 aside from its declaration.
3324 This warning is enabled by @option{-Wall}.
3326 To suppress this warning use the @samp{unused} attribute
3327 (@pxref{Variable Attributes}).
3329 @item -Wunused-value
3330 @opindex Wunused-value
3331 @opindex Wno-unused-value
3332 Warn whenever a statement computes a result that is explicitly not
3333 used. To suppress this warning cast the unused expression to
3334 @samp{void}. This includes an expression-statement or the left-hand
3335 side of a comma expression that contains no side effects. For example,
3336 an expression such as @samp{x[i,j]} will cause a warning, while
3337 @samp{x[(void)i,j]} will not.
3339 This warning is enabled by @option{-Wall}.
3344 All the above @option{-Wunused} options combined.
3346 In order to get a warning about an unused function parameter, you must
3347 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3348 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3350 @item -Wuninitialized
3351 @opindex Wuninitialized
3352 @opindex Wno-uninitialized
3353 Warn if an automatic variable is used without first being initialized
3354 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3355 warn if a non-static reference or non-static @samp{const} member
3356 appears in a class without constructors.
3358 If you want to warn about code which uses the uninitialized value of the
3359 variable in its own initializer, use the @option{-Winit-self} option.
3361 These warnings occur for individual uninitialized or clobbered
3362 elements of structure, union or array variables as well as for
3363 variables which are uninitialized or clobbered as a whole. They do
3364 not occur for variables or elements declared @code{volatile}. Because
3365 these warnings depend on optimization, the exact variables or elements
3366 for which there are warnings will depend on the precise optimization
3367 options and version of GCC used.
3369 Note that there may be no warning about a variable that is used only
3370 to compute a value that itself is never used, because such
3371 computations may be deleted by data flow analysis before the warnings
3374 These warnings are made optional because GCC is not smart
3375 enough to see all the reasons why the code might be correct
3376 despite appearing to have an error. Here is one example of how
3397 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3398 always initialized, but GCC doesn't know this. Here is
3399 another common case:
3404 if (change_y) save_y = y, y = new_y;
3406 if (change_y) y = save_y;
3411 This has no bug because @code{save_y} is used only if it is set.
3413 @cindex @code{longjmp} warnings
3414 This option also warns when a non-volatile automatic variable might be
3415 changed by a call to @code{longjmp}. These warnings as well are possible
3416 only in optimizing compilation.
3418 The compiler sees only the calls to @code{setjmp}. It cannot know
3419 where @code{longjmp} will be called; in fact, a signal handler could
3420 call it at any point in the code. As a result, you may get a warning
3421 even when there is in fact no problem because @code{longjmp} cannot
3422 in fact be called at the place which would cause a problem.
3424 Some spurious warnings can be avoided if you declare all the functions
3425 you use that never return as @code{noreturn}. @xref{Function
3428 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3430 @item -Wunknown-pragmas
3431 @opindex Wunknown-pragmas
3432 @opindex Wno-unknown-pragmas
3433 @cindex warning for unknown pragmas
3434 @cindex unknown pragmas, warning
3435 @cindex pragmas, warning of unknown
3436 Warn when a #pragma directive is encountered which is not understood by
3437 GCC@. If this command line option is used, warnings will even be issued
3438 for unknown pragmas in system header files. This is not the case if
3439 the warnings were only enabled by the @option{-Wall} command line option.
3442 @opindex Wno-pragmas
3444 Do not warn about misuses of pragmas, such as incorrect parameters,
3445 invalid syntax, or conflicts between pragmas. See also
3446 @samp{-Wunknown-pragmas}.
3448 @item -Wstrict-aliasing
3449 @opindex Wstrict-aliasing
3450 @opindex Wno-strict-aliasing
3451 This option is only active when @option{-fstrict-aliasing} is active.
3452 It warns about code which might break the strict aliasing rules that the
3453 compiler is using for optimization. The warning does not catch all
3454 cases, but does attempt to catch the more common pitfalls. It is
3455 included in @option{-Wall}.
3456 It is equivalent to @option{-Wstrict-aliasing=3}
3458 @item -Wstrict-aliasing=n
3459 @opindex Wstrict-aliasing=n
3460 @opindex Wno-strict-aliasing=n
3461 This option is only active when @option{-fstrict-aliasing} is active.
3462 It warns about code which might break the strict aliasing rules that the
3463 compiler is using for optimization.
3464 Higher levels correspond to higher accuracy (fewer false positives).
3465 Higher levels also correspond to more effort, similar to the way -O works.
3466 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3469 Level 1: Most aggressive, quick, least accurate.
3470 Possibly useful when higher levels
3471 do not warn but -fstrict-aliasing still breaks the code, as it has very few
3472 false negatives. However, it has many false positives.
3473 Warns for all pointer conversions between possibly incompatible types,
3474 even if never dereferenced. Runs in the frontend only.
3476 Level 2: Aggressive, quick, not too precise.
3477 May still have many false positives (not as many as level 1 though),
3478 and few false negatives (but possibly more than level 1).
3479 Unlike level 1, it only warns when an address is taken. Warns about
3480 incomplete types. Runs in the frontend only.
3482 Level 3 (default for @option{-Wstrict-aliasing}):
3483 Should have very few false positives and few false
3484 negatives. Slightly slower than levels 1 or 2 when optimization is enabled.
3485 Takes care of the common punn+dereference pattern in the frontend:
3486 @code{*(int*)&some_float}.
3487 If optimization is enabled, it also runs in the backend, where it deals
3488 with multiple statement cases using flow-sensitive points-to information.
3489 Only warns when the converted pointer is dereferenced.
3490 Does not warn about incomplete types.
3492 @item -Wstrict-overflow
3493 @itemx -Wstrict-overflow=@var{n}
3494 @opindex Wstrict-overflow
3495 @opindex Wno-strict-overflow
3496 This option is only active when @option{-fstrict-overflow} is active.
3497 It warns about cases where the compiler optimizes based on the
3498 assumption that signed overflow does not occur. Note that it does not
3499 warn about all cases where the code might overflow: it only warns
3500 about cases where the compiler implements some optimization. Thus
3501 this warning depends on the optimization level.
3503 An optimization which assumes that signed overflow does not occur is
3504 perfectly safe if the values of the variables involved are such that
3505 overflow never does, in fact, occur. Therefore this warning can
3506 easily give a false positive: a warning about code which is not
3507 actually a problem. To help focus on important issues, several
3508 warning levels are defined. No warnings are issued for the use of
3509 undefined signed overflow when estimating how many iterations a loop
3510 will require, in particular when determining whether a loop will be
3514 @item -Wstrict-overflow=1
3515 Warn about cases which are both questionable and easy to avoid. For
3516 example: @code{x + 1 > x}; with @option{-fstrict-overflow}, the
3517 compiler will simplify this to @code{1}. This level of
3518 @option{-Wstrict-overflow} is enabled by @option{-Wall}; higher levels
3519 are not, and must be explicitly requested.
3521 @item -Wstrict-overflow=2
3522 Also warn about other cases where a comparison is simplified to a
3523 constant. For example: @code{abs (x) >= 0}. This can only be
3524 simplified when @option{-fstrict-overflow} is in effect, because
3525 @code{abs (INT_MIN)} overflows to @code{INT_MIN}, which is less than
3526 zero. @option{-Wstrict-overflow} (with no level) is the same as
3527 @option{-Wstrict-overflow=2}.
3529 @item -Wstrict-overflow=3
3530 Also warn about other cases where a comparison is simplified. For
3531 example: @code{x + 1 > 1} will be simplified to @code{x > 0}.
3533 @item -Wstrict-overflow=4
3534 Also warn about other simplifications not covered by the above cases.
3535 For example: @code{(x * 10) / 5} will be simplified to @code{x * 2}.
3537 @item -Wstrict-overflow=5
3538 Also warn about cases where the compiler reduces the magnitude of a
3539 constant involved in a comparison. For example: @code{x + 2 > y} will
3540 be simplified to @code{x + 1 >= y}. This is reported only at the
3541 highest warning level because this simplification applies to many
3542 comparisons, so this warning level will give a very large number of
3546 @item -Warray-bounds
3547 @opindex Wno-array-bounds
3548 @opindex Warray-bounds
3549 This option is only active when @option{-ftree-vrp} is active
3550 (default for -O2 and above). It warns about subscripts to arrays
3551 that are always out of bounds. This warning is enabled by @option{-Wall}.
3553 @item -Wno-div-by-zero
3554 @opindex Wno-div-by-zero
3555 @opindex Wdiv-by-zero
3556 Do not warn about compile-time integer division by zero. Floating point
3557 division by zero is not warned about, as it can be a legitimate way of
3558 obtaining infinities and NaNs.
3560 @item -Wsystem-headers
3561 @opindex Wsystem-headers
3562 @opindex Wno-system-headers
3563 @cindex warnings from system headers
3564 @cindex system headers, warnings from
3565 Print warning messages for constructs found in system header files.
3566 Warnings from system headers are normally suppressed, on the assumption
3567 that they usually do not indicate real problems and would only make the
3568 compiler output harder to read. Using this command line option tells
3569 GCC to emit warnings from system headers as if they occurred in user
3570 code. However, note that using @option{-Wall} in conjunction with this
3571 option will @emph{not} warn about unknown pragmas in system
3572 headers---for that, @option{-Wunknown-pragmas} must also be used.
3575 @opindex Wfloat-equal
3576 @opindex Wno-float-equal
3577 Warn if floating point values are used in equality comparisons.
3579 The idea behind this is that sometimes it is convenient (for the
3580 programmer) to consider floating-point values as approximations to
3581 infinitely precise real numbers. If you are doing this, then you need
3582 to compute (by analyzing the code, or in some other way) the maximum or
3583 likely maximum error that the computation introduces, and allow for it
3584 when performing comparisons (and when producing output, but that's a
3585 different problem). In particular, instead of testing for equality, you
3586 would check to see whether the two values have ranges that overlap; and
3587 this is done with the relational operators, so equality comparisons are
3590 @item -Wtraditional @r{(C and Objective-C only)}
3591 @opindex Wtraditional
3592 @opindex Wno-traditional
3593 Warn about certain constructs that behave differently in traditional and
3594 ISO C@. Also warn about ISO C constructs that have no traditional C
3595 equivalent, and/or problematic constructs which should be avoided.
3599 Macro parameters that appear within string literals in the macro body.
3600 In traditional C macro replacement takes place within string literals,
3601 but does not in ISO C@.
3604 In traditional C, some preprocessor directives did not exist.
3605 Traditional preprocessors would only consider a line to be a directive
3606 if the @samp{#} appeared in column 1 on the line. Therefore
3607 @option{-Wtraditional} warns about directives that traditional C
3608 understands but would ignore because the @samp{#} does not appear as the
3609 first character on the line. It also suggests you hide directives like
3610 @samp{#pragma} not understood by traditional C by indenting them. Some
3611 traditional implementations would not recognize @samp{#elif}, so it
3612 suggests avoiding it altogether.
3615 A function-like macro that appears without arguments.
3618 The unary plus operator.
3621 The @samp{U} integer constant suffix, or the @samp{F} or @samp{L} floating point
3622 constant suffixes. (Traditional C does support the @samp{L} suffix on integer
3623 constants.) Note, these suffixes appear in macros defined in the system
3624 headers of most modern systems, e.g.@: the @samp{_MIN}/@samp{_MAX} macros in @code{<limits.h>}.
3625 Use of these macros in user code might normally lead to spurious
3626 warnings, however GCC's integrated preprocessor has enough context to
3627 avoid warning in these cases.
3630 A function declared external in one block and then used after the end of
3634 A @code{switch} statement has an operand of type @code{long}.
3637 A non-@code{static} function declaration follows a @code{static} one.
3638 This construct is not accepted by some traditional C compilers.
3641 The ISO type of an integer constant has a different width or
3642 signedness from its traditional type. This warning is only issued if
3643 the base of the constant is ten. I.e.@: hexadecimal or octal values, which
3644 typically represent bit patterns, are not warned about.
3647 Usage of ISO string concatenation is detected.
3650 Initialization of automatic aggregates.
3653 Identifier conflicts with labels. Traditional C lacks a separate
3654 namespace for labels.
3657 Initialization of unions. If the initializer is zero, the warning is
3658 omitted. This is done under the assumption that the zero initializer in
3659 user code appears conditioned on e.g.@: @code{__STDC__} to avoid missing
3660 initializer warnings and relies on default initialization to zero in the
3664 Conversions by prototypes between fixed/floating point values and vice
3665 versa. The absence of these prototypes when compiling with traditional
3666 C would cause serious problems. This is a subset of the possible
3667 conversion warnings, for the full set use @option{-Wtraditional-conversion}.
3670 Use of ISO C style function definitions. This warning intentionally is
3671 @emph{not} issued for prototype declarations or variadic functions
3672 because these ISO C features will appear in your code when using
3673 libiberty's traditional C compatibility macros, @code{PARAMS} and
3674 @code{VPARAMS}. This warning is also bypassed for nested functions
3675 because that feature is already a GCC extension and thus not relevant to
3676 traditional C compatibility.
3679 @item -Wtraditional-conversion @r{(C and Objective-C only)}
3680 @opindex Wtraditional-conversion
3681 @opindex Wno-traditional-conversion
3682 Warn if a prototype causes a type conversion that is different from what
3683 would happen to the same argument in the absence of a prototype. This
3684 includes conversions of fixed point to floating and vice versa, and
3685 conversions changing the width or signedness of a fixed point argument
3686 except when the same as the default promotion.
3688 @item -Wdeclaration-after-statement @r{(C and Objective-C only)}
3689 @opindex Wdeclaration-after-statement
3690 @opindex Wno-declaration-after-statement
3691 Warn when a declaration is found after a statement in a block. This
3692 construct, known from C++, was introduced with ISO C99 and is by default
3693 allowed in GCC@. It is not supported by ISO C90 and was not supported by
3694 GCC versions before GCC 3.0. @xref{Mixed Declarations}.
3699 Warn if an undefined identifier is evaluated in an @samp{#if} directive.
3701 @item -Wno-endif-labels
3702 @opindex Wno-endif-labels
3703 @opindex Wendif-labels
3704 Do not warn whenever an @samp{#else} or an @samp{#endif} are followed by text.
3709 Warn whenever a local variable shadows another local variable, parameter or
3710 global variable or whenever a built-in function is shadowed.
3712 @item -Wlarger-than=@var{len}
3713 @opindex Wlarger-than=@var{len}
3714 @opindex Wlarger-than-@var{len}
3715 Warn whenever an object of larger than @var{len} bytes is defined.
3717 @item -Wframe-larger-than=@var{len}
3718 @opindex Wframe-larger-than
3719 Warn if the size of a function frame is larger than @var{len} bytes.
3720 The computation done to determine the stack frame size is approximate
3721 and not conservative.
3722 The actual requirements may be somewhat greater than @var{len}
3723 even if you do not get a warning. In addition, any space allocated
3724 via @code{alloca}, variable-length arrays, or related constructs
3725 is not included by the compiler when determining
3726 whether or not to issue a warning.
3728 @item -Wunsafe-loop-optimizations
3729 @opindex Wunsafe-loop-optimizations
3730 @opindex Wno-unsafe-loop-optimizations
3731 Warn if the loop cannot be optimized because the compiler could not
3732 assume anything on the bounds of the loop indices. With
3733 @option{-funsafe-loop-optimizations} warn if the compiler made
3736 @item -Wno-pedantic-ms-format @r{(MinGW targets only)}
3737 @opindex Wno-pedantic-ms-format
3738 @opindex Wpedantic-ms-format
3739 Disables the warnings about non-ISO @code{printf} / @code{scanf} format
3740 width specifiers @code{I32}, @code{I64}, and @code{I} used on Windows targets
3741 depending on the MS runtime, when you are using the options @option{-Wformat}
3742 and @option{-pedantic} without gnu-extensions.
3744 @item -Wpointer-arith
3745 @opindex Wpointer-arith
3746 @opindex Wno-pointer-arith
3747 Warn about anything that depends on the ``size of'' a function type or
3748 of @code{void}. GNU C assigns these types a size of 1, for
3749 convenience in calculations with @code{void *} pointers and pointers
3750 to functions. In C++, warn also when an arithmetic operation involves
3751 @code{NULL}. This warning is also enabled by @option{-pedantic}.
3754 @opindex Wtype-limits
3755 @opindex Wno-type-limits
3756 Warn if a comparison is always true or always false due to the limited
3757 range of the data type, but do not warn for constant expressions. For
3758 example, warn if an unsigned variable is compared against zero with
3759 @samp{<} or @samp{>=}. This warning is also enabled by
3762 @item -Wbad-function-cast @r{(C and Objective-C only)}
3763 @opindex Wbad-function-cast
3764 @opindex Wno-bad-function-cast
3765 Warn whenever a function call is cast to a non-matching type.
3766 For example, warn if @code{int malloc()} is cast to @code{anything *}.
3768 @item -Wc++-compat @r{(C and Objective-C only)}
3769 Warn about ISO C constructs that are outside of the common subset of
3770 ISO C and ISO C++, e.g.@: request for implicit conversion from
3771 @code{void *} to a pointer to non-@code{void} type.
3773 @item -Wc++0x-compat @r{(C++ and Objective-C++ only)}
3774 Warn about C++ constructs whose meaning differs between ISO C++ 1998 and
3775 ISO C++ 200x, e.g., identifiers in ISO C++ 1998 that will become keywords
3776 in ISO C++ 200x. This warning is enabled by @option{-Wall}.
3780 @opindex Wno-cast-qual
3781 Warn whenever a pointer is cast so as to remove a type qualifier from
3782 the target type. For example, warn if a @code{const char *} is cast
3783 to an ordinary @code{char *}.
3785 Also warn when making a cast which introduces a type qualifier in an
3786 unsafe way. For example, casting @code{char **} to @code{const char **}
3787 is unsafe, as in this example:
3790 /* p is char ** value. */
3791 const char **q = (const char **) p;
3792 /* Assignment of readonly string to const char * is OK. */
3794 /* Now char** pointer points to read-only memory. */
3799 @opindex Wcast-align
3800 @opindex Wno-cast-align
3801 Warn whenever a pointer is cast such that the required alignment of the
3802 target is increased. For example, warn if a @code{char *} is cast to
3803 an @code{int *} on machines where integers can only be accessed at
3804 two- or four-byte boundaries.
3806 @item -Wwrite-strings
3807 @opindex Wwrite-strings
3808 @opindex Wno-write-strings
3809 When compiling C, give string constants the type @code{const
3810 char[@var{length}]} so that copying the address of one into a
3811 non-@code{const} @code{char *} pointer will get a warning. These
3812 warnings will help you find at compile time code that can try to write
3813 into a string constant, but only if you have been very careful about
3814 using @code{const} in declarations and prototypes. Otherwise, it will
3815 just be a nuisance. This is why we did not make @option{-Wall} request
3818 When compiling C++, warn about the deprecated conversion from string
3819 literals to @code{char *}. This warning is enabled by default for C++
3824 @opindex Wno-clobbered
3825 Warn for variables that might be changed by @samp{longjmp} or
3826 @samp{vfork}. This warning is also enabled by @option{-Wextra}.
3829 @opindex Wconversion
3830 @opindex Wno-conversion
3831 Warn for implicit conversions that may alter a value. This includes
3832 conversions between real and integer, like @code{abs (x)} when
3833 @code{x} is @code{double}; conversions between signed and unsigned,
3834 like @code{unsigned ui = -1}; and conversions to smaller types, like
3835 @code{sqrtf (M_PI)}. Do not warn for explicit casts like @code{abs
3836 ((int) x)} and @code{ui = (unsigned) -1}, or if the value is not
3837 changed by the conversion like in @code{abs (2.0)}. Warnings about
3838 conversions between signed and unsigned integers can be disabled by
3839 using @option{-Wno-sign-conversion}.
3841 For C++, also warn for conversions between @code{NULL} and non-pointer
3842 types; confusing overload resolution for user-defined conversions; and
3843 conversions that will never use a type conversion operator:
3844 conversions to @code{void}, the same type, a base class or a reference
3845 to them. Warnings about conversions between signed and unsigned
3846 integers are disabled by default in C++ unless
3847 @option{-Wsign-conversion} is explicitly enabled.
3850 @opindex Wempty-body
3851 @opindex Wno-empty-body
3852 Warn if an empty body occurs in an @samp{if}, @samp{else} or @samp{do
3853 while} statement. This warning is also enabled by @option{-Wextra}.
3855 @item -Wenum-compare
3856 @opindex Wenum-compare
3857 @opindex Wno-enum-compare
3858 Warn about a comparison between values of different enum types. In C++
3859 this warning is enabled by default. In C this warning is enabled by
3862 @item -Wjump-misses-init @r{(C, Objective-C only)}
3863 @opindex Wjump-misses-init
3864 @opindex Wno-jump-misses-init
3865 Warn if a @code{goto} statement or a @code{switch} statement jumps
3866 forward across the initialization of a variable, or jumps backward to a
3867 label after the variable has been initialized. This only warns about
3868 variables which are initialized when they are declared. This warning is
3869 only supported for C and Objective C; in C++ this sort of branch is an
3872 @option{-Wjump-misses-init} is included in @option{-Wc++-compat}. It
3873 can be disabled with the @option{-Wno-jump-misses-init} option.
3875 @item -Wsign-compare
3876 @opindex Wsign-compare
3877 @opindex Wno-sign-compare
3878 @cindex warning for comparison of signed and unsigned values
3879 @cindex comparison of signed and unsigned values, warning
3880 @cindex signed and unsigned values, comparison warning
3881 Warn when a comparison between signed and unsigned values could produce
3882 an incorrect result when the signed value is converted to unsigned.
3883 This warning is also enabled by @option{-Wextra}; to get the other warnings
3884 of @option{-Wextra} without this warning, use @samp{-Wextra -Wno-sign-compare}.
3886 @item -Wsign-conversion
3887 @opindex Wsign-conversion
3888 @opindex Wno-sign-conversion
3889 Warn for implicit conversions that may change the sign of an integer
3890 value, like assigning a signed integer expression to an unsigned
3891 integer variable. An explicit cast silences the warning. In C, this
3892 option is enabled also by @option{-Wconversion}.
3896 @opindex Wno-address
3897 Warn about suspicious uses of memory addresses. These include using
3898 the address of a function in a conditional expression, such as
3899 @code{void func(void); if (func)}, and comparisons against the memory
3900 address of a string literal, such as @code{if (x == "abc")}. Such
3901 uses typically indicate a programmer error: the address of a function
3902 always evaluates to true, so their use in a conditional usually
3903 indicate that the programmer forgot the parentheses in a function
3904 call; and comparisons against string literals result in unspecified
3905 behavior and are not portable in C, so they usually indicate that the
3906 programmer intended to use @code{strcmp}. This warning is enabled by
3910 @opindex Wlogical-op
3911 @opindex Wno-logical-op
3912 Warn about suspicious uses of logical operators in expressions.
3913 This includes using logical operators in contexts where a
3914 bit-wise operator is likely to be expected.
3916 @item -Waggregate-return
3917 @opindex Waggregate-return
3918 @opindex Wno-aggregate-return
3919 Warn if any functions that return structures or unions are defined or
3920 called. (In languages where you can return an array, this also elicits
3923 @item -Wno-attributes
3924 @opindex Wno-attributes
3925 @opindex Wattributes
3926 Do not warn if an unexpected @code{__attribute__} is used, such as
3927 unrecognized attributes, function attributes applied to variables,
3928 etc. This will not stop errors for incorrect use of supported
3931 @item -Wno-builtin-macro-redefined
3932 @opindex Wno-builtin-macro-redefined
3933 @opindex Wbuiltin-macro-redefined
3934 Do not warn if certain built-in macros are redefined. This suppresses
3935 warnings for redefinition of @code{__TIMESTAMP__}, @code{__TIME__},
3936 @code{__DATE__}, @code{__FILE__}, and @code{__BASE_FILE__}.
3938 @item -Wstrict-prototypes @r{(C and Objective-C only)}
3939 @opindex Wstrict-prototypes
3940 @opindex Wno-strict-prototypes
3941 Warn if a function is declared or defined without specifying the
3942 argument types. (An old-style function definition is permitted without
3943 a warning if preceded by a declaration which specifies the argument
3946 @item -Wold-style-declaration @r{(C and Objective-C only)}
3947 @opindex Wold-style-declaration
3948 @opindex Wno-old-style-declaration
3949 Warn for obsolescent usages, according to the C Standard, in a
3950 declaration. For example, warn if storage-class specifiers like
3951 @code{static} are not the first things in a declaration. This warning
3952 is also enabled by @option{-Wextra}.
3954 @item -Wold-style-definition @r{(C and Objective-C only)}
3955 @opindex Wold-style-definition
3956 @opindex Wno-old-style-definition
3957 Warn if an old-style function definition is used. A warning is given
3958 even if there is a previous prototype.
3960 @item -Wmissing-parameter-type @r{(C and Objective-C only)}
3961 @opindex Wmissing-parameter-type
3962 @opindex Wno-missing-parameter-type
3963 A function parameter is declared without a type specifier in K&R-style
3970 This warning is also enabled by @option{-Wextra}.
3972 @item -Wmissing-prototypes @r{(C and Objective-C only)}
3973 @opindex Wmissing-prototypes
3974 @opindex Wno-missing-prototypes
3975 Warn if a global function is defined without a previous prototype
3976 declaration. This warning is issued even if the definition itself
3977 provides a prototype. The aim is to detect global functions that fail
3978 to be declared in header files.
3980 @item -Wmissing-declarations
3981 @opindex Wmissing-declarations
3982 @opindex Wno-missing-declarations
3983 Warn if a global function is defined without a previous declaration.
3984 Do so even if the definition itself provides a prototype.
3985 Use this option to detect global functions that are not declared in
3986 header files. In C++, no warnings are issued for function templates,
3987 or for inline functions, or for functions in anonymous namespaces.
3989 @item -Wmissing-field-initializers
3990 @opindex Wmissing-field-initializers
3991 @opindex Wno-missing-field-initializers
3995 Warn if a structure's initializer has some fields missing. For
3996 example, the following code would cause such a warning, because
3997 @code{x.h} is implicitly zero:
4000 struct s @{ int f, g, h; @};
4001 struct s x = @{ 3, 4 @};
4004 This option does not warn about designated initializers, so the following
4005 modification would not trigger a warning:
4008 struct s @{ int f, g, h; @};
4009 struct s x = @{ .f = 3, .g = 4 @};
4012 This warning is included in @option{-Wextra}. To get other @option{-Wextra}
4013 warnings without this one, use @samp{-Wextra -Wno-missing-field-initializers}.
4015 @item -Wmissing-noreturn
4016 @opindex Wmissing-noreturn
4017 @opindex Wno-missing-noreturn
4018 Warn about functions which might be candidates for attribute @code{noreturn}.
4019 Note these are only possible candidates, not absolute ones. Care should
4020 be taken to manually verify functions actually do not ever return before
4021 adding the @code{noreturn} attribute, otherwise subtle code generation
4022 bugs could be introduced. You will not get a warning for @code{main} in
4023 hosted C environments.
4025 @item -Wmissing-format-attribute
4026 @opindex Wmissing-format-attribute
4027 @opindex Wno-missing-format-attribute
4030 Warn about function pointers which might be candidates for @code{format}
4031 attributes. Note these are only possible candidates, not absolute ones.
4032 GCC will guess that function pointers with @code{format} attributes that
4033 are used in assignment, initialization, parameter passing or return
4034 statements should have a corresponding @code{format} attribute in the
4035 resulting type. I.e.@: the left-hand side of the assignment or
4036 initialization, the type of the parameter variable, or the return type
4037 of the containing function respectively should also have a @code{format}
4038 attribute to avoid the warning.
4040 GCC will also warn about function definitions which might be
4041 candidates for @code{format} attributes. Again, these are only
4042 possible candidates. GCC will guess that @code{format} attributes
4043 might be appropriate for any function that calls a function like
4044 @code{vprintf} or @code{vscanf}, but this might not always be the
4045 case, and some functions for which @code{format} attributes are
4046 appropriate may not be detected.
4048 @item -Wno-multichar
4049 @opindex Wno-multichar
4051 Do not warn if a multicharacter constant (@samp{'FOOF'}) is used.
4052 Usually they indicate a typo in the user's code, as they have
4053 implementation-defined values, and should not be used in portable code.
4055 @item -Wnormalized=<none|id|nfc|nfkc>
4056 @opindex Wnormalized=
4059 @cindex character set, input normalization
4060 In ISO C and ISO C++, two identifiers are different if they are
4061 different sequences of characters. However, sometimes when characters
4062 outside the basic ASCII character set are used, you can have two
4063 different character sequences that look the same. To avoid confusion,
4064 the ISO 10646 standard sets out some @dfn{normalization rules} which
4065 when applied ensure that two sequences that look the same are turned into
4066 the same sequence. GCC can warn you if you are using identifiers which
4067 have not been normalized; this option controls that warning.
4069 There are four levels of warning that GCC supports. The default is
4070 @option{-Wnormalized=nfc}, which warns about any identifier which is
4071 not in the ISO 10646 ``C'' normalized form, @dfn{NFC}. NFC is the
4072 recommended form for most uses.
4074 Unfortunately, there are some characters which ISO C and ISO C++ allow
4075 in identifiers that when turned into NFC aren't allowable as
4076 identifiers. That is, there's no way to use these symbols in portable
4077 ISO C or C++ and have all your identifiers in NFC@.
4078 @option{-Wnormalized=id} suppresses the warning for these characters.
4079 It is hoped that future versions of the standards involved will correct
4080 this, which is why this option is not the default.
4082 You can switch the warning off for all characters by writing
4083 @option{-Wnormalized=none}. You would only want to do this if you
4084 were using some other normalization scheme (like ``D''), because
4085 otherwise you can easily create bugs that are literally impossible to see.
4087 Some characters in ISO 10646 have distinct meanings but look identical
4088 in some fonts or display methodologies, especially once formatting has
4089 been applied. For instance @code{\u207F}, ``SUPERSCRIPT LATIN SMALL
4090 LETTER N'', will display just like a regular @code{n} which has been
4091 placed in a superscript. ISO 10646 defines the @dfn{NFKC}
4092 normalization scheme to convert all these into a standard form as
4093 well, and GCC will warn if your code is not in NFKC if you use
4094 @option{-Wnormalized=nfkc}. This warning is comparable to warning
4095 about every identifier that contains the letter O because it might be
4096 confused with the digit 0, and so is not the default, but may be
4097 useful as a local coding convention if the programming environment is
4098 unable to be fixed to display these characters distinctly.
4100 @item -Wno-deprecated
4101 @opindex Wno-deprecated
4102 @opindex Wdeprecated
4103 Do not warn about usage of deprecated features. @xref{Deprecated Features}.
4105 @item -Wno-deprecated-declarations
4106 @opindex Wno-deprecated-declarations
4107 @opindex Wdeprecated-declarations
4108 Do not warn about uses of functions (@pxref{Function Attributes}),
4109 variables (@pxref{Variable Attributes}), and types (@pxref{Type
4110 Attributes}) marked as deprecated by using the @code{deprecated}
4114 @opindex Wno-overflow
4116 Do not warn about compile-time overflow in constant expressions.
4118 @item -Woverride-init @r{(C and Objective-C only)}
4119 @opindex Woverride-init
4120 @opindex Wno-override-init
4124 Warn if an initialized field without side effects is overridden when
4125 using designated initializers (@pxref{Designated Inits, , Designated
4128 This warning is included in @option{-Wextra}. To get other
4129 @option{-Wextra} warnings without this one, use @samp{-Wextra
4130 -Wno-override-init}.
4135 Warn if a structure is given the packed attribute, but the packed
4136 attribute has no effect on the layout or size of the structure.
4137 Such structures may be mis-aligned for little benefit. For
4138 instance, in this code, the variable @code{f.x} in @code{struct bar}
4139 will be misaligned even though @code{struct bar} does not itself
4140 have the packed attribute:
4147 @} __attribute__((packed));
4155 @item -Wpacked-bitfield-compat
4156 @opindex Wpacked-bitfield-compat
4157 @opindex Wno-packed-bitfield-compat
4158 The 4.1, 4.2 and 4.3 series of GCC ignore the @code{packed} attribute
4159 on bit-fields of type @code{char}. This has been fixed in GCC 4.4 but
4160 the change can lead to differences in the structure layout. GCC
4161 informs you when the offset of such a field has changed in GCC 4.4.
4162 For example there is no longer a 4-bit padding between field @code{a}
4163 and @code{b} in this structure:
4170 @} __attribute__ ((packed));
4173 This warning is enabled by default. Use
4174 @option{-Wno-packed-bitfield-compat} to disable this warning.
4179 Warn if padding is included in a structure, either to align an element
4180 of the structure or to align the whole structure. Sometimes when this
4181 happens it is possible to rearrange the fields of the structure to
4182 reduce the padding and so make the structure smaller.
4184 @item -Wredundant-decls
4185 @opindex Wredundant-decls
4186 @opindex Wno-redundant-decls
4187 Warn if anything is declared more than once in the same scope, even in
4188 cases where multiple declaration is valid and changes nothing.
4190 @item -Wnested-externs @r{(C and Objective-C only)}
4191 @opindex Wnested-externs
4192 @opindex Wno-nested-externs
4193 Warn if an @code{extern} declaration is encountered within a function.
4198 Warn if a function can not be inlined and it was declared as inline.
4199 Even with this option, the compiler will not warn about failures to
4200 inline functions declared in system headers.
4202 The compiler uses a variety of heuristics to determine whether or not
4203 to inline a function. For example, the compiler takes into account
4204 the size of the function being inlined and the amount of inlining
4205 that has already been done in the current function. Therefore,
4206 seemingly insignificant changes in the source program can cause the
4207 warnings produced by @option{-Winline} to appear or disappear.
4209 @item -Wno-invalid-offsetof @r{(C++ and Objective-C++ only)}
4210 @opindex Wno-invalid-offsetof
4211 @opindex Winvalid-offsetof
4212 Suppress warnings from applying the @samp{offsetof} macro to a non-POD
4213 type. According to the 1998 ISO C++ standard, applying @samp{offsetof}
4214 to a non-POD type is undefined. In existing C++ implementations,
4215 however, @samp{offsetof} typically gives meaningful results even when
4216 applied to certain kinds of non-POD types. (Such as a simple
4217 @samp{struct} that fails to be a POD type only by virtue of having a
4218 constructor.) This flag is for users who are aware that they are
4219 writing nonportable code and who have deliberately chosen to ignore the
4222 The restrictions on @samp{offsetof} may be relaxed in a future version
4223 of the C++ standard.
4225 @item -Wno-int-to-pointer-cast @r{(C and Objective-C only)}
4226 @opindex Wno-int-to-pointer-cast
4227 @opindex Wint-to-pointer-cast
4228 Suppress warnings from casts to pointer type of an integer of a
4231 @item -Wno-pointer-to-int-cast @r{(C and Objective-C only)}
4232 @opindex Wno-pointer-to-int-cast
4233 @opindex Wpointer-to-int-cast
4234 Suppress warnings from casts from a pointer to an integer type of a
4238 @opindex Winvalid-pch
4239 @opindex Wno-invalid-pch
4240 Warn if a precompiled header (@pxref{Precompiled Headers}) is found in
4241 the search path but can't be used.
4245 @opindex Wno-long-long
4246 Warn if @samp{long long} type is used. This is enabled by either
4247 @option{-pedantic} or @option{-Wtraditional} in ISO C90 and C++98
4248 modes. To inhibit the warning messages, use @option{-Wno-long-long}.
4250 @item -Wvariadic-macros
4251 @opindex Wvariadic-macros
4252 @opindex Wno-variadic-macros
4253 Warn if variadic macros are used in pedantic ISO C90 mode, or the GNU
4254 alternate syntax when in pedantic ISO C99 mode. This is default.
4255 To inhibit the warning messages, use @option{-Wno-variadic-macros}.
4260 Warn if variable length array is used in the code.
4261 @option{-Wno-vla} will prevent the @option{-pedantic} warning of
4262 the variable length array.
4264 @item -Wvolatile-register-var
4265 @opindex Wvolatile-register-var
4266 @opindex Wno-volatile-register-var
4267 Warn if a register variable is declared volatile. The volatile
4268 modifier does not inhibit all optimizations that may eliminate reads
4269 and/or writes to register variables. This warning is enabled by
4272 @item -Wdisabled-optimization
4273 @opindex Wdisabled-optimization
4274 @opindex Wno-disabled-optimization
4275 Warn if a requested optimization pass is disabled. This warning does
4276 not generally indicate that there is anything wrong with your code; it
4277 merely indicates that GCC's optimizers were unable to handle the code
4278 effectively. Often, the problem is that your code is too big or too
4279 complex; GCC will refuse to optimize programs when the optimization
4280 itself is likely to take inordinate amounts of time.
4282 @item -Wpointer-sign @r{(C and Objective-C only)}
4283 @opindex Wpointer-sign
4284 @opindex Wno-pointer-sign
4285 Warn for pointer argument passing or assignment with different signedness.
4286 This option is only supported for C and Objective-C@. It is implied by
4287 @option{-Wall} and by @option{-pedantic}, which can be disabled with
4288 @option{-Wno-pointer-sign}.