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, 2011
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.3 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} -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} @gol
168 -fdump-ada-spec@r{[}-slim@r{]}} -fdump-go-spec=@var{file}
170 @item C Language Options
171 @xref{C Dialect Options,,Options Controlling C Dialect}.
172 @gccoptlist{-ansi -std=@var{standard} -fgnu89-inline @gol
173 -aux-info @var{filename} @gol
174 -fno-asm -fno-builtin -fno-builtin-@var{function} @gol
175 -fhosted -ffreestanding -fopenmp -fms-extensions -fplan9-extensions @gol
176 -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol
177 -fallow-single-precision -fcond-mismatch -flax-vector-conversions @gol
178 -fsigned-bitfields -fsigned-char @gol
179 -funsigned-bitfields -funsigned-char}
181 @item C++ Language Options
182 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}.
183 @gccoptlist{-fabi-version=@var{n} -fno-access-control -fcheck-new @gol
184 -fconserve-space -fconstexpr-depth=@var{n} -ffriend-injection @gol
185 -fno-elide-constructors @gol
186 -fno-enforce-eh-specs @gol
187 -ffor-scope -fno-for-scope -fno-gnu-keywords @gol
188 -fno-implicit-templates @gol
189 -fno-implicit-inline-templates @gol
190 -fno-implement-inlines -fms-extensions @gol
191 -fno-nonansi-builtins -fnothrow-opt -fno-operator-names @gol
192 -fno-optional-diags -fpermissive @gol
193 -fno-pretty-templates @gol
194 -frepo -fno-rtti -fstats -ftemplate-depth=@var{n} @gol
195 -fno-threadsafe-statics -fuse-cxa-atexit -fno-weak -nostdinc++ @gol
196 -fno-default-inline -fvisibility-inlines-hidden @gol
197 -fvisibility-ms-compat @gol
198 -Wabi -Wconversion-null -Wctor-dtor-privacy @gol
199 -Wnoexcept -Wnon-virtual-dtor -Wreorder @gol
200 -Weffc++ -Wstrict-null-sentinel @gol
201 -Wno-non-template-friend -Wold-style-cast @gol
202 -Woverloaded-virtual -Wno-pmf-conversions @gol
205 @item Objective-C and Objective-C++ Language Options
206 @xref{Objective-C and Objective-C++ Dialect Options,,Options Controlling
207 Objective-C and Objective-C++ Dialects}.
208 @gccoptlist{-fconstant-string-class=@var{class-name} @gol
209 -fgnu-runtime -fnext-runtime @gol
210 -fno-nil-receivers @gol
211 -fobjc-abi-version=@var{n} @gol
212 -fobjc-call-cxx-cdtors @gol
213 -fobjc-direct-dispatch @gol
214 -fobjc-exceptions @gol
217 -fobjc-std=objc1 @gol
218 -freplace-objc-classes @gol
221 -Wassign-intercept @gol
222 -Wno-protocol -Wselector @gol
223 -Wstrict-selector-match @gol
224 -Wundeclared-selector}
226 @item Language Independent Options
227 @xref{Language Independent Options,,Options to Control Diagnostic Messages Formatting}.
228 @gccoptlist{-fmessage-length=@var{n} @gol
229 -fdiagnostics-show-location=@r{[}once@r{|}every-line@r{]} @gol
230 -fno-diagnostics-show-option}
232 @item Warning Options
233 @xref{Warning Options,,Options to Request or Suppress Warnings}.
234 @gccoptlist{-fsyntax-only -fmax-errors=@var{n} -pedantic @gol
235 -pedantic-errors @gol
236 -w -Wextra -Wall -Waddress -Waggregate-return -Warray-bounds @gol
237 -Wno-attributes -Wno-builtin-macro-redefined @gol
238 -Wc++-compat -Wc++0x-compat -Wcast-align -Wcast-qual @gol
239 -Wchar-subscripts -Wclobbered -Wcomment @gol
240 -Wconversion -Wcoverage-mismatch -Wcpp -Wno-deprecated @gol
241 -Wno-deprecated-declarations -Wdisabled-optimization @gol
242 -Wno-div-by-zero -Wdouble-promotion -Wempty-body -Wenum-compare @gol
243 -Wno-endif-labels -Werror -Werror=* @gol
244 -Wfatal-errors -Wfloat-equal -Wformat -Wformat=2 @gol
245 -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
246 -Wformat-security -Wformat-y2k @gol
247 -Wframe-larger-than=@var{len} -Wjump-misses-init -Wignored-qualifiers @gol
248 -Wimplicit -Wimplicit-function-declaration -Wimplicit-int @gol
249 -Winit-self -Winline @gol
250 -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol
251 -Winvalid-pch -Wlarger-than=@var{len} -Wunsafe-loop-optimizations @gol
252 -Wlogical-op -Wlong-long @gol
253 -Wmain -Wmissing-braces -Wmissing-field-initializers @gol
254 -Wmissing-format-attribute -Wmissing-include-dirs @gol
256 -Wno-multichar -Wnonnull -Wno-overflow @gol
257 -Woverlength-strings -Wpacked -Wpacked-bitfield-compat -Wpadded @gol
258 -Wparentheses -Wpedantic-ms-format -Wno-pedantic-ms-format @gol
259 -Wpointer-arith -Wno-pointer-to-int-cast @gol
260 -Wredundant-decls @gol
261 -Wreturn-type -Wsequence-point -Wshadow @gol
262 -Wsign-compare -Wsign-conversion -Wstack-protector @gol
263 -Wstrict-aliasing -Wstrict-aliasing=n @gol
264 -Wstrict-overflow -Wstrict-overflow=@var{n} @gol
265 -Wsuggest-attribute=@r{[}pure@r{|}const@r{|}noreturn@r{]} @gol
266 -Wswitch -Wswitch-default -Wswitch-enum -Wsync-nand @gol
267 -Wsystem-headers -Wtrampolines -Wtrigraphs -Wtype-limits -Wundef @gol
268 -Wuninitialized -Wunknown-pragmas -Wno-pragmas @gol
269 -Wunsuffixed-float-constants -Wunused -Wunused-function @gol
270 -Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value @gol
271 -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable @gol
272 -Wvariadic-macros -Wvla -Wvolatile-register-var -Wwrite-strings}
274 @item C and Objective-C-only Warning Options
275 @gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
276 -Wmissing-parameter-type -Wmissing-prototypes -Wnested-externs @gol
277 -Wold-style-declaration -Wold-style-definition @gol
278 -Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
279 -Wdeclaration-after-statement -Wpointer-sign}
281 @item Debugging Options
282 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
283 @gccoptlist{-d@var{letters} -dumpspecs -dumpmachine -dumpversion @gol
284 -fdbg-cnt-list -fdbg-cnt=@var{counter-value-list} @gol
285 -fdump-noaddr -fdump-unnumbered -fdump-unnumbered-links @gol
286 -fdump-translation-unit@r{[}-@var{n}@r{]} @gol
287 -fdump-class-hierarchy@r{[}-@var{n}@r{]} @gol
288 -fdump-ipa-all -fdump-ipa-cgraph -fdump-ipa-inline @gol
289 -fdump-statistics @gol
291 -fdump-tree-original@r{[}-@var{n}@r{]} @gol
292 -fdump-tree-optimized@r{[}-@var{n}@r{]} @gol
293 -fdump-tree-cfg -fdump-tree-vcg -fdump-tree-alias @gol
295 -fdump-tree-ssa@r{[}-@var{n}@r{]} -fdump-tree-pre@r{[}-@var{n}@r{]} @gol
296 -fdump-tree-ccp@r{[}-@var{n}@r{]} -fdump-tree-dce@r{[}-@var{n}@r{]} @gol
297 -fdump-tree-gimple@r{[}-raw@r{]} -fdump-tree-mudflap@r{[}-@var{n}@r{]} @gol
298 -fdump-tree-dom@r{[}-@var{n}@r{]} @gol
299 -fdump-tree-dse@r{[}-@var{n}@r{]} @gol
300 -fdump-tree-phiprop@r{[}-@var{n}@r{]} @gol
301 -fdump-tree-phiopt@r{[}-@var{n}@r{]} @gol
302 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
303 -fdump-tree-copyrename@r{[}-@var{n}@r{]} @gol
304 -fdump-tree-nrv -fdump-tree-vect @gol
305 -fdump-tree-sink @gol
306 -fdump-tree-sra@r{[}-@var{n}@r{]} @gol
307 -fdump-tree-forwprop@r{[}-@var{n}@r{]} @gol
308 -fdump-tree-fre@r{[}-@var{n}@r{]} @gol
309 -fdump-tree-vrp@r{[}-@var{n}@r{]} @gol
310 -ftree-vectorizer-verbose=@var{n} @gol
311 -fdump-tree-storeccp@r{[}-@var{n}@r{]} @gol
312 -fdump-final-insns=@var{file} @gol
313 -fcompare-debug@r{[}=@var{opts}@r{]} -fcompare-debug-second @gol
314 -feliminate-dwarf2-dups -feliminate-unused-debug-types @gol
315 -feliminate-unused-debug-symbols -femit-class-debug-always @gol
316 -fmem-report -fpre-ipa-mem-report -fpost-ipa-mem-report -fprofile-arcs @gol
317 -frandom-seed=@var{string} -fsched-verbose=@var{n} @gol
318 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
319 -fstack-usage -ftest-coverage -ftime-report -fvar-tracking @gol
320 -fvar-tracking-assignments -fvar-tracking-assignments-toggle @gol
321 -g -g@var{level} -gtoggle -gcoff -gdwarf-@var{version} @gol
322 -ggdb -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol
323 -gvms -gxcoff -gxcoff+ @gol
324 -fno-merge-debug-strings -fno-dwarf2-cfi-asm @gol
325 -fdebug-prefix-map=@var{old}=@var{new} @gol
326 -femit-struct-debug-baseonly -femit-struct-debug-reduced @gol
327 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
328 -p -pg -print-file-name=@var{library} -print-libgcc-file-name @gol
329 -print-multi-directory -print-multi-lib -print-multi-os-directory @gol
330 -print-prog-name=@var{program} -print-search-dirs -Q @gol
331 -print-sysroot -print-sysroot-headers-suffix @gol
332 -save-temps -save-temps=cwd -save-temps=obj -time@r{[}=@var{file}@r{]}}
334 @item Optimization Options
335 @xref{Optimize Options,,Options that Control Optimization}.
336 @gccoptlist{-falign-functions[=@var{n}] -falign-jumps[=@var{n}] @gol
337 -falign-labels[=@var{n}] -falign-loops[=@var{n}] -fassociative-math @gol
338 -fauto-inc-dec -fbranch-probabilities -fbranch-target-load-optimize @gol
339 -fbranch-target-load-optimize2 -fbtr-bb-exclusive -fcaller-saves @gol
340 -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
341 -fcompare-elim -fcprop-registers -fcrossjumping @gol
342 -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
343 -fcx-limited-range @gol
344 -fdata-sections -fdce -fdce -fdelayed-branch @gol
345 -fdelete-null-pointer-checks -fdse -fdevirtualize -fdse @gol
346 -fearly-inlining -fipa-sra -fexpensive-optimizations -ffast-math @gol
347 -ffinite-math-only -ffloat-store -fexcess-precision=@var{style} @gol
348 -fforward-propagate -ffp-contract=@var{style} -ffunction-sections @gol
349 -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm -fgraphite-identity @gol
350 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
351 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
352 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg @gol
353 -fipa-pta -fipa-profile -fipa-pure-const -fipa-reference @gol
354 -fipa-struct-reorg -fira-algorithm=@var{algorithm} @gol
355 -fira-region=@var{region} @gol
356 -fira-loop-pressure -fno-ira-share-save-slots @gol
357 -fno-ira-share-spill-slots -fira-verbose=@var{n} @gol
358 -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
359 -floop-block -floop-flatten -floop-interchange -floop-strip-mine @gol
360 -floop-parallelize-all -flto -flto-compression-level
361 -flto-partition=@var{alg} -flto-report -fmerge-all-constants @gol
362 -fmerge-constants -fmodulo-sched -fmodulo-sched-allow-regmoves @gol
363 -fmove-loop-invariants fmudflap -fmudflapir -fmudflapth -fno-branch-count-reg @gol
364 -fno-default-inline @gol
365 -fno-defer-pop -fno-function-cse -fno-guess-branch-probability @gol
366 -fno-inline -fno-math-errno -fno-peephole -fno-peephole2 @gol
367 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
368 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
369 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
370 -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
371 -fprefetch-loop-arrays @gol
372 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
373 -fprofile-generate=@var{path} @gol
374 -fprofile-use -fprofile-use=@var{path} -fprofile-values @gol
375 -freciprocal-math -fregmove -frename-registers -freorder-blocks @gol
376 -freorder-blocks-and-partition -freorder-functions @gol
377 -frerun-cse-after-loop -freschedule-modulo-scheduled-loops @gol
378 -frounding-math -fsched2-use-superblocks -fsched-pressure @gol
379 -fsched-spec-load -fsched-spec-load-dangerous @gol
380 -fsched-stalled-insns-dep[=@var{n}] -fsched-stalled-insns[=@var{n}] @gol
381 -fsched-group-heuristic -fsched-critical-path-heuristic @gol
382 -fsched-spec-insn-heuristic -fsched-rank-heuristic @gol
383 -fsched-last-insn-heuristic -fsched-dep-count-heuristic @gol
384 -fschedule-insns -fschedule-insns2 -fsection-anchors @gol
385 -fselective-scheduling -fselective-scheduling2 @gol
386 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops @gol
387 -fsignaling-nans -fsingle-precision-constant -fsplit-ivs-in-unroller @gol
388 -fsplit-wide-types -fstack-protector -fstack-protector-all @gol
389 -fstrict-aliasing -fstrict-overflow -fthread-jumps -ftracer @gol
391 -ftree-builtin-call-dce -ftree-ccp -ftree-ch -ftree-copy-prop @gol
392 -ftree-copyrename -ftree-dce -ftree-dominator-opts -ftree-dse @gol
393 -ftree-forwprop -ftree-fre -ftree-loop-if-convert @gol
394 -ftree-loop-if-convert-stores -ftree-loop-im @gol
395 -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
396 -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
397 -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-pta -ftree-reassoc @gol
398 -ftree-sink -ftree-sra -ftree-switch-conversion @gol
399 -ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
400 -funit-at-a-time -funroll-all-loops -funroll-loops @gol
401 -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
402 -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
403 -fwhole-program -fwpa -fuse-linker-plugin @gol
404 --param @var{name}=@var{value}
405 -O -O0 -O1 -O2 -O3 -Os -Ofast}
407 @item Preprocessor Options
408 @xref{Preprocessor Options,,Options Controlling the Preprocessor}.
409 @gccoptlist{-A@var{question}=@var{answer} @gol
410 -A-@var{question}@r{[}=@var{answer}@r{]} @gol
411 -C -dD -dI -dM -dN @gol
412 -D@var{macro}@r{[}=@var{defn}@r{]} -E -H @gol
413 -idirafter @var{dir} @gol
414 -include @var{file} -imacros @var{file} @gol
415 -iprefix @var{file} -iwithprefix @var{dir} @gol
416 -iwithprefixbefore @var{dir} -isystem @var{dir} @gol
417 -imultilib @var{dir} -isysroot @var{dir} @gol
418 -M -MM -MF -MG -MP -MQ -MT -nostdinc @gol
419 -P -fworking-directory -remap @gol
420 -trigraphs -undef -U@var{macro} -Wp,@var{option} @gol
421 -Xpreprocessor @var{option}}
423 @item Assembler Option
424 @xref{Assembler Options,,Passing Options to the Assembler}.
425 @gccoptlist{-Wa,@var{option} -Xassembler @var{option}}
428 @xref{Link Options,,Options for Linking}.
429 @gccoptlist{@var{object-file-name} -l@var{library} @gol
430 -nostartfiles -nodefaultlibs -nostdlib -pie -rdynamic @gol
431 -s -static -static-libgcc -static-libstdc++ -shared @gol
432 -shared-libgcc -symbolic @gol
433 -T @var{script} -Wl,@var{option} -Xlinker @var{option} @gol
436 @item Directory Options
437 @xref{Directory Options,,Options for Directory Search}.
438 @gccoptlist{-B@var{prefix} -I@var{dir} -iplugindir=@var{dir}}
439 -iquote@var{dir} -L@var{dir} -specs=@var{file} -I-
442 @item Machine Dependent Options
443 @xref{Submodel Options,,Hardware Models and Configurations}.
444 @c This list is ordered alphanumerically by subsection name.
445 @c Try and put the significant identifier (CPU or system) first,
446 @c so users have a clue at guessing where the ones they want will be.
449 @gccoptlist{-EB -EL @gol
450 -mmangle-cpu -mcpu=@var{cpu} -mtext=@var{text-section} @gol
451 -mdata=@var{data-section} -mrodata=@var{readonly-data-section}}
454 @gccoptlist{-mapcs-frame -mno-apcs-frame @gol
455 -mabi=@var{name} @gol
456 -mapcs-stack-check -mno-apcs-stack-check @gol
457 -mapcs-float -mno-apcs-float @gol
458 -mapcs-reentrant -mno-apcs-reentrant @gol
459 -msched-prolog -mno-sched-prolog @gol
460 -mlittle-endian -mbig-endian -mwords-little-endian @gol
461 -mfloat-abi=@var{name} -msoft-float -mhard-float -mfpe @gol
462 -mfp16-format=@var{name}
463 -mthumb-interwork -mno-thumb-interwork @gol
464 -mcpu=@var{name} -march=@var{name} -mfpu=@var{name} @gol
465 -mstructure-size-boundary=@var{n} @gol
466 -mabort-on-noreturn @gol
467 -mlong-calls -mno-long-calls @gol
468 -msingle-pic-base -mno-single-pic-base @gol
469 -mpic-register=@var{reg} @gol
470 -mnop-fun-dllimport @gol
471 -mcirrus-fix-invalid-insns -mno-cirrus-fix-invalid-insns @gol
472 -mpoke-function-name @gol
474 -mtpcs-frame -mtpcs-leaf-frame @gol
475 -mcaller-super-interworking -mcallee-super-interworking @gol
477 -mword-relocations @gol
478 -mfix-cortex-m3-ldrd}
481 @gccoptlist{-mmcu=@var{mcu} -mno-interrupts @gol
482 -mcall-prologues -mtiny-stack -mint8}
484 @emph{Blackfin Options}
485 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
486 -msim -momit-leaf-frame-pointer -mno-omit-leaf-frame-pointer @gol
487 -mspecld-anomaly -mno-specld-anomaly -mcsync-anomaly -mno-csync-anomaly @gol
488 -mlow-64k -mno-low64k -mstack-check-l1 -mid-shared-library @gol
489 -mno-id-shared-library -mshared-library-id=@var{n} @gol
490 -mleaf-id-shared-library -mno-leaf-id-shared-library @gol
491 -msep-data -mno-sep-data -mlong-calls -mno-long-calls @gol
492 -mfast-fp -minline-plt -mmulticore -mcorea -mcoreb -msdram @gol
496 @gccoptlist{-mcpu=@var{cpu} -march=@var{cpu} -mtune=@var{cpu} @gol
497 -mmax-stack-frame=@var{n} -melinux-stacksize=@var{n} @gol
498 -metrax4 -metrax100 -mpdebug -mcc-init -mno-side-effects @gol
499 -mstack-align -mdata-align -mconst-align @gol
500 -m32-bit -m16-bit -m8-bit -mno-prologue-epilogue -mno-gotplt @gol
501 -melf -maout -melinux -mlinux -sim -sim2 @gol
502 -mmul-bug-workaround -mno-mul-bug-workaround}
505 @gccoptlist{-mmac -mpush-args}
507 @emph{Darwin Options}
508 @gccoptlist{-all_load -allowable_client -arch -arch_errors_fatal @gol
509 -arch_only -bind_at_load -bundle -bundle_loader @gol
510 -client_name -compatibility_version -current_version @gol
512 -dependency-file -dylib_file -dylinker_install_name @gol
513 -dynamic -dynamiclib -exported_symbols_list @gol
514 -filelist -flat_namespace -force_cpusubtype_ALL @gol
515 -force_flat_namespace -headerpad_max_install_names @gol
517 -image_base -init -install_name -keep_private_externs @gol
518 -multi_module -multiply_defined -multiply_defined_unused @gol
519 -noall_load -no_dead_strip_inits_and_terms @gol
520 -nofixprebinding -nomultidefs -noprebind -noseglinkedit @gol
521 -pagezero_size -prebind -prebind_all_twolevel_modules @gol
522 -private_bundle -read_only_relocs -sectalign @gol
523 -sectobjectsymbols -whyload -seg1addr @gol
524 -sectcreate -sectobjectsymbols -sectorder @gol
525 -segaddr -segs_read_only_addr -segs_read_write_addr @gol
526 -seg_addr_table -seg_addr_table_filename -seglinkedit @gol
527 -segprot -segs_read_only_addr -segs_read_write_addr @gol
528 -single_module -static -sub_library -sub_umbrella @gol
529 -twolevel_namespace -umbrella -undefined @gol
530 -unexported_symbols_list -weak_reference_mismatches @gol
531 -whatsloaded -F -gused -gfull -mmacosx-version-min=@var{version} @gol
532 -mkernel -mone-byte-bool}
534 @emph{DEC Alpha Options}
535 @gccoptlist{-mno-fp-regs -msoft-float -malpha-as -mgas @gol
536 -mieee -mieee-with-inexact -mieee-conformant @gol
537 -mfp-trap-mode=@var{mode} -mfp-rounding-mode=@var{mode} @gol
538 -mtrap-precision=@var{mode} -mbuild-constants @gol
539 -mcpu=@var{cpu-type} -mtune=@var{cpu-type} @gol
540 -mbwx -mmax -mfix -mcix @gol
541 -mfloat-vax -mfloat-ieee @gol
542 -mexplicit-relocs -msmall-data -mlarge-data @gol
543 -msmall-text -mlarge-text @gol
544 -mmemory-latency=@var{time}}
546 @emph{DEC Alpha/VMS Options}
547 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
550 @gccoptlist{-msmall-model -mno-lsim}
553 @gccoptlist{-mgpr-32 -mgpr-64 -mfpr-32 -mfpr-64 @gol
554 -mhard-float -msoft-float @gol
555 -malloc-cc -mfixed-cc -mdword -mno-dword @gol
556 -mdouble -mno-double @gol
557 -mmedia -mno-media -mmuladd -mno-muladd @gol
558 -mfdpic -minline-plt -mgprel-ro -multilib-library-pic @gol
559 -mlinked-fp -mlong-calls -malign-labels @gol
560 -mlibrary-pic -macc-4 -macc-8 @gol
561 -mpack -mno-pack -mno-eflags -mcond-move -mno-cond-move @gol
562 -moptimize-membar -mno-optimize-membar @gol
563 -mscc -mno-scc -mcond-exec -mno-cond-exec @gol
564 -mvliw-branch -mno-vliw-branch @gol
565 -mmulti-cond-exec -mno-multi-cond-exec -mnested-cond-exec @gol
566 -mno-nested-cond-exec -mtomcat-stats @gol
570 @emph{GNU/Linux Options}
571 @gccoptlist{-mglibc -muclibc -mbionic -mandroid @gol
572 -tno-android-cc -tno-android-ld}
574 @emph{H8/300 Options}
575 @gccoptlist{-mrelax -mh -ms -mn -mint32 -malign-300}
578 @gccoptlist{-march=@var{architecture-type} @gol
579 -mbig-switch -mdisable-fpregs -mdisable-indexing @gol
580 -mfast-indirect-calls -mgas -mgnu-ld -mhp-ld @gol
581 -mfixed-range=@var{register-range} @gol
582 -mjump-in-delay -mlinker-opt -mlong-calls @gol
583 -mlong-load-store -mno-big-switch -mno-disable-fpregs @gol
584 -mno-disable-indexing -mno-fast-indirect-calls -mno-gas @gol
585 -mno-jump-in-delay -mno-long-load-store @gol
586 -mno-portable-runtime -mno-soft-float @gol
587 -mno-space-regs -msoft-float -mpa-risc-1-0 @gol
588 -mpa-risc-1-1 -mpa-risc-2-0 -mportable-runtime @gol
589 -mschedule=@var{cpu-type} -mspace-regs -msio -mwsio @gol
590 -munix=@var{unix-std} -nolibdld -static -threads}
592 @emph{i386 and x86-64 Options}
593 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
594 -mfpmath=@var{unit} @gol
595 -masm=@var{dialect} -mno-fancy-math-387 @gol
596 -mno-fp-ret-in-387 -msoft-float @gol
597 -mno-wide-multiply -mrtd -malign-double @gol
598 -mpreferred-stack-boundary=@var{num}
599 -mincoming-stack-boundary=@var{num} @gol
600 -mcld -mcx16 -msahf -mmovbe -mcrc32 -mrecip -mvzeroupper @gol
601 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -msse4 -mavx @gol
602 -maes -mpclmul -mfsgsbase -mrdrnd -mf16c -mfused-madd @gol
603 -msse4a -m3dnow -mpopcnt -mabm -mbmi -mtbm -mfma4 -mxop -mlwp @gol
604 -mthreads -mno-align-stringops -minline-all-stringops @gol
605 -minline-stringops-dynamically -mstringop-strategy=@var{alg} @gol
606 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
607 -m96bit-long-double -mregparm=@var{num} -msseregparm @gol
608 -mveclibabi=@var{type} -mvect8-ret-in-mem @gol
609 -mpc32 -mpc64 -mpc80 -mstackrealign @gol
610 -momit-leaf-frame-pointer -mno-red-zone -mno-tls-direct-seg-refs @gol
611 -mcmodel=@var{code-model} -mabi=@var{name} @gol
612 -m32 -m64 -mlarge-data-threshold=@var{num} @gol
613 -msse2avx -mfentry -m8bit-idiv}
616 @gccoptlist{-mbig-endian -mlittle-endian -mgnu-as -mgnu-ld -mno-pic @gol
617 -mvolatile-asm-stop -mregister-names -msdata -mno-sdata @gol
618 -mconstant-gp -mauto-pic -mfused-madd @gol
619 -minline-float-divide-min-latency @gol
620 -minline-float-divide-max-throughput @gol
621 -mno-inline-float-divide @gol
622 -minline-int-divide-min-latency @gol
623 -minline-int-divide-max-throughput @gol
624 -mno-inline-int-divide @gol
625 -minline-sqrt-min-latency -minline-sqrt-max-throughput @gol
626 -mno-inline-sqrt @gol
627 -mdwarf2-asm -mearly-stop-bits @gol
628 -mfixed-range=@var{register-range} -mtls-size=@var{tls-size} @gol
629 -mtune=@var{cpu-type} -milp32 -mlp64 @gol
630 -msched-br-data-spec -msched-ar-data-spec -msched-control-spec @gol
631 -msched-br-in-data-spec -msched-ar-in-data-spec -msched-in-control-spec @gol
632 -msched-spec-ldc -msched-spec-control-ldc @gol
633 -msched-prefer-non-data-spec-insns -msched-prefer-non-control-spec-insns @gol
634 -msched-stop-bits-after-every-cycle -msched-count-spec-in-critical-path @gol
635 -msel-sched-dont-check-control-spec -msched-fp-mem-deps-zero-cost @gol
636 -msched-max-memory-insns-hard-limit -msched-max-memory-insns=@var{max-insns}}
638 @emph{IA-64/VMS Options}
639 @gccoptlist{-mvms-return-codes -mdebug-main=@var{prefix} -mmalloc64}
642 @gccoptlist{-mbarrel-shift-enabled -mdivide-enabled -mmultiply-enabled @gol
643 -msign-extend-enabled -muser-enabled}
645 @emph{M32R/D Options}
646 @gccoptlist{-m32r2 -m32rx -m32r @gol
648 -malign-loops -mno-align-loops @gol
649 -missue-rate=@var{number} @gol
650 -mbranch-cost=@var{number} @gol
651 -mmodel=@var{code-size-model-type} @gol
652 -msdata=@var{sdata-type} @gol
653 -mno-flush-func -mflush-func=@var{name} @gol
654 -mno-flush-trap -mflush-trap=@var{number} @gol
658 @gccoptlist{-mcpu=@var{cpu} -msim -memregs=@var{number}}
660 @emph{M680x0 Options}
661 @gccoptlist{-march=@var{arch} -mcpu=@var{cpu} -mtune=@var{tune}
662 -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 @gol
663 -m68060 -mcpu32 -m5200 -m5206e -m528x -m5307 -m5407 @gol
664 -mcfv4e -mbitfield -mno-bitfield -mc68000 -mc68020 @gol
665 -mnobitfield -mrtd -mno-rtd -mdiv -mno-div -mshort @gol
666 -mno-short -mhard-float -m68881 -msoft-float -mpcrel @gol
667 -malign-int -mstrict-align -msep-data -mno-sep-data @gol
668 -mshared-library-id=n -mid-shared-library -mno-id-shared-library @gol
671 @emph{M68hc1x Options}
672 @gccoptlist{-m6811 -m6812 -m68hc11 -m68hc12 -m68hcs12 @gol
673 -mauto-incdec -minmax -mlong-calls -mshort @gol
674 -msoft-reg-count=@var{count}}
677 @gccoptlist{-mhardlit -mno-hardlit -mdiv -mno-div -mrelax-immediates @gol
678 -mno-relax-immediates -mwide-bitfields -mno-wide-bitfields @gol
679 -m4byte-functions -mno-4byte-functions -mcallgraph-data @gol
680 -mno-callgraph-data -mslow-bytes -mno-slow-bytes -mno-lsim @gol
681 -mlittle-endian -mbig-endian -m210 -m340 -mstack-increment}
684 @gccoptlist{-mabsdiff -mall-opts -maverage -mbased=@var{n} -mbitops @gol
685 -mc=@var{n} -mclip -mconfig=@var{name} -mcop -mcop32 -mcop64 -mivc2 @gol
686 -mdc -mdiv -meb -mel -mio-volatile -ml -mleadz -mm -mminmax @gol
687 -mmult -mno-opts -mrepeat -ms -msatur -msdram -msim -msimnovec -mtf @gol
690 @emph{MicroBlaze Options}
691 @gccoptlist{-msoft-float -mhard-float -msmall-divides -mcpu=@var{cpu} @gol
692 -mmemcpy -mxl-soft-mul -mxl-soft-div -mxl-barrel-shift @gol
693 -mxl-pattern-compare -mxl-stack-check -mxl-gp-opt -mno-clearbss @gol
694 -mxl-multiply-high -mxl-float-convert -mxl-float-sqrt @gol
695 -mxl-mode-@var{app-model}}
698 @gccoptlist{-EL -EB -march=@var{arch} -mtune=@var{arch} @gol
699 -mips1 -mips2 -mips3 -mips4 -mips32 -mips32r2 @gol
700 -mips64 -mips64r2 @gol
701 -mips16 -mno-mips16 -mflip-mips16 @gol
702 -minterlink-mips16 -mno-interlink-mips16 @gol
703 -mabi=@var{abi} -mabicalls -mno-abicalls @gol
704 -mshared -mno-shared -mplt -mno-plt -mxgot -mno-xgot @gol
705 -mgp32 -mgp64 -mfp32 -mfp64 -mhard-float -msoft-float @gol
706 -msingle-float -mdouble-float -mdsp -mno-dsp -mdspr2 -mno-dspr2 @gol
707 -mfpu=@var{fpu-type} @gol
708 -msmartmips -mno-smartmips @gol
709 -mpaired-single -mno-paired-single -mdmx -mno-mdmx @gol
710 -mips3d -mno-mips3d -mmt -mno-mt -mllsc -mno-llsc @gol
711 -mlong64 -mlong32 -msym32 -mno-sym32 @gol
712 -G@var{num} -mlocal-sdata -mno-local-sdata @gol
713 -mextern-sdata -mno-extern-sdata -mgpopt -mno-gopt @gol
714 -membedded-data -mno-embedded-data @gol
715 -muninit-const-in-rodata -mno-uninit-const-in-rodata @gol
716 -mcode-readable=@var{setting} @gol
717 -msplit-addresses -mno-split-addresses @gol
718 -mexplicit-relocs -mno-explicit-relocs @gol
719 -mcheck-zero-division -mno-check-zero-division @gol
720 -mdivide-traps -mdivide-breaks @gol
721 -mmemcpy -mno-memcpy -mlong-calls -mno-long-calls @gol
722 -mmad -mno-mad -mfused-madd -mno-fused-madd -nocpp @gol
723 -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400 @gol
724 -mfix-r10000 -mno-fix-r10000 -mfix-vr4120 -mno-fix-vr4120 @gol
725 -mfix-vr4130 -mno-fix-vr4130 -mfix-sb1 -mno-fix-sb1 @gol
726 -mflush-func=@var{func} -mno-flush-func @gol
727 -mbranch-cost=@var{num} -mbranch-likely -mno-branch-likely @gol
728 -mfp-exceptions -mno-fp-exceptions @gol
729 -mvr4130-align -mno-vr4130-align -msynci -mno-synci @gol
730 -mrelax-pic-calls -mno-relax-pic-calls -mmcount-ra-address}
733 @gccoptlist{-mlibfuncs -mno-libfuncs -mepsilon -mno-epsilon -mabi=gnu @gol
734 -mabi=mmixware -mzero-extend -mknuthdiv -mtoplevel-symbols @gol
735 -melf -mbranch-predict -mno-branch-predict -mbase-addresses @gol
736 -mno-base-addresses -msingle-exit -mno-single-exit}
738 @emph{MN10300 Options}
739 @gccoptlist{-mmult-bug -mno-mult-bug @gol
740 -mno-am33 -mam33 -mam33-2 -mam34 @gol
741 -mtune=@var{cpu-type} @gol
742 -mreturn-pointer-on-d0 @gol
743 -mno-crt0 -mrelax -mliw}
745 @emph{PDP-11 Options}
746 @gccoptlist{-mfpu -msoft-float -mac0 -mno-ac0 -m40 -m45 -m10 @gol
747 -mbcopy -mbcopy-builtin -mint32 -mno-int16 @gol
748 -mint16 -mno-int32 -mfloat32 -mno-float64 @gol
749 -mfloat64 -mno-float32 -mabshi -mno-abshi @gol
750 -mbranch-expensive -mbranch-cheap @gol
751 -munix-asm -mdec-asm}
753 @emph{picoChip Options}
754 @gccoptlist{-mae=@var{ae_type} -mvliw-lookahead=@var{N} @gol
755 -msymbol-as-address -mno-inefficient-warnings}
757 @emph{PowerPC Options}
758 See RS/6000 and PowerPC Options.
760 @emph{RS/6000 and PowerPC Options}
761 @gccoptlist{-mcpu=@var{cpu-type} @gol
762 -mtune=@var{cpu-type} @gol
763 -mcmodel=@var{code-model} @gol
764 -mpower -mno-power -mpower2 -mno-power2 @gol
765 -mpowerpc -mpowerpc64 -mno-powerpc @gol
766 -maltivec -mno-altivec @gol
767 -mpowerpc-gpopt -mno-powerpc-gpopt @gol
768 -mpowerpc-gfxopt -mno-powerpc-gfxopt @gol
769 -mmfcrf -mno-mfcrf -mpopcntb -mno-popcntb -mpopcntd -mno-popcntd @gol
770 -mfprnd -mno-fprnd @gol
771 -mcmpb -mno-cmpb -mmfpgpr -mno-mfpgpr -mhard-dfp -mno-hard-dfp @gol
772 -mnew-mnemonics -mold-mnemonics @gol
773 -mfull-toc -mminimal-toc -mno-fp-in-toc -mno-sum-in-toc @gol
774 -m64 -m32 -mxl-compat -mno-xl-compat -mpe @gol
775 -malign-power -malign-natural @gol
776 -msoft-float -mhard-float -mmultiple -mno-multiple @gol
777 -msingle-float -mdouble-float -msimple-fpu @gol
778 -mstring -mno-string -mupdate -mno-update @gol
779 -mavoid-indexed-addresses -mno-avoid-indexed-addresses @gol
780 -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align @gol
781 -mstrict-align -mno-strict-align -mrelocatable @gol
782 -mno-relocatable -mrelocatable-lib -mno-relocatable-lib @gol
783 -mtoc -mno-toc -mlittle -mlittle-endian -mbig -mbig-endian @gol
784 -mdynamic-no-pic -maltivec -mswdiv -msingle-pic-base @gol
785 -mprioritize-restricted-insns=@var{priority} @gol
786 -msched-costly-dep=@var{dependence_type} @gol
787 -minsert-sched-nops=@var{scheme} @gol
788 -mcall-sysv -mcall-netbsd @gol
789 -maix-struct-return -msvr4-struct-return @gol
790 -mabi=@var{abi-type} -msecure-plt -mbss-plt @gol
791 -mblock-move-inline-limit=@var{num} @gol
792 -misel -mno-isel @gol
793 -misel=yes -misel=no @gol
795 -mspe=yes -mspe=no @gol
797 -mgen-cell-microcode -mwarn-cell-microcode @gol
798 -mvrsave -mno-vrsave @gol
799 -mmulhw -mno-mulhw @gol
800 -mdlmzb -mno-dlmzb @gol
801 -mfloat-gprs=yes -mfloat-gprs=no -mfloat-gprs=single -mfloat-gprs=double @gol
802 -mprototype -mno-prototype @gol
803 -msim -mmvme -mads -myellowknife -memb -msdata @gol
804 -msdata=@var{opt} -mvxworks -G @var{num} -pthread @gol
805 -mrecip -mrecip=@var{opt} -mno-recip -mrecip-precision
806 -mno-recip-precision @gol
807 -mveclibabi=@var{type} -mfriz -mno-friz}
810 @gccoptlist{-m64bit-doubles -m32bit-doubles -fpu -nofpu@gol
812 -mbig-endian-data -mlittle-endian-data @gol
815 -mas100-syntax -mno-as100-syntax@gol
817 -mmax-constant-size=@gol
819 -msave-acc-in-interrupts}
821 @emph{S/390 and zSeries Options}
822 @gccoptlist{-mtune=@var{cpu-type} -march=@var{cpu-type} @gol
823 -mhard-float -msoft-float -mhard-dfp -mno-hard-dfp @gol
824 -mlong-double-64 -mlong-double-128 @gol
825 -mbackchain -mno-backchain -mpacked-stack -mno-packed-stack @gol
826 -msmall-exec -mno-small-exec -mmvcle -mno-mvcle @gol
827 -m64 -m31 -mdebug -mno-debug -mesa -mzarch @gol
828 -mtpf-trace -mno-tpf-trace -mfused-madd -mno-fused-madd @gol
829 -mwarn-framesize -mwarn-dynamicstack -mstack-size -mstack-guard}
832 @gccoptlist{-meb -mel @gol
836 -mscore5 -mscore5u -mscore7 -mscore7d}
839 @gccoptlist{-m1 -m2 -m2e @gol
840 -m2a-nofpu -m2a-single-only -m2a-single -m2a @gol
842 -m4-nofpu -m4-single-only -m4-single -m4 @gol
843 -m4a-nofpu -m4a-single-only -m4a-single -m4a -m4al @gol
844 -m5-64media -m5-64media-nofpu @gol
845 -m5-32media -m5-32media-nofpu @gol
846 -m5-compact -m5-compact-nofpu @gol
847 -mb -ml -mdalign -mrelax @gol
848 -mbigtable -mfmovd -mhitachi -mrenesas -mno-renesas -mnomacsave @gol
849 -mieee -mbitops -misize -minline-ic_invalidate -mpadstruct -mspace @gol
850 -mprefergot -musermode -multcost=@var{number} -mdiv=@var{strategy} @gol
851 -mdivsi3_libfunc=@var{name} -mfixed-range=@var{register-range} @gol
852 -madjust-unroll -mindexed-addressing -mgettrcost=@var{number} -mpt-fixed @gol
853 -maccumulate-outgoing-args -minvalid-symbols}
855 @emph{Solaris 2 Options}
856 @gccoptlist{-mimpure-text -mno-impure-text @gol
860 @gccoptlist{-mcpu=@var{cpu-type} @gol
861 -mtune=@var{cpu-type} @gol
862 -mcmodel=@var{code-model} @gol
863 -m32 -m64 -mapp-regs -mno-app-regs @gol
864 -mfaster-structs -mno-faster-structs @gol
865 -mfpu -mno-fpu -mhard-float -msoft-float @gol
866 -mhard-quad-float -msoft-quad-float @gol
868 -mstack-bias -mno-stack-bias @gol
869 -munaligned-doubles -mno-unaligned-doubles @gol
870 -mv8plus -mno-v8plus -mvis -mno-vis}
873 @gccoptlist{-mwarn-reloc -merror-reloc @gol
874 -msafe-dma -munsafe-dma @gol
876 -msmall-mem -mlarge-mem -mstdmain @gol
877 -mfixed-range=@var{register-range} @gol
879 -maddress-space-conversion -mno-address-space-conversion @gol
880 -mcache-size=@var{cache-size} @gol
881 -matomic-updates -mno-atomic-updates}
883 @emph{System V Options}
884 @gccoptlist{-Qy -Qn -YP,@var{paths} -Ym,@var{dir}}
887 @gccoptlist{-mlong-calls -mno-long-calls -mep -mno-ep @gol
888 -mprolog-function -mno-prolog-function -mspace @gol
889 -mtda=@var{n} -msda=@var{n} -mzda=@var{n} @gol
890 -mapp-regs -mno-app-regs @gol
891 -mdisable-callt -mno-disable-callt @gol
894 -mv850e1 -mv850es @gol
899 @gccoptlist{-mg -mgnu -munix}
901 @emph{VxWorks Options}
902 @gccoptlist{-mrtp -non-static -Bstatic -Bdynamic @gol
903 -Xbind-lazy -Xbind-now}
905 @emph{x86-64 Options}
906 See i386 and x86-64 Options.
908 @emph{i386 and x86-64 Windows Options}
909 @gccoptlist{-mconsole -mcygwin -mno-cygwin -mdll
910 -mnop-fun-dllimport -mthread @gol
911 -municode -mwin32 -mwindows -fno-set-stack-executable}
913 @emph{Xstormy16 Options}
916 @emph{Xtensa Options}
917 @gccoptlist{-mconst16 -mno-const16 @gol
918 -mfused-madd -mno-fused-madd @gol
920 -mserialize-volatile -mno-serialize-volatile @gol
921 -mtext-section-literals -mno-text-section-literals @gol
922 -mtarget-align -mno-target-align @gol
923 -mlongcalls -mno-longcalls}
925 @emph{zSeries Options}
926 See S/390 and zSeries Options.
928 @item Code Generation Options
929 @xref{Code Gen Options,,Options for Code Generation Conventions}.
930 @gccoptlist{-fcall-saved-@var{reg} -fcall-used-@var{reg} @gol
931 -ffixed-@var{reg} -fexceptions @gol
932 -fnon-call-exceptions -funwind-tables @gol
933 -fasynchronous-unwind-tables @gol
934 -finhibit-size-directive -finstrument-functions @gol
935 -finstrument-functions-exclude-function-list=@var{sym},@var{sym},@dots{} @gol
936 -finstrument-functions-exclude-file-list=@var{file},@var{file},@dots{} @gol
937 -fno-common -fno-ident @gol
938 -fpcc-struct-return -fpic -fPIC -fpie -fPIE @gol
939 -fno-jump-tables @gol
940 -frecord-gcc-switches @gol
941 -freg-struct-return -fshort-enums @gol
942 -fshort-double -fshort-wchar @gol
943 -fverbose-asm -fpack-struct[=@var{n}] -fstack-check @gol
944 -fstack-limit-register=@var{reg} -fstack-limit-symbol=@var{sym} @gol
945 -fno-stack-limit -fsplit-stack @gol
946 -fleading-underscore -ftls-model=@var{model} @gol
947 -ftrapv -fwrapv -fbounds-check @gol
948 -fvisibility -fstrict-volatile-bitfields}
952 * Overall Options:: Controlling the kind of output:
953 an executable, object files, assembler files,
954 or preprocessed source.
955 * C Dialect Options:: Controlling the variant of C language compiled.
956 * C++ Dialect Options:: Variations on C++.
957 * Objective-C and Objective-C++ Dialect Options:: Variations on Objective-C
959 * Language Independent Options:: Controlling how diagnostics should be
961 * Warning Options:: How picky should the compiler be?
962 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
963 * Optimize Options:: How much optimization?
964 * Preprocessor Options:: Controlling header files and macro definitions.
965 Also, getting dependency information for Make.
966 * Assembler Options:: Passing options to the assembler.
967 * Link Options:: Specifying libraries and so on.
968 * Directory Options:: Where to find header files and libraries.
969 Where to find the compiler executable files.
970 * Spec Files:: How to pass switches to sub-processes.
971 * Target Options:: Running a cross-compiler, or an old version of GCC.
974 @node Overall Options
975 @section Options Controlling the Kind of Output
977 Compilation can involve up to four stages: preprocessing, compilation
978 proper, assembly and linking, always in that order. GCC is capable of
979 preprocessing and compiling several files either into several
980 assembler input files, or into one assembler input file; then each
981 assembler input file produces an object file, and linking combines all
982 the object files (those newly compiled, and those specified as input)
983 into an executable file.
985 @cindex file name suffix
986 For any given input file, the file name suffix determines what kind of
991 C source code which must be preprocessed.
994 C source code which should not be preprocessed.
997 C++ source code which should not be preprocessed.
1000 Objective-C source code. Note that you must link with the @file{libobjc}
1001 library to make an Objective-C program work.
1004 Objective-C source code which should not be preprocessed.
1008 Objective-C++ source code. Note that you must link with the @file{libobjc}
1009 library to make an Objective-C++ program work. Note that @samp{.M} refers
1010 to a literal capital M@.
1012 @item @var{file}.mii
1013 Objective-C++ source code which should not be preprocessed.
1016 C, C++, Objective-C or Objective-C++ header file to be turned into a
1017 precompiled header (default), or C, C++ header file to be turned into an
1018 Ada spec (via the @option{-fdump-ada-spec} switch).
1021 @itemx @var{file}.cp
1022 @itemx @var{file}.cxx
1023 @itemx @var{file}.cpp
1024 @itemx @var{file}.CPP
1025 @itemx @var{file}.c++
1027 C++ source code which must be preprocessed. Note that in @samp{.cxx},
1028 the last two letters must both be literally @samp{x}. Likewise,
1029 @samp{.C} refers to a literal capital C@.
1033 Objective-C++ source code which must be preprocessed.
1035 @item @var{file}.mii
1036 Objective-C++ source code which should not be preprocessed.
1040 @itemx @var{file}.hp
1041 @itemx @var{file}.hxx
1042 @itemx @var{file}.hpp
1043 @itemx @var{file}.HPP
1044 @itemx @var{file}.h++
1045 @itemx @var{file}.tcc
1046 C++ header file to be turned into a precompiled header or Ada spec.
1049 @itemx @var{file}.for
1050 @itemx @var{file}.ftn
1051 Fixed form Fortran source code which should not be preprocessed.
1054 @itemx @var{file}.FOR
1055 @itemx @var{file}.fpp
1056 @itemx @var{file}.FPP
1057 @itemx @var{file}.FTN
1058 Fixed form Fortran source code which must be preprocessed (with the traditional
1061 @item @var{file}.f90
1062 @itemx @var{file}.f95
1063 @itemx @var{file}.f03
1064 @itemx @var{file}.f08
1065 Free form Fortran source code which should not be preprocessed.
1067 @item @var{file}.F90
1068 @itemx @var{file}.F95
1069 @itemx @var{file}.F03
1070 @itemx @var{file}.F08
1071 Free form Fortran source code which must be preprocessed (with the
1072 traditional preprocessor).
1077 @c FIXME: Descriptions of Java file types.
1083 @item @var{file}.ads
1084 Ada source code file which contains a library unit declaration (a
1085 declaration of a package, subprogram, or generic, or a generic
1086 instantiation), or a library unit renaming declaration (a package,
1087 generic, or subprogram renaming declaration). Such files are also
1090 @item @var{file}.adb
1091 Ada source code file containing a library unit body (a subprogram or
1092 package body). Such files are also called @dfn{bodies}.
1094 @c GCC also knows about some suffixes for languages not yet included:
1105 @itemx @var{file}.sx
1106 Assembler code which must be preprocessed.
1109 An object file to be fed straight into linking.
1110 Any file name with no recognized suffix is treated this way.
1114 You can specify the input language explicitly with the @option{-x} option:
1117 @item -x @var{language}
1118 Specify explicitly the @var{language} for the following input files
1119 (rather than letting the compiler choose a default based on the file
1120 name suffix). This option applies to all following input files until
1121 the next @option{-x} option. Possible values for @var{language} are:
1123 c c-header cpp-output
1124 c++ c++-header c++-cpp-output
1125 objective-c objective-c-header objective-c-cpp-output
1126 objective-c++ objective-c++-header objective-c++-cpp-output
1127 assembler assembler-with-cpp
1129 f77 f77-cpp-input f95 f95-cpp-input
1135 Turn off any specification of a language, so that subsequent files are
1136 handled according to their file name suffixes (as they are if @option{-x}
1137 has not been used at all).
1139 @item -pass-exit-codes
1140 @opindex pass-exit-codes
1141 Normally the @command{gcc} program will exit with the code of 1 if any
1142 phase of the compiler returns a non-success return code. If you specify
1143 @option{-pass-exit-codes}, the @command{gcc} program will instead return with
1144 numerically highest error produced by any phase that returned an error
1145 indication. The C, C++, and Fortran frontends return 4, if an internal
1146 compiler error is encountered.
1149 If you only want some of the stages of compilation, you can use
1150 @option{-x} (or filename suffixes) to tell @command{gcc} where to start, and
1151 one of the options @option{-c}, @option{-S}, or @option{-E} to say where
1152 @command{gcc} is to stop. Note that some combinations (for example,
1153 @samp{-x cpp-output -E}) instruct @command{gcc} to do nothing at all.
1158 Compile or assemble the source files, but do not link. The linking
1159 stage simply is not done. The ultimate output is in the form of an
1160 object file for each source file.
1162 By default, the object file name for a source file is made by replacing
1163 the suffix @samp{.c}, @samp{.i}, @samp{.s}, etc., with @samp{.o}.
1165 Unrecognized input files, not requiring compilation or assembly, are
1170 Stop after the stage of compilation proper; do not assemble. The output
1171 is in the form of an assembler code file for each non-assembler input
1174 By default, the assembler file name for a source file is made by
1175 replacing the suffix @samp{.c}, @samp{.i}, etc., with @samp{.s}.
1177 Input files that don't require compilation are ignored.
1181 Stop after the preprocessing stage; do not run the compiler proper. The
1182 output is in the form of preprocessed source code, which is sent to the
1185 Input files which don't require preprocessing are ignored.
1187 @cindex output file option
1190 Place output in file @var{file}. This applies regardless to whatever
1191 sort of output is being produced, whether it be an executable file,
1192 an object file, an assembler file or preprocessed C code.
1194 If @option{-o} is not specified, the default is to put an executable
1195 file in @file{a.out}, the object file for
1196 @file{@var{source}.@var{suffix}} in @file{@var{source}.o}, its
1197 assembler file in @file{@var{source}.s}, a precompiled header file in
1198 @file{@var{source}.@var{suffix}.gch}, and all preprocessed C source on
1203 Print (on standard error output) the commands executed to run the stages
1204 of compilation. Also print the version number of the compiler driver
1205 program and of the preprocessor and the compiler proper.
1209 Like @option{-v} except the commands are not executed and arguments
1210 are quoted unless they contain only alphanumeric characters or @code{./-_}.
1211 This is useful for shell scripts to capture the driver-generated command lines.
1215 Use pipes rather than temporary files for communication between the
1216 various stages of compilation. This fails to work on some systems where
1217 the assembler is unable to read from a pipe; but the GNU assembler has
1222 Print (on the standard output) a description of the command line options
1223 understood by @command{gcc}. If the @option{-v} option is also specified
1224 then @option{--help} will also be passed on to the various processes
1225 invoked by @command{gcc}, so that they can display the command line options
1226 they accept. If the @option{-Wextra} option has also been specified
1227 (prior to the @option{--help} option), then command line options which
1228 have no documentation associated with them will also be displayed.
1231 @opindex target-help
1232 Print (on the standard output) a description of target-specific command
1233 line options for each tool. For some targets extra target-specific
1234 information may also be printed.
1236 @item --help=@{@var{class}@r{|[}^@r{]}@var{qualifier}@}@r{[},@dots{}@r{]}
1237 Print (on the standard output) a description of the command line
1238 options understood by the compiler that fit into all specified classes
1239 and qualifiers. These are the supported classes:
1242 @item @samp{optimizers}
1243 This will display all of the optimization options supported by the
1246 @item @samp{warnings}
1247 This will display all of the options controlling warning messages
1248 produced by the compiler.
1251 This will display target-specific options. Unlike the
1252 @option{--target-help} option however, target-specific options of the
1253 linker and assembler will not be displayed. This is because those
1254 tools do not currently support the extended @option{--help=} syntax.
1257 This will display the values recognized by the @option{--param}
1260 @item @var{language}
1261 This will display the options supported for @var{language}, where
1262 @var{language} is the name of one of the languages supported in this
1266 This will display the options that are common to all languages.
1269 These are the supported qualifiers:
1272 @item @samp{undocumented}
1273 Display only those options which are undocumented.
1276 Display options which take an argument that appears after an equal
1277 sign in the same continuous piece of text, such as:
1278 @samp{--help=target}.
1280 @item @samp{separate}
1281 Display options which take an argument that appears as a separate word
1282 following the original option, such as: @samp{-o output-file}.
1285 Thus for example to display all the undocumented target-specific
1286 switches supported by the compiler the following can be used:
1289 --help=target,undocumented
1292 The sense of a qualifier can be inverted by prefixing it with the
1293 @samp{^} character, so for example to display all binary warning
1294 options (i.e., ones that are either on or off and that do not take an
1295 argument), which have a description the following can be used:
1298 --help=warnings,^joined,^undocumented
1301 The argument to @option{--help=} should not consist solely of inverted
1304 Combining several classes is possible, although this usually
1305 restricts the output by so much that there is nothing to display. One
1306 case where it does work however is when one of the classes is
1307 @var{target}. So for example to display all the target-specific
1308 optimization options the following can be used:
1311 --help=target,optimizers
1314 The @option{--help=} option can be repeated on the command line. Each
1315 successive use will display its requested class of options, skipping
1316 those that have already been displayed.
1318 If the @option{-Q} option appears on the command line before the
1319 @option{--help=} option, then the descriptive text displayed by
1320 @option{--help=} is changed. Instead of describing the displayed
1321 options, an indication is given as to whether the option is enabled,
1322 disabled or set to a specific value (assuming that the compiler
1323 knows this at the point where the @option{--help=} option is used).
1325 Here is a truncated example from the ARM port of @command{gcc}:
1328 % gcc -Q -mabi=2 --help=target -c
1329 The following options are target specific:
1331 -mabort-on-noreturn [disabled]
1335 The output is sensitive to the effects of previous command line
1336 options, so for example it is possible to find out which optimizations
1337 are enabled at @option{-O2} by using:
1340 -Q -O2 --help=optimizers
1343 Alternatively you can discover which binary optimizations are enabled
1344 by @option{-O3} by using:
1347 gcc -c -Q -O3 --help=optimizers > /tmp/O3-opts
1348 gcc -c -Q -O2 --help=optimizers > /tmp/O2-opts
1349 diff /tmp/O2-opts /tmp/O3-opts | grep enabled
1352 @item -no-canonical-prefixes
1353 @opindex no-canonical-prefixes
1354 Do not expand any symbolic links, resolve references to @samp{/../}
1355 or @samp{/./}, or make the path absolute when generating a relative
1360 Display the version number and copyrights of the invoked GCC@.
1364 Invoke all subcommands under a wrapper program. The name of the
1365 wrapper program and its parameters are passed as a comma separated
1369 gcc -c t.c -wrapper gdb,--args
1372 This will invoke all subprograms of @command{gcc} under
1373 @samp{gdb --args}, thus the invocation of @command{cc1} will be
1374 @samp{gdb --args cc1 @dots{}}.
1376 @item -fplugin=@var{name}.so
1377 Load the plugin code in file @var{name}.so, assumed to be a
1378 shared object to be dlopen'd by the compiler. The base name of
1379 the shared object file is used to identify the plugin for the
1380 purposes of argument parsing (See
1381 @option{-fplugin-arg-@var{name}-@var{key}=@var{value}} below).
1382 Each plugin should define the callback functions specified in the
1385 @item -fplugin-arg-@var{name}-@var{key}=@var{value}
1386 Define an argument called @var{key} with a value of @var{value}
1387 for the plugin called @var{name}.
1389 @item -fdump-ada-spec@r{[}-slim@r{]}
1390 For C and C++ source and include files, generate corresponding Ada
1391 specs. @xref{Generating Ada Bindings for C and C++ headers,,, gnat_ugn,
1392 GNAT User's Guide}, which provides detailed documentation on this feature.
1394 @item -fdump-go-spec=@var{file}
1395 For input files in any language, generate corresponding Go
1396 declarations in @var{file}. This generates Go @code{const},
1397 @code{type}, @code{var}, and @code{func} declarations which may be a
1398 useful way to start writing a Go interface to code written in some
1401 @include @value{srcdir}/../libiberty/at-file.texi
1405 @section Compiling C++ Programs
1407 @cindex suffixes for C++ source
1408 @cindex C++ source file suffixes
1409 C++ source files conventionally use one of the suffixes @samp{.C},
1410 @samp{.cc}, @samp{.cpp}, @samp{.CPP}, @samp{.c++}, @samp{.cp}, or
1411 @samp{.cxx}; C++ header files often use @samp{.hh}, @samp{.hpp},
1412 @samp{.H}, or (for shared template code) @samp{.tcc}; and
1413 preprocessed C++ files use the suffix @samp{.ii}. GCC recognizes
1414 files with these names and compiles them as C++ programs even if you
1415 call the compiler the same way as for compiling C programs (usually
1416 with the name @command{gcc}).
1420 However, the use of @command{gcc} does not add the C++ library.
1421 @command{g++} is a program that calls GCC and treats @samp{.c},
1422 @samp{.h} and @samp{.i} files as C++ source files instead of C source
1423 files unless @option{-x} is used, and automatically specifies linking
1424 against the C++ library. This program is also useful when
1425 precompiling a C header file with a @samp{.h} extension for use in C++
1426 compilations. On many systems, @command{g++} is also installed with
1427 the name @command{c++}.
1429 @cindex invoking @command{g++}
1430 When you compile C++ programs, you may specify many of the same
1431 command-line options that you use for compiling programs in any
1432 language; or command-line options meaningful for C and related
1433 languages; or options that are meaningful only for C++ programs.
1434 @xref{C Dialect Options,,Options Controlling C Dialect}, for
1435 explanations of options for languages related to C@.
1436 @xref{C++ Dialect Options,,Options Controlling C++ Dialect}, for
1437 explanations of options that are meaningful only for C++ programs.
1439 @node C Dialect Options
1440 @section Options Controlling C Dialect
1441 @cindex dialect options
1442 @cindex language dialect options
1443 @cindex options, dialect
1445 The following options control the dialect of C (or languages derived
1446 from C, such as C++, Objective-C and Objective-C++) that the compiler
1450 @cindex ANSI support
1454 In C mode, this is equivalent to @samp{-std=c90}. In C++ mode, it is
1455 equivalent to @samp{-std=c++98}.
1457 This turns off certain features of GCC that are incompatible with ISO
1458 C90 (when compiling C code), or of standard C++ (when compiling C++ code),
1459 such as the @code{asm} and @code{typeof} keywords, and
1460 predefined macros such as @code{unix} and @code{vax} that identify the
1461 type of system you are using. It also enables the undesirable and
1462 rarely used ISO trigraph feature. For the C compiler,
1463 it disables recognition of C++ style @samp{//} comments as well as
1464 the @code{inline} keyword.
1466 The alternate keywords @code{__asm__}, @code{__extension__},
1467 @code{__inline__} and @code{__typeof__} continue to work despite
1468 @option{-ansi}. You would not want to use them in an ISO C program, of
1469 course, but it is useful to put them in header files that might be included
1470 in compilations done with @option{-ansi}. Alternate predefined macros
1471 such as @code{__unix__} and @code{__vax__} are also available, with or
1472 without @option{-ansi}.
1474 The @option{-ansi} option does not cause non-ISO programs to be
1475 rejected gratuitously. For that, @option{-pedantic} is required in
1476 addition to @option{-ansi}. @xref{Warning Options}.
1478 The macro @code{__STRICT_ANSI__} is predefined when the @option{-ansi}
1479 option is used. Some header files may notice this macro and refrain
1480 from declaring certain functions or defining certain macros that the
1481 ISO standard doesn't call for; this is to avoid interfering with any
1482 programs that might use these names for other things.
1484 Functions that would normally be built in but do not have semantics
1485 defined by ISO C (such as @code{alloca} and @code{ffs}) are not built-in
1486 functions when @option{-ansi} is used. @xref{Other Builtins,,Other
1487 built-in functions provided by GCC}, for details of the functions
1492 Determine the language standard. @xref{Standards,,Language Standards
1493 Supported by GCC}, for details of these standard versions. This option
1494 is currently only supported when compiling C or C++.
1496 The compiler can accept several base standards, such as @samp{c90} or
1497 @samp{c++98}, and GNU dialects of those standards, such as
1498 @samp{gnu90} or @samp{gnu++98}. By specifying a base standard, the
1499 compiler will accept all programs following that standard and those
1500 using GNU extensions that do not contradict it. For example,
1501 @samp{-std=c90} turns off certain features of GCC that are
1502 incompatible with ISO C90, such as the @code{asm} and @code{typeof}
1503 keywords, but not other GNU extensions that do not have a meaning in
1504 ISO C90, such as omitting the middle term of a @code{?:}
1505 expression. On the other hand, by specifying a GNU dialect of a
1506 standard, all features the compiler support are enabled, even when
1507 those features change the meaning of the base standard and some
1508 strict-conforming programs may be rejected. The particular standard
1509 is used by @option{-pedantic} to identify which features are GNU
1510 extensions given that version of the standard. For example
1511 @samp{-std=gnu90 -pedantic} would warn about C++ style @samp{//}
1512 comments, while @samp{-std=gnu99 -pedantic} would not.
1514 A value for this option must be provided; possible values are
1520 Support all ISO C90 programs (certain GNU extensions that conflict
1521 with ISO C90 are disabled). Same as @option{-ansi} for C code.
1523 @item iso9899:199409
1524 ISO C90 as modified in amendment 1.
1530 ISO C99. Note that this standard is not yet fully supported; see
1531 @w{@uref{http://gcc.gnu.org/c99status.html}} for more information. The
1532 names @samp{c9x} and @samp{iso9899:199x} are deprecated.
1535 ISO C1X, the draft of the next revision of the ISO C standard.
1536 Support is limited and experimental and features enabled by this
1537 option may be changed or removed if changed in or removed from the
1542 GNU dialect of ISO C90 (including some C99 features). This
1543 is the default for C code.
1547 GNU dialect of ISO C99. When ISO C99 is fully implemented in GCC,
1548 this will become the default. The name @samp{gnu9x} is deprecated.
1551 GNU dialect of ISO C1X. Support is limited and experimental and
1552 features enabled by this option may be changed or removed if changed
1553 in or removed from the standard draft.
1556 The 1998 ISO C++ standard plus amendments. Same as @option{-ansi} for
1560 GNU dialect of @option{-std=c++98}. This is the default for
1564 The working draft of the upcoming ISO C++0x standard. This option
1565 enables experimental features that are likely to be included in
1566 C++0x. The working draft is constantly changing, and any feature that is
1567 enabled by this flag may be removed from future versions of GCC if it is
1568 not part of the C++0x standard.
1571 GNU dialect of @option{-std=c++0x}. This option enables
1572 experimental features that may be removed in future versions of GCC.
1575 @item -fgnu89-inline
1576 @opindex fgnu89-inline
1577 The option @option{-fgnu89-inline} tells GCC to use the traditional
1578 GNU semantics for @code{inline} functions when in C99 mode.
1579 @xref{Inline,,An Inline Function is As Fast As a Macro}. This option
1580 is accepted and ignored by GCC versions 4.1.3 up to but not including
1581 4.3. In GCC versions 4.3 and later it changes the behavior of GCC in
1582 C99 mode. Using this option is roughly equivalent to adding the
1583 @code{gnu_inline} function attribute to all inline functions
1584 (@pxref{Function Attributes}).
1586 The option @option{-fno-gnu89-inline} explicitly tells GCC to use the
1587 C99 semantics for @code{inline} when in C99 or gnu99 mode (i.e., it
1588 specifies the default behavior). This option was first supported in
1589 GCC 4.3. This option is not supported in @option{-std=c90} or
1590 @option{-std=gnu90} mode.
1592 The preprocessor macros @code{__GNUC_GNU_INLINE__} and
1593 @code{__GNUC_STDC_INLINE__} may be used to check which semantics are
1594 in effect for @code{inline} functions. @xref{Common Predefined
1595 Macros,,,cpp,The C Preprocessor}.
1597 @item -aux-info @var{filename}
1599 Output to the given filename prototyped declarations for all functions
1600 declared and/or defined in a translation unit, including those in header
1601 files. This option is silently ignored in any language other than C@.
1603 Besides declarations, the file indicates, in comments, the origin of
1604 each declaration (source file and line), whether the declaration was
1605 implicit, prototyped or unprototyped (@samp{I}, @samp{N} for new or
1606 @samp{O} for old, respectively, in the first character after the line
1607 number and the colon), and whether it came from a declaration or a
1608 definition (@samp{C} or @samp{F}, respectively, in the following
1609 character). In the case of function definitions, a K&R-style list of
1610 arguments followed by their declarations is also provided, inside
1611 comments, after the declaration.
1615 Do not recognize @code{asm}, @code{inline} or @code{typeof} as a
1616 keyword, so that code can use these words as identifiers. You can use
1617 the keywords @code{__asm__}, @code{__inline__} and @code{__typeof__}
1618 instead. @option{-ansi} implies @option{-fno-asm}.
1620 In C++, this switch only affects the @code{typeof} keyword, since
1621 @code{asm} and @code{inline} are standard keywords. You may want to
1622 use the @option{-fno-gnu-keywords} flag instead, which has the same
1623 effect. In C99 mode (@option{-std=c99} or @option{-std=gnu99}), this
1624 switch only affects the @code{asm} and @code{typeof} keywords, since
1625 @code{inline} is a standard keyword in ISO C99.
1628 @itemx -fno-builtin-@var{function}
1629 @opindex fno-builtin
1630 @cindex built-in functions
1631 Don't recognize built-in functions that do not begin with
1632 @samp{__builtin_} as prefix. @xref{Other Builtins,,Other built-in
1633 functions provided by GCC}, for details of the functions affected,
1634 including those which are not built-in functions when @option{-ansi} or
1635 @option{-std} options for strict ISO C conformance are used because they
1636 do not have an ISO standard meaning.
1638 GCC normally generates special code to handle certain built-in functions
1639 more efficiently; for instance, calls to @code{alloca} may become single
1640 instructions that adjust the stack directly, and calls to @code{memcpy}
1641 may become inline copy loops. The resulting code is often both smaller
1642 and faster, but since the function calls no longer appear as such, you
1643 cannot set a breakpoint on those calls, nor can you change the behavior
1644 of the functions by linking with a different library. In addition,
1645 when a function is recognized as a built-in function, GCC may use
1646 information about that function to warn about problems with calls to
1647 that function, or to generate more efficient code, even if the
1648 resulting code still contains calls to that function. For example,
1649 warnings are given with @option{-Wformat} for bad calls to
1650 @code{printf}, when @code{printf} is built in, and @code{strlen} is
1651 known not to modify global memory.
1653 With the @option{-fno-builtin-@var{function}} option
1654 only the built-in function @var{function} is
1655 disabled. @var{function} must not begin with @samp{__builtin_}. If a
1656 function is named that is not built-in in this version of GCC, this
1657 option is ignored. There is no corresponding
1658 @option{-fbuiltin-@var{function}} option; if you wish to enable
1659 built-in functions selectively when using @option{-fno-builtin} or
1660 @option{-ffreestanding}, you may define macros such as:
1663 #define abs(n) __builtin_abs ((n))
1664 #define strcpy(d, s) __builtin_strcpy ((d), (s))
1669 @cindex hosted environment
1671 Assert that compilation takes place in a hosted environment. This implies
1672 @option{-fbuiltin}. A hosted environment is one in which the
1673 entire standard library is available, and in which @code{main} has a return
1674 type of @code{int}. Examples are nearly everything except a kernel.
1675 This is equivalent to @option{-fno-freestanding}.
1677 @item -ffreestanding
1678 @opindex ffreestanding
1679 @cindex hosted environment
1681 Assert that compilation takes place in a freestanding environment. This
1682 implies @option{-fno-builtin}. A freestanding environment
1683 is one in which the standard library may not exist, and program startup may
1684 not necessarily be at @code{main}. The most obvious example is an OS kernel.
1685 This is equivalent to @option{-fno-hosted}.
1687 @xref{Standards,,Language Standards Supported by GCC}, for details of
1688 freestanding and hosted environments.
1692 @cindex OpenMP parallel
1693 Enable handling of OpenMP directives @code{#pragma omp} in C/C++ and
1694 @code{!$omp} in Fortran. When @option{-fopenmp} is specified, the
1695 compiler generates parallel code according to the OpenMP Application
1696 Program Interface v3.0 @w{@uref{http://www.openmp.org/}}. This option
1697 implies @option{-pthread}, and thus is only supported on targets that
1698 have support for @option{-pthread}.
1700 @item -fms-extensions
1701 @opindex fms-extensions
1702 Accept some non-standard constructs used in Microsoft header files.
1704 In C++ code, this allows member names in structures to be similar
1705 to previous types declarations.
1714 Some cases of unnamed fields in structures and unions are only
1715 accepted with this option. @xref{Unnamed Fields,,Unnamed struct/union
1716 fields within structs/unions}, for details.
1718 @item -fplan9-extensions
1719 Accept some non-standard constructs used in Plan 9 code.
1721 This enables @option{-fms-extensions}, permits passing pointers to
1722 structures with anonymous fields to functions which expect pointers to
1723 elements of the type of the field, and permits referring to anonymous
1724 fields declared using a typedef. @xref{Unnamed Fields,,Unnamed
1725 struct/union fields within structs/unions}, for details. This is only
1726 supported for C, not C++.
1730 Support ISO C trigraphs. The @option{-ansi} option (and @option{-std}
1731 options for strict ISO C conformance) implies @option{-trigraphs}.
1733 @item -no-integrated-cpp
1734 @opindex no-integrated-cpp
1735 Performs a compilation in two passes: preprocessing and compiling. This
1736 option allows a user supplied "cc1", "cc1plus", or "cc1obj" via the
1737 @option{-B} option. The user supplied compilation step can then add in
1738 an additional preprocessing step after normal preprocessing but before
1739 compiling. The default is to use the integrated cpp (internal cpp)
1741 The semantics of this option will change if "cc1", "cc1plus", and
1742 "cc1obj" are merged.
1744 @cindex traditional C language
1745 @cindex C language, traditional
1747 @itemx -traditional-cpp
1748 @opindex traditional-cpp
1749 @opindex traditional
1750 Formerly, these options caused GCC to attempt to emulate a pre-standard
1751 C compiler. They are now only supported with the @option{-E} switch.
1752 The preprocessor continues to support a pre-standard mode. See the GNU
1753 CPP manual for details.
1755 @item -fcond-mismatch
1756 @opindex fcond-mismatch
1757 Allow conditional expressions with mismatched types in the second and
1758 third arguments. The value of such an expression is void. This option
1759 is not supported for C++.
1761 @item -flax-vector-conversions
1762 @opindex flax-vector-conversions
1763 Allow implicit conversions between vectors with differing numbers of
1764 elements and/or incompatible element types. This option should not be
1767 @item -funsigned-char
1768 @opindex funsigned-char
1769 Let the type @code{char} be unsigned, like @code{unsigned char}.
1771 Each kind of machine has a default for what @code{char} should
1772 be. It is either like @code{unsigned char} by default or like
1773 @code{signed char} by default.
1775 Ideally, a portable program should always use @code{signed char} or
1776 @code{unsigned char} when it depends on the signedness of an object.
1777 But many programs have been written to use plain @code{char} and
1778 expect it to be signed, or expect it to be unsigned, depending on the
1779 machines they were written for. This option, and its inverse, let you
1780 make such a program work with the opposite default.
1782 The type @code{char} is always a distinct type from each of
1783 @code{signed char} or @code{unsigned char}, even though its behavior
1784 is always just like one of those two.
1787 @opindex fsigned-char
1788 Let the type @code{char} be signed, like @code{signed char}.
1790 Note that this is equivalent to @option{-fno-unsigned-char}, which is
1791 the negative form of @option{-funsigned-char}. Likewise, the option
1792 @option{-fno-signed-char} is equivalent to @option{-funsigned-char}.
1794 @item -fsigned-bitfields
1795 @itemx -funsigned-bitfields
1796 @itemx -fno-signed-bitfields
1797 @itemx -fno-unsigned-bitfields
1798 @opindex fsigned-bitfields
1799 @opindex funsigned-bitfields
1800 @opindex fno-signed-bitfields
1801 @opindex fno-unsigned-bitfields
1802 These options control whether a bit-field is signed or unsigned, when the
1803 declaration does not use either @code{signed} or @code{unsigned}. By
1804 default, such a bit-field is signed, because this is consistent: the
1805 basic integer types such as @code{int} are signed types.
1808 @node C++ Dialect Options
1809 @section Options Controlling C++ Dialect
1811 @cindex compiler options, C++
1812 @cindex C++ options, command line
1813 @cindex options, C++
1814 This section describes the command-line options that are only meaningful
1815 for C++ programs; but you can also use most of the GNU compiler options
1816 regardless of what language your program is in. For example, you
1817 might compile a file @code{firstClass.C} like this:
1820 g++ -g -frepo -O -c firstClass.C
1824 In this example, only @option{-frepo} is an option meant
1825 only for C++ programs; you can use the other options with any
1826 language supported by GCC@.
1828 Here is a list of options that are @emph{only} for compiling C++ programs:
1832 @item -fabi-version=@var{n}
1833 @opindex fabi-version
1834 Use version @var{n} of the C++ ABI@. Version 2 is the version of the
1835 C++ ABI that first appeared in G++ 3.4. Version 1 is the version of
1836 the C++ ABI that first appeared in G++ 3.2. Version 0 will always be
1837 the version that conforms most closely to the C++ ABI specification.
1838 Therefore, the ABI obtained using version 0 will change as ABI bugs
1841 The default is version 2.
1843 Version 3 corrects an error in mangling a constant address as a
1846 Version 4 implements a standard mangling for vector types.
1848 Version 5 corrects the mangling of attribute const/volatile on
1849 function pointer types, decltype of a plain decl, and use of a
1850 function parameter in the declaration of another parameter.
1852 See also @option{-Wabi}.
1854 @item -fno-access-control
1855 @opindex fno-access-control
1856 Turn off all access checking. This switch is mainly useful for working
1857 around bugs in the access control code.
1861 Check that the pointer returned by @code{operator new} is non-null
1862 before attempting to modify the storage allocated. This check is
1863 normally unnecessary because the C++ standard specifies that
1864 @code{operator new} will only return @code{0} if it is declared
1865 @samp{throw()}, in which case the compiler will always check the
1866 return value even without this option. In all other cases, when
1867 @code{operator new} has a non-empty exception specification, memory
1868 exhaustion is signalled by throwing @code{std::bad_alloc}. See also
1869 @samp{new (nothrow)}.
1871 @item -fconserve-space
1872 @opindex fconserve-space
1873 Put uninitialized or runtime-initialized global variables into the
1874 common segment, as C does. This saves space in the executable at the
1875 cost of not diagnosing duplicate definitions. If you compile with this
1876 flag and your program mysteriously crashes after @code{main()} has
1877 completed, you may have an object that is being destroyed twice because
1878 two definitions were merged.
1880 This option is no longer useful on most targets, now that support has
1881 been added for putting variables into BSS without making them common.
1883 @item -fconstexpr-depth=@var{n}
1884 @opindex fconstexpr-depth
1885 Set the maximum nested evaluation depth for C++0x constexpr functions
1886 to @var{n}. A limit is needed to detect endless recursion during
1887 constant expression evaluation. The minimum specified by the standard
1890 @item -fno-deduce-init-list
1891 @opindex fno-deduce-init-list
1892 Disable deduction of a template type parameter as
1893 std::initializer_list from a brace-enclosed initializer list, i.e.
1896 template <class T> auto forward(T t) -> decltype (realfn (t))
1903 forward(@{1,2@}); // call forward<std::initializer_list<int>>
1907 This option is present because this deduction is an extension to the
1908 current specification in the C++0x working draft, and there was
1909 some concern about potential overload resolution problems.
1911 @item -ffriend-injection
1912 @opindex ffriend-injection
1913 Inject friend functions into the enclosing namespace, so that they are
1914 visible outside the scope of the class in which they are declared.
1915 Friend functions were documented to work this way in the old Annotated
1916 C++ Reference Manual, and versions of G++ before 4.1 always worked
1917 that way. However, in ISO C++ a friend function which is not declared
1918 in an enclosing scope can only be found using argument dependent
1919 lookup. This option causes friends to be injected as they were in
1922 This option is for compatibility, and may be removed in a future
1925 @item -fno-elide-constructors
1926 @opindex fno-elide-constructors
1927 The C++ standard allows an implementation to omit creating a temporary
1928 which is only used to initialize another object of the same type.
1929 Specifying this option disables that optimization, and forces G++ to
1930 call the copy constructor in all cases.
1932 @item -fno-enforce-eh-specs
1933 @opindex fno-enforce-eh-specs
1934 Don't generate code to check for violation of exception specifications
1935 at runtime. This option violates the C++ standard, but may be useful
1936 for reducing code size in production builds, much like defining
1937 @samp{NDEBUG}. This does not give user code permission to throw
1938 exceptions in violation of the exception specifications; the compiler
1939 will still optimize based on the specifications, so throwing an
1940 unexpected exception will result in undefined behavior.
1943 @itemx -fno-for-scope
1945 @opindex fno-for-scope
1946 If @option{-ffor-scope} is specified, the scope of variables declared in
1947 a @i{for-init-statement} is limited to the @samp{for} loop itself,
1948 as specified by the C++ standard.
1949 If @option{-fno-for-scope} is specified, the scope of variables declared in
1950 a @i{for-init-statement} extends to the end of the enclosing scope,
1951 as was the case in old versions of G++, and other (traditional)
1952 implementations of C++.
1954 The default if neither flag is given to follow the standard,
1955 but to allow and give a warning for old-style code that would
1956 otherwise be invalid, or have different behavior.
1958 @item -fno-gnu-keywords
1959 @opindex fno-gnu-keywords
1960 Do not recognize @code{typeof} as a keyword, so that code can use this
1961 word as an identifier. You can use the keyword @code{__typeof__} instead.
1962 @option{-ansi} implies @option{-fno-gnu-keywords}.
1964 @item -fno-implicit-templates
1965 @opindex fno-implicit-templates
1966 Never emit code for non-inline templates which are instantiated
1967 implicitly (i.e.@: by use); only emit code for explicit instantiations.
1968 @xref{Template Instantiation}, for more information.
1970 @item -fno-implicit-inline-templates
1971 @opindex fno-implicit-inline-templates
1972 Don't emit code for implicit instantiations of inline templates, either.
1973 The default is to handle inlines differently so that compiles with and
1974 without optimization will need the same set of explicit instantiations.
1976 @item -fno-implement-inlines
1977 @opindex fno-implement-inlines
1978 To save space, do not emit out-of-line copies of inline functions
1979 controlled by @samp{#pragma implementation}. This will cause linker
1980 errors if these functions are not inlined everywhere they are called.
1982 @item -fms-extensions
1983 @opindex fms-extensions
1984 Disable pedantic warnings about constructs used in MFC, such as implicit
1985 int and getting a pointer to member function via non-standard syntax.
1987 @item -fno-nonansi-builtins
1988 @opindex fno-nonansi-builtins
1989 Disable built-in declarations of functions that are not mandated by
1990 ANSI/ISO C@. These include @code{ffs}, @code{alloca}, @code{_exit},
1991 @code{index}, @code{bzero}, @code{conjf}, and other related functions.
1994 @opindex fnothrow-opt
1995 Treat a @code{throw()} exception specification as though it were a
1996 @code{noexcept} specification to reduce or eliminate the text size
1997 overhead relative to a function with no exception specification. If
1998 the function has local variables of types with non-trivial
1999 destructors, the exception specification will actually make the
2000 function smaller because the EH cleanups for those variables can be
2001 optimized away. The semantic effect is that an exception thrown out of
2002 a function with such an exception specification will result in a call
2003 to @code{terminate} rather than @code{unexpected}.
2005 @item -fno-operator-names
2006 @opindex fno-operator-names
2007 Do not treat the operator name keywords @code{and}, @code{bitand},
2008 @code{bitor}, @code{compl}, @code{not}, @code{or} and @code{xor} as
2009 synonyms as keywords.
2011 @item -fno-optional-diags
2012 @opindex fno-optional-diags
2013 Disable diagnostics that the standard says a compiler does not need to
2014 issue. Currently, the only such diagnostic issued by G++ is the one for
2015 a name having multiple meanings within a class.
2018 @opindex fpermissive
2019 Downgrade some diagnostics about nonconformant code from errors to
2020 warnings. Thus, using @option{-fpermissive} will allow some
2021 nonconforming code to compile.
2023 @item -fno-pretty-templates
2024 @opindex fno-pretty-templates
2025 When an error message refers to a specialization of a function
2026 template, the compiler will normally print the signature of the
2027 template followed by the template arguments and any typedefs or
2028 typenames in the signature (e.g. @code{void f(T) [with T = int]}
2029 rather than @code{void f(int)}) so that it's clear which template is
2030 involved. When an error message refers to a specialization of a class
2031 template, the compiler will omit any template arguments which match
2032 the default template arguments for that template. If either of these
2033 behaviors make it harder to understand the error message rather than
2034 easier, using @option{-fno-pretty-templates} will disable them.
2038 Enable automatic template instantiation at link time. This option also
2039 implies @option{-fno-implicit-templates}. @xref{Template
2040 Instantiation}, for more information.
2044 Disable generation of information about every class with virtual
2045 functions for use by the C++ runtime type identification features
2046 (@samp{dynamic_cast} and @samp{typeid}). If you don't use those parts
2047 of the language, you can save some space by using this flag. Note that
2048 exception handling uses the same information, but it will generate it as
2049 needed. The @samp{dynamic_cast} operator can still be used for casts that
2050 do not require runtime type information, i.e.@: casts to @code{void *} or to
2051 unambiguous base classes.
2055 Emit statistics about front-end processing at the end of the compilation.
2056 This information is generally only useful to the G++ development team.
2058 @item -fstrict-enums
2059 @opindex fstrict-enums
2060 Allow the compiler to optimize using the assumption that a value of
2061 enumeration type can only be one of the values of the enumeration (as
2062 defined in the C++ standard; basically, a value which can be
2063 represented in the minimum number of bits needed to represent all the
2064 enumerators). This assumption may not be valid if the program uses a
2065 cast to convert an arbitrary integer value to the enumeration type.
2067 @item -ftemplate-depth=@var{n}
2068 @opindex ftemplate-depth
2069 Set the maximum instantiation depth for template classes to @var{n}.
2070 A limit on the template instantiation depth is needed to detect
2071 endless recursions during template class instantiation. ANSI/ISO C++
2072 conforming programs must not rely on a maximum depth greater than 17
2073 (changed to 1024 in C++0x).
2075 @item -fno-threadsafe-statics
2076 @opindex fno-threadsafe-statics
2077 Do not emit the extra code to use the routines specified in the C++
2078 ABI for thread-safe initialization of local statics. You can use this
2079 option to reduce code size slightly in code that doesn't need to be
2082 @item -fuse-cxa-atexit
2083 @opindex fuse-cxa-atexit
2084 Register destructors for objects with static storage duration with the
2085 @code{__cxa_atexit} function rather than the @code{atexit} function.
2086 This option is required for fully standards-compliant handling of static
2087 destructors, but will only work if your C library supports
2088 @code{__cxa_atexit}.
2090 @item -fno-use-cxa-get-exception-ptr
2091 @opindex fno-use-cxa-get-exception-ptr
2092 Don't use the @code{__cxa_get_exception_ptr} runtime routine. This
2093 will cause @code{std::uncaught_exception} to be incorrect, but is necessary
2094 if the runtime routine is not available.
2096 @item -fvisibility-inlines-hidden
2097 @opindex fvisibility-inlines-hidden
2098 This switch declares that the user does not attempt to compare
2099 pointers to inline methods where the addresses of the two functions
2100 were taken in different shared objects.
2102 The effect of this is that GCC may, effectively, mark inline methods with
2103 @code{__attribute__ ((visibility ("hidden")))} so that they do not
2104 appear in the export table of a DSO and do not require a PLT indirection
2105 when used within the DSO@. Enabling this option can have a dramatic effect
2106 on load and link times of a DSO as it massively reduces the size of the
2107 dynamic export table when the library makes heavy use of templates.
2109 The behavior of this switch is not quite the same as marking the
2110 methods as hidden directly, because it does not affect static variables
2111 local to the function or cause the compiler to deduce that
2112 the function is defined in only one shared object.
2114 You may mark a method as having a visibility explicitly to negate the
2115 effect of the switch for that method. For example, if you do want to
2116 compare pointers to a particular inline method, you might mark it as
2117 having default visibility. Marking the enclosing class with explicit
2118 visibility will have no effect.
2120 Explicitly instantiated inline methods are unaffected by this option
2121 as their linkage might otherwise cross a shared library boundary.
2122 @xref{Template Instantiation}.
2124 @item -fvisibility-ms-compat
2125 @opindex fvisibility-ms-compat
2126 This flag attempts to use visibility settings to make GCC's C++
2127 linkage model compatible with that of Microsoft Visual Studio.
2129 The flag makes these changes to GCC's linkage model:
2133 It sets the default visibility to @code{hidden}, like
2134 @option{-fvisibility=hidden}.
2137 Types, but not their members, are not hidden by default.
2140 The One Definition Rule is relaxed for types without explicit
2141 visibility specifications which are defined in more than one different
2142 shared object: those declarations are permitted if they would have
2143 been permitted when this option was not used.
2146 In new code it is better to use @option{-fvisibility=hidden} and
2147 export those classes which are intended to be externally visible.
2148 Unfortunately it is possible for code to rely, perhaps accidentally,
2149 on the Visual Studio behavior.
2151 Among the consequences of these changes are that static data members
2152 of the same type with the same name but defined in different shared
2153 objects will be different, so changing one will not change the other;
2154 and that pointers to function members defined in different shared
2155 objects may not compare equal. When this flag is given, it is a
2156 violation of the ODR to define types with the same name differently.
2160 Do not use weak symbol support, even if it is provided by the linker.
2161 By default, G++ will use weak symbols if they are available. This
2162 option exists only for testing, and should not be used by end-users;
2163 it will result in inferior code and has no benefits. This option may
2164 be removed in a future release of G++.
2168 Do not search for header files in the standard directories specific to
2169 C++, but do still search the other standard directories. (This option
2170 is used when building the C++ library.)
2173 In addition, these optimization, warning, and code generation options
2174 have meanings only for C++ programs:
2177 @item -fno-default-inline
2178 @opindex fno-default-inline
2179 Do not assume @samp{inline} for functions defined inside a class scope.
2180 @xref{Optimize Options,,Options That Control Optimization}. Note that these
2181 functions will have linkage like inline functions; they just won't be
2184 @item -Wabi @r{(C, Objective-C, C++ and Objective-C++ only)}
2187 Warn when G++ generates code that is probably not compatible with the
2188 vendor-neutral C++ ABI@. Although an effort has been made to warn about
2189 all such cases, there are probably some cases that are not warned about,
2190 even though G++ is generating incompatible code. There may also be
2191 cases where warnings are emitted even though the code that is generated
2194 You should rewrite your code to avoid these warnings if you are
2195 concerned about the fact that code generated by G++ may not be binary
2196 compatible with code generated by other compilers.
2198 The known incompatibilities in @option{-fabi-version=2} (the default) include:
2203 A template with a non-type template parameter of reference type is
2204 mangled incorrectly:
2207 template <int &> struct S @{@};
2211 This is fixed in @option{-fabi-version=3}.
2214 SIMD vector types declared using @code{__attribute ((vector_size))} are
2215 mangled in a non-standard way that does not allow for overloading of
2216 functions taking vectors of different sizes.
2218 The mangling is changed in @option{-fabi-version=4}.
2221 The known incompatibilities in @option{-fabi-version=1} include:
2226 Incorrect handling of tail-padding for bit-fields. G++ may attempt to
2227 pack data into the same byte as a base class. For example:
2230 struct A @{ virtual void f(); int f1 : 1; @};
2231 struct B : public A @{ int f2 : 1; @};
2235 In this case, G++ will place @code{B::f2} into the same byte
2236 as@code{A::f1}; other compilers will not. You can avoid this problem
2237 by explicitly padding @code{A} so that its size is a multiple of the
2238 byte size on your platform; that will cause G++ and other compilers to
2239 layout @code{B} identically.
2242 Incorrect handling of tail-padding for virtual bases. G++ does not use
2243 tail padding when laying out virtual bases. For example:
2246 struct A @{ virtual void f(); char c1; @};
2247 struct B @{ B(); char c2; @};
2248 struct C : public A, public virtual B @{@};
2252 In this case, G++ will not place @code{B} into the tail-padding for
2253 @code{A}; other compilers will. You can avoid this problem by
2254 explicitly padding @code{A} so that its size is a multiple of its
2255 alignment (ignoring virtual base classes); that will cause G++ and other
2256 compilers to layout @code{C} identically.
2259 Incorrect handling of bit-fields with declared widths greater than that
2260 of their underlying types, when the bit-fields appear in a union. For
2264 union U @{ int i : 4096; @};
2268 Assuming that an @code{int} does not have 4096 bits, G++ will make the
2269 union too small by the number of bits in an @code{int}.
2272 Empty classes can be placed at incorrect offsets. For example:
2282 struct C : public B, public A @{@};
2286 G++ will place the @code{A} base class of @code{C} at a nonzero offset;
2287 it should be placed at offset zero. G++ mistakenly believes that the
2288 @code{A} data member of @code{B} is already at offset zero.
2291 Names of template functions whose types involve @code{typename} or
2292 template template parameters can be mangled incorrectly.
2295 template <typename Q>
2296 void f(typename Q::X) @{@}
2298 template <template <typename> class Q>
2299 void f(typename Q<int>::X) @{@}
2303 Instantiations of these templates may be mangled incorrectly.
2307 It also warns psABI related changes. The known psABI changes at this
2313 For SYSV/x86-64, when passing union with long double, it is changed to
2314 pass in memory as specified in psABI. For example:
2324 @code{union U} will always be passed in memory.
2328 @item -Wctor-dtor-privacy @r{(C++ and Objective-C++ only)}
2329 @opindex Wctor-dtor-privacy
2330 @opindex Wno-ctor-dtor-privacy
2331 Warn when a class seems unusable because all the constructors or
2332 destructors in that class are private, and it has neither friends nor
2333 public static member functions.
2335 @item -Wnoexcept @r{(C++ and Objective-C++ only)}
2337 @opindex Wno-noexcept
2338 Warn when a noexcept-expression evaluates to false because of a call
2339 to a function that does not have a non-throwing exception
2340 specification (i.e. @samp{throw()} or @samp{noexcept}) but is known by
2341 the compiler to never throw an exception.
2343 @item -Wnon-virtual-dtor @r{(C++ and Objective-C++ only)}
2344 @opindex Wnon-virtual-dtor
2345 @opindex Wno-non-virtual-dtor
2346 Warn when a class has virtual functions and accessible non-virtual
2347 destructor, in which case it would be possible but unsafe to delete
2348 an instance of a derived class through a pointer to the base class.
2349 This warning is also enabled if -Weffc++ is specified.
2351 @item -Wreorder @r{(C++ and Objective-C++ only)}
2353 @opindex Wno-reorder
2354 @cindex reordering, warning
2355 @cindex warning for reordering of member initializers
2356 Warn when the order of member initializers given in the code does not
2357 match the order in which they must be executed. For instance:
2363 A(): j (0), i (1) @{ @}
2367 The compiler will rearrange the member initializers for @samp{i}
2368 and @samp{j} to match the declaration order of the members, emitting
2369 a warning to that effect. This warning is enabled by @option{-Wall}.
2372 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
2375 @item -Weffc++ @r{(C++ and Objective-C++ only)}
2378 Warn about violations of the following style guidelines from Scott Meyers'
2379 @cite{Effective C++} book:
2383 Item 11: Define a copy constructor and an assignment operator for classes
2384 with dynamically allocated memory.
2387 Item 12: Prefer initialization to assignment in constructors.
2390 Item 14: Make destructors virtual in base classes.
2393 Item 15: Have @code{operator=} return a reference to @code{*this}.
2396 Item 23: Don't try to return a reference when you must return an object.
2400 Also warn about violations of the following style guidelines from
2401 Scott Meyers' @cite{More Effective C++} book:
2405 Item 6: Distinguish between prefix and postfix forms of increment and
2406 decrement operators.
2409 Item 7: Never overload @code{&&}, @code{||}, or @code{,}.
2413 When selecting this option, be aware that the standard library
2414 headers do not obey all of these guidelines; use @samp{grep -v}
2415 to filter out those warnings.
2417 @item -Wstrict-null-sentinel @r{(C++ and Objective-C++ only)}
2418 @opindex Wstrict-null-sentinel
2419 @opindex Wno-strict-null-sentinel
2420 Warn also about the use of an uncasted @code{NULL} as sentinel. When
2421 compiling only with GCC this is a valid sentinel, as @code{NULL} is defined
2422 to @code{__null}. Although it is a null pointer constant not a null pointer,
2423 it is guaranteed to be of the same size as a pointer. But this use is
2424 not portable across different compilers.
2426 @item -Wno-non-template-friend @r{(C++ and Objective-C++ only)}
2427 @opindex Wno-non-template-friend
2428 @opindex Wnon-template-friend
2429 Disable warnings when non-templatized friend functions are declared
2430 within a template. Since the advent of explicit template specification
2431 support in G++, if the name of the friend is an unqualified-id (i.e.,
2432 @samp{friend foo(int)}), the C++ language specification demands that the
2433 friend declare or define an ordinary, nontemplate function. (Section
2434 14.5.3). Before G++ implemented explicit specification, unqualified-ids
2435 could be interpreted as a particular specialization of a templatized
2436 function. Because this non-conforming behavior is no longer the default
2437 behavior for G++, @option{-Wnon-template-friend} allows the compiler to
2438 check existing code for potential trouble spots and is on by default.
2439 This new compiler behavior can be turned off with
2440 @option{-Wno-non-template-friend} which keeps the conformant compiler code
2441 but disables the helpful warning.
2443 @item -Wold-style-cast @r{(C++ and Objective-C++ only)}
2444 @opindex Wold-style-cast
2445 @opindex Wno-old-style-cast
2446 Warn if an old-style (C-style) cast to a non-void type is used within
2447 a C++ program. The new-style casts (@samp{dynamic_cast},
2448 @samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are
2449 less vulnerable to unintended effects and much easier to search for.
2451 @item -Woverloaded-virtual @r{(C++ and Objective-C++ only)}
2452 @opindex Woverloaded-virtual
2453 @opindex Wno-overloaded-virtual
2454 @cindex overloaded virtual function, warning
2455 @cindex warning for overloaded virtual function
2456 Warn when a function declaration hides virtual functions from a
2457 base class. For example, in:
2464 struct B: public A @{
2469 the @code{A} class version of @code{f} is hidden in @code{B}, and code
2477 will fail to compile.
2479 @item -Wno-pmf-conversions @r{(C++ and Objective-C++ only)}
2480 @opindex Wno-pmf-conversions
2481 @opindex Wpmf-conversions
2482 Disable the diagnostic for converting a bound pointer to member function
2485 @item -Wsign-promo @r{(C++ and Objective-C++ only)}
2486 @opindex Wsign-promo
2487 @opindex Wno-sign-promo
2488 Warn when overload resolution chooses a promotion from unsigned or
2489 enumerated type to a signed type, over a conversion to an unsigned type of
2490 the same size. Previous versions of G++ would try to preserve
2491 unsignedness, but the standard mandates the current behavior.
2496 A& operator = (int);
2506 In this example, G++ will synthesize a default @samp{A& operator =
2507 (const A&);}, while cfront will use the user-defined @samp{operator =}.
2510 @node Objective-C and Objective-C++ Dialect Options
2511 @section Options Controlling Objective-C and Objective-C++ Dialects
2513 @cindex compiler options, Objective-C and Objective-C++
2514 @cindex Objective-C and Objective-C++ options, command line
2515 @cindex options, Objective-C and Objective-C++
2516 (NOTE: This manual does not describe the Objective-C and Objective-C++
2517 languages themselves. @xref{Standards,,Language Standards
2518 Supported by GCC}, for references.)
2520 This section describes the command-line options that are only meaningful
2521 for Objective-C and Objective-C++ programs, but you can also use most of
2522 the language-independent GNU compiler options.
2523 For example, you might compile a file @code{some_class.m} like this:
2526 gcc -g -fgnu-runtime -O -c some_class.m
2530 In this example, @option{-fgnu-runtime} is an option meant only for
2531 Objective-C and Objective-C++ programs; you can use the other options with
2532 any language supported by GCC@.
2534 Note that since Objective-C is an extension of the C language, Objective-C
2535 compilations may also use options specific to the C front-end (e.g.,
2536 @option{-Wtraditional}). Similarly, Objective-C++ compilations may use
2537 C++-specific options (e.g., @option{-Wabi}).
2539 Here is a list of options that are @emph{only} for compiling Objective-C
2540 and Objective-C++ programs:
2543 @item -fconstant-string-class=@var{class-name}
2544 @opindex fconstant-string-class
2545 Use @var{class-name} as the name of the class to instantiate for each
2546 literal string specified with the syntax @code{@@"@dots{}"}. The default
2547 class name is @code{NXConstantString} if the GNU runtime is being used, and
2548 @code{NSConstantString} if the NeXT runtime is being used (see below). The
2549 @option{-fconstant-cfstrings} option, if also present, will override the
2550 @option{-fconstant-string-class} setting and cause @code{@@"@dots{}"} literals
2551 to be laid out as constant CoreFoundation strings.
2554 @opindex fgnu-runtime
2555 Generate object code compatible with the standard GNU Objective-C
2556 runtime. This is the default for most types of systems.
2558 @item -fnext-runtime
2559 @opindex fnext-runtime
2560 Generate output compatible with the NeXT runtime. This is the default
2561 for NeXT-based systems, including Darwin and Mac OS X@. The macro
2562 @code{__NEXT_RUNTIME__} is predefined if (and only if) this option is
2565 @item -fno-nil-receivers
2566 @opindex fno-nil-receivers
2567 Assume that all Objective-C message dispatches (@code{[receiver
2568 message:arg]}) in this translation unit ensure that the receiver is
2569 not @code{nil}. This allows for more efficient entry points in the
2570 runtime to be used. This option is only available in conjunction with
2571 the NeXT runtime and ABI version 0 or 1.
2573 @item -fobjc-abi-version=@var{n}
2574 @opindex fobjc-abi-version
2575 Use version @var{n} of the Objective-C ABI for the selected runtime.
2576 This option is currently supported only for the NeXT runtime. In that
2577 case, Version 0 is the traditional (32-bit) ABI without support for
2578 properties and other Objective-C 2.0 additions. Version 1 is the
2579 traditional (32-bit) ABI with support for properties and other
2580 Objective-C 2.0 additions. Version 2 is the modern (64-bit) ABI. If
2581 nothing is specified, the default is Version 0 on 32-bit target
2582 machines, and Version 2 on 64-bit target machines.
2584 @item -fobjc-call-cxx-cdtors
2585 @opindex fobjc-call-cxx-cdtors
2586 For each Objective-C class, check if any of its instance variables is a
2587 C++ object with a non-trivial default constructor. If so, synthesize a
2588 special @code{- (id) .cxx_construct} instance method that will run
2589 non-trivial default constructors on any such instance variables, in order,
2590 and then return @code{self}. Similarly, check if any instance variable
2591 is a C++ object with a non-trivial destructor, and if so, synthesize a
2592 special @code{- (void) .cxx_destruct} method that will run
2593 all such default destructors, in reverse order.
2595 The @code{- (id) .cxx_construct} and @code{- (void) .cxx_destruct}
2596 methods thusly generated will only operate on instance variables
2597 declared in the current Objective-C class, and not those inherited
2598 from superclasses. It is the responsibility of the Objective-C
2599 runtime to invoke all such methods in an object's inheritance
2600 hierarchy. The @code{- (id) .cxx_construct} methods will be invoked
2601 by the runtime immediately after a new object instance is allocated;
2602 the @code{- (void) .cxx_destruct} methods will be invoked immediately
2603 before the runtime deallocates an object instance.
2605 As of this writing, only the NeXT runtime on Mac OS X 10.4 and later has
2606 support for invoking the @code{- (id) .cxx_construct} and
2607 @code{- (void) .cxx_destruct} methods.
2609 @item -fobjc-direct-dispatch
2610 @opindex fobjc-direct-dispatch
2611 Allow fast jumps to the message dispatcher. On Darwin this is
2612 accomplished via the comm page.
2614 @item -fobjc-exceptions
2615 @opindex fobjc-exceptions
2616 Enable syntactic support for structured exception handling in
2617 Objective-C, similar to what is offered by C++ and Java. This option
2618 is required to use the Objective-C keywords @code{@@try},
2619 @code{@@throw}, @code{@@catch}, @code{@@finally} and
2620 @code{@@synchronized}. This option is available with both the GNU
2621 runtime and the NeXT runtime (but not available in conjunction with
2622 the NeXT runtime on Mac OS X 10.2 and earlier).
2626 Enable garbage collection (GC) in Objective-C and Objective-C++
2627 programs. This option is only available with the NeXT runtime; the
2628 GNU runtime has a different garbage collection implementation that
2629 does not require special compiler flags.
2631 @item -fobjc-nilcheck
2632 @opindex fobjc-nilcheck
2633 For the NeXT runtime with version 2 of the ABI, check for a nil
2634 receiver in method invocations before doing the actual method call.
2635 This is the default and can be disabled using
2636 @option{-fno-objc-nilcheck}. Class methods and super calls are never
2637 checked for nil in this way no matter what this flag is set to.
2638 Currently this flag does nothing when the GNU runtime, or an older
2639 version of the NeXT runtime ABI, is used.
2641 @item -fobjc-std=objc1
2643 Conform to the language syntax of Objective-C 1.0, the language
2644 recognized by GCC 4.0. This only affects the Objective-C additions to
2645 the C/C++ language; it does not affect conformance to C/C++ standards,
2646 which is controlled by the separate C/C++ dialect option flags. When
2647 this option is used with the Objective-C or Objective-C++ compiler,
2648 any Objective-C syntax that is not recognized by GCC 4.0 is rejected.
2649 This is useful if you need to make sure that your Objective-C code can
2650 be compiled with older versions of GCC.
2652 @item -freplace-objc-classes
2653 @opindex freplace-objc-classes
2654 Emit a special marker instructing @command{ld(1)} not to statically link in
2655 the resulting object file, and allow @command{dyld(1)} to load it in at
2656 run time instead. This is used in conjunction with the Fix-and-Continue
2657 debugging mode, where the object file in question may be recompiled and
2658 dynamically reloaded in the course of program execution, without the need
2659 to restart the program itself. Currently, Fix-and-Continue functionality
2660 is only available in conjunction with the NeXT runtime on Mac OS X 10.3
2665 When compiling for the NeXT runtime, the compiler ordinarily replaces calls
2666 to @code{objc_getClass("@dots{}")} (when the name of the class is known at
2667 compile time) with static class references that get initialized at load time,
2668 which improves run-time performance. Specifying the @option{-fzero-link} flag
2669 suppresses this behavior and causes calls to @code{objc_getClass("@dots{}")}
2670 to be retained. This is useful in Zero-Link debugging mode, since it allows
2671 for individual class implementations to be modified during program execution.
2672 The GNU runtime currently always retains calls to @code{objc_get_class("@dots{}")}
2673 regardless of command line options.
2677 Dump interface declarations for all classes seen in the source file to a
2678 file named @file{@var{sourcename}.decl}.
2680 @item -Wassign-intercept @r{(Objective-C and Objective-C++ only)}
2681 @opindex Wassign-intercept
2682 @opindex Wno-assign-intercept
2683 Warn whenever an Objective-C assignment is being intercepted by the
2686 @item -Wno-protocol @r{(Objective-C and Objective-C++ only)}
2687 @opindex Wno-protocol
2689 If a class is declared to implement a protocol, a warning is issued for
2690 every method in the protocol that is not implemented by the class. The
2691 default behavior is to issue a warning for every method not explicitly
2692 implemented in the class, even if a method implementation is inherited
2693 from the superclass. If you use the @option{-Wno-protocol} option, then
2694 methods inherited from the superclass are considered to be implemented,
2695 and no warning is issued for them.
2697 @item -Wselector @r{(Objective-C and Objective-C++ only)}
2699 @opindex Wno-selector
2700 Warn if multiple methods of different types for the same selector are
2701 found during compilation. The check is performed on the list of methods
2702 in the final stage of compilation. Additionally, a check is performed
2703 for each selector appearing in a @code{@@selector(@dots{})}
2704 expression, and a corresponding method for that selector has been found
2705 during compilation. Because these checks scan the method table only at
2706 the end of compilation, these warnings are not produced if the final
2707 stage of compilation is not reached, for example because an error is
2708 found during compilation, or because the @option{-fsyntax-only} option is
2711 @item -Wstrict-selector-match @r{(Objective-C and Objective-C++ only)}
2712 @opindex Wstrict-selector-match
2713 @opindex Wno-strict-selector-match
2714 Warn if multiple methods with differing argument and/or return types are
2715 found for a given selector when attempting to send a message using this
2716 selector to a receiver of type @code{id} or @code{Class}. When this flag
2717 is off (which is the default behavior), the compiler will omit such warnings
2718 if any differences found are confined to types which share the same size
2721 @item -Wundeclared-selector @r{(Objective-C and Objective-C++ only)}
2722 @opindex Wundeclared-selector
2723 @opindex Wno-undeclared-selector
2724 Warn if a @code{@@selector(@dots{})} expression referring to an
2725 undeclared selector is found. A selector is considered undeclared if no
2726 method with that name has been declared before the
2727 @code{@@selector(@dots{})} expression, either explicitly in an
2728 @code{@@interface} or @code{@@protocol} declaration, or implicitly in
2729 an @code{@@implementation} section. This option always performs its
2730 checks as soon as a @code{@@selector(@dots{})} expression is found,
2731 while @option{-Wselector} only performs its checks in the final stage of
2732 compilation. This also enforces the coding style convention
2733 that methods and selectors must be declared before being used.
2735 @item -print-objc-runtime-info
2736 @opindex print-objc-runtime-info
2737 Generate C header describing the largest structure that is passed by
2742 @node Language Independent Options
2743 @section Options to Control Diagnostic Messages Formatting
2744 @cindex options to control diagnostics formatting
2745 @cindex diagnostic messages
2746 @cindex message formatting
2748 Traditionally, diagnostic messages have been formatted irrespective of
2749 the output device's aspect (e.g.@: its width, @dots{}). The options described
2750 below can be used to control the diagnostic messages formatting
2751 algorithm, e.g.@: how many characters per line, how often source location
2752 information should be reported. Right now, only the C++ front end can
2753 honor these options. However it is expected, in the near future, that
2754 the remaining front ends would be able to digest them correctly.
2757 @item -fmessage-length=@var{n}
2758 @opindex fmessage-length
2759 Try to format error messages so that they fit on lines of about @var{n}
2760 characters. The default is 72 characters for @command{g++} and 0 for the rest of
2761 the front ends supported by GCC@. If @var{n} is zero, then no
2762 line-wrapping will be done; each error message will appear on a single
2765 @opindex fdiagnostics-show-location
2766 @item -fdiagnostics-show-location=once
2767 Only meaningful in line-wrapping mode. Instructs the diagnostic messages
2768 reporter to emit @emph{once} source location information; that is, in
2769 case the message is too long to fit on a single physical line and has to
2770 be wrapped, the source location won't be emitted (as prefix) again,
2771 over and over, in subsequent continuation lines. This is the default
2774 @item -fdiagnostics-show-location=every-line
2775 Only meaningful in line-wrapping mode. Instructs the diagnostic
2776 messages reporter to emit the same source location information (as
2777 prefix) for physical lines that result from the process of breaking
2778 a message which is too long to fit on a single line.
2780 @item -fno-diagnostics-show-option
2781 @opindex fno-diagnostics-show-option
2782 @opindex fdiagnostics-show-option
2783 By default, each diagnostic emitted includes text which indicates the
2784 command line option that directly controls the diagnostic (if such an
2785 option is known to the diagnostic machinery). Specifying the
2786 @option{-fno-diagnostics-show-option} flag suppresses that behavior.
2788 @item -Wcoverage-mismatch
2789 @opindex Wcoverage-mismatch
2790 Warn if feedback profiles do not match when using the
2791 @option{-fprofile-use} option.
2792 If a source file was changed between @option{-fprofile-gen} and
2793 @option{-fprofile-use}, the files with the profile feedback can fail
2794 to match the source file and GCC can not use the profile feedback
2795 information. By default, this warning is enabled and is treated as an
2796 error. @option{-Wno-coverage-mismatch} can be used to disable the
2797 warning or @option{-Wno-error=coverage-mismatch} can be used to
2798 disable the error. Disable the error for this warning can result in
2799 poorly optimized code, so disabling the error is useful only in the
2800 case of very minor changes such as bug fixes to an existing code-base.
2801 Completely disabling the warning is not recommended.
2805 @node Warning Options
2806 @section Options to Request or Suppress Warnings
2807 @cindex options to control warnings
2808 @cindex warning messages
2809 @cindex messages, warning
2810 @cindex suppressing warnings
2812 Warnings are diagnostic messages that report constructions which
2813 are not inherently erroneous but which are risky or suggest there
2814 may have been an error.
2816 The following language-independent options do not enable specific
2817 warnings but control the kinds of diagnostics produced by GCC.
2820 @cindex syntax checking
2822 @opindex fsyntax-only
2823 Check the code for syntax errors, but don't do anything beyond that.
2825 @item -fmax-errors=@var{n}
2826 @opindex fmax-errors
2827 Limits the maximum number of error messages to @var{n}, at which point
2828 GCC bails out rather than attempting to continue processing the source
2829 code. If @var{n} is 0 (the default), there is no limit on the number
2830 of error messages produced. If @option{-Wfatal-errors} is also
2831 specified, then @option{-Wfatal-errors} takes precedence over this
2836 Inhibit all warning messages.
2841 Make all warnings into errors.
2846 Make the specified warning into an error. The specifier for a warning
2847 is appended, for example @option{-Werror=switch} turns the warnings
2848 controlled by @option{-Wswitch} into errors. This switch takes a
2849 negative form, to be used to negate @option{-Werror} for specific
2850 warnings, for example @option{-Wno-error=switch} makes
2851 @option{-Wswitch} warnings not be errors, even when @option{-Werror}
2854 The warning message for each controllable warning includes the
2855 option which controls the warning. That option can then be used with
2856 @option{-Werror=} and @option{-Wno-error=} as described above.
2857 (Printing of the option in the warning message can be disabled using the
2858 @option{-fno-diagnostics-show-option} flag.)
2860 Note that specifying @option{-Werror=}@var{foo} automatically implies
2861 @option{-W}@var{foo}. However, @option{-Wno-error=}@var{foo} does not
2864 @item -Wfatal-errors
2865 @opindex Wfatal-errors
2866 @opindex Wno-fatal-errors
2867 This option causes the compiler to abort compilation on the first error
2868 occurred rather than trying to keep going and printing further error
2873 You can request many specific warnings with options beginning
2874 @samp{-W}, for example @option{-Wimplicit} to request warnings on
2875 implicit declarations. Each of these specific warning options also
2876 has a negative form beginning @samp{-Wno-} to turn off warnings; for
2877 example, @option{-Wno-implicit}. This manual lists only one of the
2878 two forms, whichever is not the default. For further,
2879 language-specific options also refer to @ref{C++ Dialect Options} and
2880 @ref{Objective-C and Objective-C++ Dialect Options}.
2882 When an unrecognized warning option is requested (e.g.,
2883 @option{-Wunknown-warning}), GCC will emit a diagnostic stating
2884 that the option is not recognized. However, if the @option{-Wno-} form
2885 is used, the behavior is slightly different: No diagnostic will be
2886 produced for @option{-Wno-unknown-warning} unless other diagnostics
2887 are being produced. This allows the use of new @option{-Wno-} options
2888 with old compilers, but if something goes wrong, the compiler will
2889 warn that an unrecognized option was used.
2894 Issue all the warnings demanded by strict ISO C and ISO C++;
2895 reject all programs that use forbidden extensions, and some other
2896 programs that do not follow ISO C and ISO C++. For ISO C, follows the
2897 version of the ISO C standard specified by any @option{-std} option used.
2899 Valid ISO C and ISO C++ programs should compile properly with or without
2900 this option (though a rare few will require @option{-ansi} or a
2901 @option{-std} option specifying the required version of ISO C)@. However,
2902 without this option, certain GNU extensions and traditional C and C++
2903 features are supported as well. With this option, they are rejected.
2905 @option{-pedantic} does not cause warning messages for use of the
2906 alternate keywords whose names begin and end with @samp{__}. Pedantic
2907 warnings are also disabled in the expression that follows
2908 @code{__extension__}. However, only system header files should use
2909 these escape routes; application programs should avoid them.
2910 @xref{Alternate Keywords}.
2912 Some users try to use @option{-pedantic} to check programs for strict ISO
2913 C conformance. They soon find that it does not do quite what they want:
2914 it finds some non-ISO practices, but not all---only those for which
2915 ISO C @emph{requires} a diagnostic, and some others for which
2916 diagnostics have been added.
2918 A feature to report any failure to conform to ISO C might be useful in
2919 some instances, but would require considerable additional work and would
2920 be quite different from @option{-pedantic}. We don't have plans to
2921 support such a feature in the near future.
2923 Where the standard specified with @option{-std} represents a GNU
2924 extended dialect of C, such as @samp{gnu90} or @samp{gnu99}, there is a
2925 corresponding @dfn{base standard}, the version of ISO C on which the GNU
2926 extended dialect is based. Warnings from @option{-pedantic} are given
2927 where they are required by the base standard. (It would not make sense
2928 for such warnings to be given only for features not in the specified GNU
2929 C dialect, since by definition the GNU dialects of C include all
2930 features the compiler supports with the given option, and there would be
2931 nothing to warn about.)
2933 @item -pedantic-errors
2934 @opindex pedantic-errors
2935 Like @option{-pedantic}, except that errors are produced rather than
2941 This enables all the warnings about constructions that some users
2942 consider questionable, and that are easy to avoid (or modify to
2943 prevent the warning), even in conjunction with macros. This also
2944 enables some language-specific warnings described in @ref{C++ Dialect
2945 Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
2947 @option{-Wall} turns on the following warning flags:
2949 @gccoptlist{-Waddress @gol
2950 -Warray-bounds @r{(only with} @option{-O2}@r{)} @gol
2952 -Wchar-subscripts @gol
2953 -Wenum-compare @r{(in C/Objc; this is on by default in C++)} @gol
2954 -Wimplicit-int @r{(C and Objective-C only)} @gol
2955 -Wimplicit-function-declaration @r{(C and Objective-C only)} @gol
2958 -Wmain @r{(only for C/ObjC and unless} @option{-ffreestanding}@r{)} @gol
2959 -Wmissing-braces @gol
2965 -Wsequence-point @gol
2966 -Wsign-compare @r{(only in C++)} @gol
2967 -Wstrict-aliasing @gol
2968 -Wstrict-overflow=1 @gol
2971 -Wuninitialized @gol
2972 -Wunknown-pragmas @gol
2973 -Wunused-function @gol
2976 -Wunused-variable @gol
2977 -Wvolatile-register-var @gol
2980 Note that some warning flags are not implied by @option{-Wall}. Some of
2981 them warn about constructions that users generally do not consider
2982 questionable, but which occasionally you might wish to check for;
2983 others warn about constructions that are necessary or hard to avoid in
2984 some cases, and there is no simple way to modify the code to suppress
2985 the warning. Some of them are enabled by @option{-Wextra} but many of
2986 them must be enabled individually.
2992 This enables some extra warning flags that are not enabled by
2993 @option{-Wall}. (This option used to be called @option{-W}. The older
2994 name is still supported, but the newer name is more descriptive.)
2996 @gccoptlist{-Wclobbered @gol
2998 -Wignored-qualifiers @gol
2999 -Wmissing-field-initializers @gol
3000 -Wmissing-parameter-type @r{(C only)} @gol
3001 -Wold-style-declaration @r{(C only)} @gol
3002 -Woverride-init @gol
3005 -Wuninitialized @gol
3006 -Wunused-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3007 -Wunused-but-set-parameter @r{(only with} @option{-Wunused} @r{or} @option{-Wall}@r{)} @gol
3010 The option @option{-Wextra} also prints warning messages for the
3016 A pointer is compared against integer zero with @samp{<}, @samp{<=},
3017 @samp{>}, or @samp{>=}.
3020 (C++ only) An enumerator and a non-enumerator both appear in a
3021 conditional expression.
3024 (C++ only) Ambiguous virtual bases.
3027 (C++ only) Subscripting an array which has been declared @samp{register}.
3030 (C++ only) Taking the address of a variable which has been declared
3034 (C++ only) A base class is not initialized in a derived class' copy
3039 @item -Wchar-subscripts
3040 @opindex Wchar-subscripts
3041 @opindex Wno-char-subscripts
3042 Warn if an array subscript has type @code{char}. This is a common cause
3043 of error, as programmers often forget that this type is signed on some
3045 This warning is enabled by @option{-Wall}.
3049 @opindex Wno-comment
3050 Warn whenever a comment-start sequence @samp{/*} appears in a @samp{/*}
3051 comment, or whenever a Backslash-Newline appears in a @samp{//} comment.
3052 This warning is enabled by @option{-Wall}.
3055 @r{(C, Objective-C, C++, Objective-C++ and Fortran only)}
3057 Suppress warning messages emitted by @code{#warning} directives.
3059 @item -Wdouble-promotion @r{(C, C++, Objective-C and Objective-C++ only)}
3060 @opindex Wdouble-promotion
3061 @opindex Wno-double-promotion
3062 Give a warning when a value of type @code{float} is implicitly
3063 promoted to @code{double}. CPUs with a 32-bit ``single-precision''
3064 floating-point unit implement @code{float} in hardware, but emulate
3065 @code{double} in software. On such a machine, doing computations
3066 using @code{double} values is much more expensive because of the
3067 overhead required for software emulation.
3069 It is easy to accidentally do computations with @code{double} because
3070 floating-point literals are implicitly of type @code{double}. For
3074 float area(float radius)
3076 return 3.14159 * radius * radius;
3080 the compiler will perform the entire computation with @code{double}
3081 because the floating-point literal is a @code{double}.
3086 @opindex ffreestanding
3087 @opindex fno-builtin
3088 Check calls to @code{printf} and @code{scanf}, etc., to make sure that
3089 the arguments supplied have types appropriate to the format string
3090 specified, and that the conversions specified in the format string make
3091 sense. This includes standard functions, and others specified by format
3092 attributes (@pxref{Function Attributes}), in the @code{printf},
3093 @code{scanf}, @code{strftime} and @code{strfmon} (an X/Open extension,
3094 not in the C standard) families (or other target-specific families).
3095 Which functions are checked without format attributes having been
3096 specified depends on the standard version selected, and such checks of
3097 functions without the attribute specified are disabled by
3098 @option{-ffreestanding} or @option{-fno-builtin}.
3100 The formats are checked against the format features supported by GNU
3101 libc version 2.2. These include all ISO C90 and C99 features, as well
3102 as features from the Single Unix Specification and some BSD and GNU
3103 extensions. Other library implementations may not support all these
3104 features; GCC does not support warning about features that go beyond a
3105 particular library's limitations. However, if @option{-pedantic} is used
3106 with @option{-Wformat}, warnings will be given about format features not
3107 in the selected standard version (but not for @code{strfmon} formats,
3108 since those are not in any version of the C standard). @xref{C Dialect
3109 Options,,Options Controlling C Dialect}.
3111 Since @option{-Wformat} also checks for null format arguments for
3112 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
3114 @option{-Wformat} is included in @option{-Wall}. For more control over some
3115 aspects of format checking, the options @option{-Wformat-y2k},
3116 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
3117 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
3118 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
3121 @opindex Wformat-y2k
3122 @opindex Wno-format-y2k
3123 If @option{-Wformat} is specified, also warn about @code{strftime}
3124 formats which may yield only a two-digit year.
3126 @item -Wno-format-contains-nul
3127 @opindex Wno-format-contains-nul
3128 @opindex Wformat-contains-nul
3129 If @option{-Wformat} is specified, do not warn about format strings that
3132 @item -Wno-format-extra-args
3133 @opindex Wno-format-extra-args
3134 @opindex Wformat-extra-args
3135 If @option{-Wformat} is specified, do not warn about excess arguments to a
3136 @code{printf} or @code{scanf} format function. The C standard specifies
3137 that such arguments are ignored.
3139 Where the unused arguments lie between used arguments that are
3140 specified with @samp{$} operand number specifications, normally
3141 warnings are still given, since the implementation could not know what
3142 type to pass to @code{va_arg} to skip the unused arguments. However,
3143 in the case of @code{scanf} formats, this option will suppress the
3144 warning if the unused arguments are all pointers, since the Single
3145 Unix Specification says that such unused arguments are allowed.
3147 @item -Wno-format-zero-length @r{(C and Objective-C only)}
3148 @opindex Wno-format-zero-length
3149 @opindex Wformat-zero-length
3150 If @option{-Wformat} is specified, do not warn about zero-length formats.
3151 The C standard specifies that zero-length formats are allowed.
3153 @item -Wformat-nonliteral
3154 @opindex Wformat-nonliteral
3155 @opindex Wno-format-nonliteral
3156 If @option{-Wformat} is specified, also warn if the format string is not a
3157 string literal and so cannot be checked, unless the format function
3158 takes its format arguments as a @code{va_list}.
3160 @item -Wformat-security
3161 @opindex Wformat-security
3162 @opindex Wno-format-security
3163 If @option{-Wformat} is specified, also warn about uses of format
3164 functions that represent possible security problems. At present, this
3165 warns about calls to @code{printf} and @code{scanf} functions where the
3166 format string is not a string literal and there are no format arguments,
3167 as in @code{printf (foo);}. This may be a security hole if the format
3168 string came from untrusted input and contains @samp{%n}. (This is
3169 currently a subset of what @option{-Wformat-nonliteral} warns about, but
3170 in future warnings may be added to @option{-Wformat-security} that are not
3171 included in @option{-Wformat-nonliteral}.)
3175 @opindex Wno-format=2
3176 Enable @option{-Wformat} plus format checks not included in
3177 @option{-Wformat}. Currently equivalent to @samp{-Wformat
3178 -Wformat-nonliteral -Wformat-security -Wformat-y2k}.
3180 @item -Wnonnull @r{(C and Objective-C only)}
3182 @opindex Wno-nonnull
3183 Warn about passing a null pointer for arguments marked as
3184 requiring a non-null value by the @code{nonnull} function attribute.
3186 @option{-Wnonnull} is included in @option{-Wall} and @option{-Wformat}. It
3187 can be disabled with the @option{-Wno-nonnull} option.
3189 @item -Winit-self @r{(C, C++, Objective-C and Objective-C++ only)}
3191 @opindex Wno-init-self
3192 Warn about uninitialized variables which are initialized with themselves.
3193 Note this option can only be used with the @option{-Wuninitialized} option.
3195 For example, GCC will warn about @code{i} being uninitialized in the
3196 following snippet only when @option{-Winit-self} has been specified:
3207 @item -Wimplicit-int @r{(C and Objective-C only)}
3208 @opindex Wimplicit-int
3209 @opindex Wno-implicit-int
3210 Warn when a declaration does not specify a type.
3211 This warning is enabled by @option{-Wall}.
3213 @item -Wimplicit-function-declaration @r{(C and Objective-C only)}
3214 @opindex Wimplicit-function-declaration
3215 @opindex Wno-implicit-function-declaration
3216 Give a warning whenever a function is used before being declared. In
3217 C99 mode (@option{-std=c99} or @option{-std=gnu99}), this warning is
3218 enabled by default and it is made into an error by
3219 @option{-pedantic-errors}. This warning is also enabled by
3222 @item -Wimplicit @r{(C and Objective-C only)}
3224 @opindex Wno-implicit
3225 Same as @option{-Wimplicit-int} and @option{-Wimplicit-function-declaration}.
3226 This warning is enabled by @option{-Wall}.
3228 @item -Wignored-qualifiers @r{(C and C++ only)}
3229 @opindex Wignored-qualifiers
3230 @opindex Wno-ignored-qualifiers
3231 Warn if the return type of a function has a type qualifier
3232 such as @code{const}. For ISO C such a type qualifier has no effect,
3233 since the value returned by a function is not an lvalue.
3234 For C++, the warning is only emitted for scalar types or @code{void}.
3235 ISO C prohibits qualified @code{void} return types on function
3236 definitions, so such return types always receive a warning
3237 even without this option.
3239 This warning is also enabled by @option{-Wextra}.
3244 Warn if the type of @samp{main} is suspicious. @samp{main} should be
3245 a function with external linkage, returning int, taking either zero
3246 arguments, two, or three arguments of appropriate types. This warning
3247 is enabled by default in C++ and is enabled by either @option{-Wall}
3248 or @option{-pedantic}.
3250 @item -Wmissing-braces
3251 @opindex Wmissing-braces
3252 @opindex Wno-missing-braces
3253 Warn if an aggregate or union initializer is not fully bracketed. In
3254 the following example, the initializer for @samp{a} is not fully
3255 bracketed, but that for @samp{b} is fully bracketed.
3258 int a[2][2] = @{ 0, 1, 2, 3 @};
3259 int b[2][2] = @{ @{ 0, 1 @}, @{ 2, 3 @} @};
3262 This warning is enabled by @option{-Wall}.
3264 @item -Wmissing-include-dirs @r{(C, C++, Objective-C and Objective-C++ only)}
3265 @opindex Wmissing-include-dirs
3266 @opindex Wno-missing-include-dirs
3267 Warn if a user-supplied include directory does not exist.
3270 @opindex Wparentheses
3271 @opindex Wno-parentheses
3272 Warn if parentheses are omitted in certain contexts, such
3273 as when there is an assignment in a context where a truth value
3274 is expected, or when operators are nested whose precedence people
3275 often get confused about.
3277 Also warn if a comparison like @samp{x<=y<=z} appears; this is
3278 equivalent to @samp{(x<=y ? 1 : 0) <= z}, which is a different
3279 interpretation from that of ordinary mathematical notation.
3281 Also warn about constructions where there may be confusion to which
3282 @code{if} statement an @code{else} branch belongs. Here is an example of
3297 In C/C++, every @code{else} branch belongs to the innermost possible
3298 @code{if} statement, which in this example is @code{if (b)}. This is
3299 often not what the programmer expected, as illustrated in the above
3300 example by indentation the programmer chose. When there is the
3301 potential for this confusion, GCC will issue a warning when this flag
3302 is specified. To eliminate the warning, add explicit braces around
3303 the innermost @code{if} statement so there is no way the @code{else}
3304 could belong to the enclosing @code{if}. The resulting code would
3321 Also warn for dangerous uses of the
3322 ?: with omitted middle operand GNU extension. When the condition
3323 in the ?: operator is a boolean expression the omitted value will
3324 be always 1. Often the user expects it to be a value computed
3325 inside the conditional expression instead.
3327 This warning is enabled by @option{-Wall}.
3329 @item -Wsequence-point
3330 @opindex Wsequence-point
3331 @opindex Wno-sequence-point
3332 Warn about code that may have undefined semantics because of violations
3333 of sequence point rules in the C and C++ standards.
3335 The C and C++ standards defines the order in which expressions in a C/C++
3336 program are evaluated in terms of @dfn{sequence points}, which represent
3337 a partial ordering between the execution of parts of the program: those
3338 executed before the sequence point, and those executed after it. These
3339 occur after the evaluation of a full expression (one which is not part
3340 of a larger expression), after the evaluation of the first operand of a
3341 @code{&&}, @code{||}, @code{? :} or @code{,} (comma) operator, before a
3342 function is called (but after the evaluation of its arguments and the
3343 expression denoting the called function), and in certain other places.
3344 Other than as expressed by the sequence point rules, the order of
3345 evaluation of subexpressions of an expression is not specified. All
3346 these rules describe only a partial order rather than a total order,
3347 since, for example, if two functions are called within one expression
3348 with no sequence point between them, the order in which the functions
3349 are called is not specified. However, the standards committee have
3350 ruled that function calls do not overlap.
3352 It is not specified when between sequence points modifications to the
3353 values of objects take effect. Programs whose behavior depends on this
3354 have undefined behavior; the C and C++ standards specify that ``Between
3355 the previous and next sequence point an object shall have its stored
3356 value modified at most once by the evaluation of an expression.
3357 Furthermore, the prior value shall be read only to determine the value
3358 to be stored.''. If a program breaks these rules, the results on any
3359 particular implementation are entirely unpredictable.
3361 Examples of code with undefined behavior are @code{a = a++;}, @code{a[n]
3362 = b[n++]} and @code{a[i++] = i;}. Some more complicated cases are not
3363 diagnosed by this option, and it may give an occasional false positive
3364 result, but in general it has been found fairly effective at detecting
3365 this sort of problem in programs.
3367 The standard is worded confusingly, therefore there is some debate
3368 over the precise meaning of the sequence point rules in subtle cases.
3369 Links to discussions of the problem, including proposed formal
3370 definitions, may be found on the GCC readings page, at
3371 @uref{http://gcc.gnu.org/@/readings.html}.
3373 This warning is enabled by @option{-Wall} for C and C++.
3376 @opindex Wreturn-type
3377 @opindex Wno-return-type
3378 Warn whenever a function is defined with a return-type that defaults
3379 to @code{int}. Also warn about any @code{return} statement with no
3380 return-value in a function whose return-type is not @code{void}
3381 (falling off the end of the function body is considered returning
3382 without a value), and about a @code{return} statement with an
3383 expression in a function whose return-type is @code{void}.
3385 For C++, a function without return type always produces a diagnostic
3386 message, even when @option{-Wno-return-type} is specified. The only
3387 exceptions are @samp{main} and functions defined in system headers.
3389 This warning is enabled by @option{-Wall}.
3394 Warn whenever a @code{switch} statement has an index of enumerated type
3395 and lacks a @code{case} for one or more of the named codes of that
3396 enumeration. (The presence of a @code{default} label prevents this
3397 warning.) @code{case} labels outside the enumeration range also
3398 provoke warnings when this option is used (even if there is a
3399 @code{default} label).
3400 This warning is enabled by @option{-Wall}.
3402 @item -Wswitch-default
3403 @opindex Wswitch-default
3404 @opindex Wno-switch-default
3405 Warn whenever a @code{switch} statement does not have a @code{default}
3409 @opindex Wswitch-enum
3410 @opindex Wno-switch-enum
3411 Warn whenever a @code{switch} statement has an index of enumerated type
3412 and lacks a @code{case} for one or more of the named codes of that
3413 enumeration. @code{case} labels outside the enumeration range also
3414 provoke warnings when this option is used. The only difference
3415 between @option{-Wswitch} and this option is that this option gives a
3416 warning about an omitted enumeration code even if there is a
3417 @code{default} label.
3419 @item -Wsync-nand @r{(C and C++ only)}
3421 @opindex Wno-sync-nand
3422 Warn when @code{__sync_fetch_and_nand} and @code{__sync_nand_and_fetch}
3423 built-in functions are used. These functions changed semantics in GCC 4.4.
3427 @opindex Wno-trigraphs
3428 Warn if any trigraphs are encountered that might change the meaning of
3429 the program (trigraphs within comments are not warned about).
3430 This warning is enabled by @option{-Wall}.
3432 @item -Wunused-but-set-parameter
3433 @opindex Wunused-but-set-parameter
3434 @opindex Wno-unused-but-set-parameter
3435 Warn whenever a function parameter is assigned to, but otherwise unused
3436 (aside from its declaration).
3438 To suppress this warning use the @samp{unused} attribute
3439 (@pxref{Variable Attributes}).
3441 This warning is also enabled by @option{-Wunused} together with
3444 @item -Wunused-but-set-variable
3445 @opindex Wunused-but-set-variable
3446 @opindex Wno-unused-but-set-variable
3447 Warn whenever a local variable is assigned to, but otherwise unused
3448 (aside from its declaration).
3449 This warning is enabled by @option{-Wall}.
3451 To suppress this warning use the @samp{unused} attribute
3452 (@pxref{Variable Attributes}).
3454 This warning is also enabled by @option{-Wunused}, which is enabled
3457 @item -Wunused-function
3458 @opindex Wunused-function
3459 @opindex Wno-unused-function
3460 Warn whenever a static function is declared but not defined or a
3461 non-inline static function is unused.
3462 This warning is enabled by @option{-Wall}.
3464 @item -Wunused-label
3465 @opindex Wunused-label
3466 @opindex Wno-unused-label
3467 Warn whenever a label is declared but not used.
3468 This warning is enabled by @option{-Wall}.
3470 To suppress this warning use the @samp{unused} attribute
3471 (@pxref{Variable Attributes}).
3473 @item -Wunused-parameter
3474 @opindex Wunused-parameter
3475 @opindex Wno-unused-parameter
3476 Warn whenever a function parameter is unused aside from its declaration.
3478 To suppress this warning use the @samp{unused} attribute
3479 (@pxref{Variable Attributes}).
3481 @item -Wno-unused-result
3482 @opindex Wunused-result
3483 @opindex Wno-unused-result
3484 Do not warn if a caller of a function marked with attribute
3485 @code{warn_unused_result} (@pxref{Variable Attributes}) does not use
3486 its return value. The default is @option{-Wunused-result}.
3488 @item -Wunused-variable
3489 @opindex Wunused-variable
3490 @opindex Wno-unused-variable
3491 Warn whenever a local variable or non-constant static variable is unused
3492 aside from its declaration.
3493 This warning is enabled by @option{-Wall}.
3495 To suppress this warning use the @samp{unused} attribute
3496 (@pxref{Variable Attributes}).
3498 @item -Wunused-value
3499 @opindex Wunused-value
3500 @opindex Wno-unused-value
3501 Warn whenever a statement computes a result that is explicitly not
3502 used. To suppress this warning cast the unused expression to
3503 @samp{void}. This includes an expression-statement or the left-hand
3504 side of a comma expression that contains no side effects. For example,
3505 an expression such as @samp{x[i,j]} will cause a warning, while
3506 @samp{x[(void)i,j]} will not.
3508 This warning is enabled by @option{-Wall}.
3513 All the above @option{-Wunused} options combined.
3515 In order to get a warning about an unused function parameter, you must
3516 either specify @samp{-Wextra -Wunused} (note that @samp{-Wall} implies
3517 @samp{-Wunused}), or separately specify @option{-Wunused-parameter}.
3519 @item -Wuninitialized
3520 @opindex Wuninitialized
3521 @opindex Wno-uninitialized
3522 Warn if an automatic variable is used without first being initialized
3523 or if a variable may be clobbered by a @code{setjmp} call. In C++,
3524 warn if a non-static reference or non-static @samp{const} member
3525 appears in a class without constructors.
3527 If you want to warn about code which uses the uninitialized value of the
3528 variable in its own initializer, use the @option{-Winit-self} option.
3530 These warnings occur for individual uninitialized or clobbered
3531 elements of structure, union or array variables as well as for
3532 variables which are uninitialized or clobbered as a whole. They do
3533 not occur for variables or elements declared @code{volatile}. Because
3534 these warnings depend on optimization, the exact variables or elements
3535 for which there are warnings will depend on the precise optimization
3536 options and version of GCC used.
3538 Note that there may be no warning about a variable that is used only
3539 to compute a value that itself is never used, because such
3540 computations may be deleted by data flow analysis before the warnings
3543 These warnings are made optional because GCC is not smart
3544 enough to see all the reasons why the code might be correct
3545 despite appearing to have an error. Here is one example of how
3566 If the value of @code{y} is always 1, 2 or 3, then @code{x} is
3567 always initialized, but GCC doesn't know this. Here is
3568 another common case:
3573 if (change_y) save_y = y, y = new_y;
3575 if (change_y) y = save_y;
3580 This has no bug because @code{save_y} is used only if it is set.
3582 @cindex @code{longjmp} warnings
3583 This option also warns when a non-volatile automatic variable might be
3584 changed by a call to @code{longjmp}. These warnings as well are possible
3585 only in optimizing compilation.
3587 The compiler sees only the calls to @code{setjmp}. It cannot know
3588 where @code{longjmp} will be called; in fact, a signal handler could
3589 call it at any point in the code. As a result, you may get a warning
3590 even when there is in fact no problem because @code{longjmp} cannot
3591 in fact be called at the place which would cause a problem.
3593 Some spurious warnings can be avoided if you declare all the functions
3594 you use that never return as @code{noreturn}. @xref{Function
3597 This warning is enabled by @option{-Wall} or @option{-Wextra}.
3599 @item -Wunknown-pragmas
3600 @opindex Wunknown-pragmas
3601 @opindex Wno-unknown-pragmas
3602 @cindex warning for unknown pragmas
3603 @cindex unknown pragmas, warning
3604 @cindex pragmas, warning of unknown
3605 Warn when a #pragma directive is encountered which is not understood by
3606 GCC@. If this command line option is used, warnings will even be issued
3607 for unknown pragmas in system header files. This is not the case if
3608 the warnings were only enabled by the @option{-Wall} command line option.
3611 @opindex Wno-pragmas
3613 Do not warn about misuses of pragmas, such as incorrect parameters,
3614 invalid syntax, or conflicts between pragmas. See also
3615 @samp{-Wunknown-pragmas}.
3617 @item -Wstrict-aliasing
3618 @opindex Wstrict-aliasing
3619 @opindex Wno-strict-aliasing
3620 This option is only active when @option{-fstrict-aliasing} is active.
3621 It warns about code which might break the strict aliasing rules that the
3622 compiler is using for optimization. The warning does not catch all
3623 cases, but does attempt to catch the more common pitfalls. It is
3624 included in @option{-Wall}.
3625 It is equivalent to @option{-Wstrict-aliasing=3}
3627 @item -Wstrict-aliasing=n
3628 @opindex Wstrict-aliasing=n
3629 @opindex Wno-strict-aliasing=n
3630 This option is only active when @option{-fstrict-aliasing} is active.
3631 It warns about code which might break the strict aliasing rules that the
3632 compiler is using for optimization.
3633 Higher levels correspond to higher accuracy (fewer false positives).
3634 Higher levels also correspond to more effort, similar to the way -O works.
3635 @option{-Wstrict-aliasing} is equivalent to @option{-Wstrict-aliasing=n},
3638 Level 1: Most aggressive, quick, least accurate.
3639 Possibly useful when higher levels