1 | This is Info file gcc.info, produced by Makeinfo version 1.67 from the |
---|
2 | input file gcc.texi. |
---|
3 | |
---|
4 | This file documents the use and the internals of the GNU compiler. |
---|
5 | |
---|
6 | Published by the Free Software Foundation 59 Temple Place - Suite 330 |
---|
7 | Boston, MA 02111-1307 USA |
---|
8 | |
---|
9 | Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998 |
---|
10 | Free Software Foundation, Inc. |
---|
11 | |
---|
12 | Permission is granted to make and distribute verbatim copies of this |
---|
13 | manual provided the copyright notice and this permission notice are |
---|
14 | preserved on all copies. |
---|
15 | |
---|
16 | Permission is granted to copy and distribute modified versions of |
---|
17 | this manual under the conditions for verbatim copying, provided also |
---|
18 | that the sections entitled "GNU General Public License," "Funding for |
---|
19 | Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are |
---|
20 | included exactly as in the original, and provided that the entire |
---|
21 | resulting derived work is distributed under the terms of a permission |
---|
22 | notice identical to this one. |
---|
23 | |
---|
24 | Permission is granted to copy and distribute translations of this |
---|
25 | manual into another language, under the above conditions for modified |
---|
26 | versions, except that the sections entitled "GNU General Public |
---|
27 | License," "Funding for Free Software," and "Protect Your Freedom--Fight |
---|
28 | `Look And Feel'", and this permission notice, may be included in |
---|
29 | translations approved by the Free Software Foundation instead of in the |
---|
30 | original English. |
---|
31 | |
---|
32 | |
---|
33 | File: gcc.info, Node: Top, Next: G++ and GCC, Up: (DIR) |
---|
34 | |
---|
35 | Introduction |
---|
36 | ************ |
---|
37 | |
---|
38 | This manual documents how to run, install and port the GNU compiler, |
---|
39 | as well as its new features and incompatibilities, and how to report |
---|
40 | bugs. It corresponds to GNU CC version 2.8.1. |
---|
41 | |
---|
42 | * Menu: |
---|
43 | |
---|
44 | |
---|
45 | * G++ and GCC:: You can compile C or C++ programs. |
---|
46 | * Invoking GCC:: Command options supported by `gcc'. |
---|
47 | * Installation:: How to configure, compile and install GNU CC. |
---|
48 | * C Extensions:: GNU extensions to the C language family. |
---|
49 | * C++ Extensions:: GNU extensions to the C++ language. |
---|
50 | * Gcov:: gcov: a GNU CC test coverage program. |
---|
51 | * Trouble:: If you have trouble installing GNU CC. |
---|
52 | * Bugs:: How, why and where to report bugs. |
---|
53 | * Service:: How to find suppliers of support for GNU CC. |
---|
54 | * Contributing:: How to contribute to testing and developing GNU CC. |
---|
55 | * VMS:: Using GNU CC on VMS. |
---|
56 | |
---|
57 | * Portability:: Goals of GNU CC's portability features. |
---|
58 | * Interface:: Function-call interface of GNU CC output. |
---|
59 | * Passes:: Order of passes, what they do, and what each file is for. |
---|
60 | * RTL:: The intermediate representation that most passes work on. |
---|
61 | * Machine Desc:: How to write machine description instruction patterns. |
---|
62 | * Target Macros:: How to write the machine description C macros. |
---|
63 | * Config:: Writing the `xm-MACHINE.h' file. |
---|
64 | * Fragments:: Writing the `t-TARGET' and `x-HOST' files. |
---|
65 | |
---|
66 | * Funding:: How to help assure funding for free software. |
---|
67 | * Look and Feel:: Protect your freedom--fight "look and feel". |
---|
68 | |
---|
69 | * Copying:: GNU General Public License says |
---|
70 | how you can copy and share GNU CC. |
---|
71 | * Contributors:: People who have contributed to GNU CC. |
---|
72 | |
---|
73 | * Index:: Index of concepts and symbol names. |
---|
74 | |
---|
75 | |
---|
76 | File: gcc.info, Node: G++ and GCC, Next: Invoking GCC, Prev: Top, Up: Top |
---|
77 | |
---|
78 | Compile C, C++, or Objective C |
---|
79 | ****************************** |
---|
80 | |
---|
81 | The C, C++, and Objective C versions of the compiler are integrated; |
---|
82 | the GNU C compiler can compile programs written in C, C++, or Objective |
---|
83 | C. |
---|
84 | |
---|
85 | "GCC" is a common shorthand term for the GNU C compiler. This is |
---|
86 | both the most general name for the compiler, and the name used when the |
---|
87 | emphasis is on compiling C programs. |
---|
88 | |
---|
89 | When referring to C++ compilation, it is usual to call the compiler |
---|
90 | "G++". Since there is only one compiler, it is also accurate to call |
---|
91 | it "GCC" no matter what the language context; however, the term "G++" |
---|
92 | is more useful when the emphasis is on compiling C++ programs. |
---|
93 | |
---|
94 | We use the name "GNU CC" to refer to the compilation system as a |
---|
95 | whole, and more specifically to the language-independent part of the |
---|
96 | compiler. For example, we refer to the optimization options as |
---|
97 | affecting the behavior of "GNU CC" or sometimes just "the compiler". |
---|
98 | |
---|
99 | Front ends for other languages, such as Ada 9X, Fortran, Modula-3, |
---|
100 | and Pascal, are under development. These front-ends, like that for |
---|
101 | C++, are built in subdirectories of GNU CC and link to it. The result |
---|
102 | is an integrated compiler that can compile programs written in C, C++, |
---|
103 | Objective C, or any of the languages for which you have installed front |
---|
104 | ends. |
---|
105 | |
---|
106 | In this manual, we only discuss the options for the C, Objective-C, |
---|
107 | and C++ compilers and those of the GNU CC core. Consult the |
---|
108 | documentation of the other front ends for the options to use when |
---|
109 | compiling programs written in other languages. |
---|
110 | |
---|
111 | G++ is a *compiler*, not merely a preprocessor. G++ builds object |
---|
112 | code directly from your C++ program source. There is no intermediate C |
---|
113 | version of the program. (By contrast, for example, some other |
---|
114 | implementations use a program that generates a C program from your C++ |
---|
115 | source.) Avoiding an intermediate C representation of the program means |
---|
116 | that you get better object code, and better debugging information. The |
---|
117 | GNU debugger, GDB, works with this information in the object code to |
---|
118 | give you comprehensive C++ source-level editing capabilities (*note C |
---|
119 | and C++: (gdb.info)C.). |
---|
120 | |
---|
121 | |
---|
122 | File: gcc.info, Node: Invoking GCC, Next: Installation, Prev: G++ and GCC, Up: Top |
---|
123 | |
---|
124 | GNU CC Command Options |
---|
125 | ********************** |
---|
126 | |
---|
127 | When you invoke GNU CC, it normally does preprocessing, compilation, |
---|
128 | assembly and linking. The "overall options" allow you to stop this |
---|
129 | process at an intermediate stage. For example, the `-c' option says |
---|
130 | not to run the linker. Then the output consists of object files output |
---|
131 | by the assembler. |
---|
132 | |
---|
133 | Other options are passed on to one stage of processing. Some options |
---|
134 | control the preprocessor and others the compiler itself. Yet other |
---|
135 | options control the assembler and linker; most of these are not |
---|
136 | documented here, since you rarely need to use any of them. |
---|
137 | |
---|
138 | Most of the command line options that you can use with GNU CC are |
---|
139 | useful for C programs; when an option is only useful with another |
---|
140 | language (usually C++), the explanation says so explicitly. If the |
---|
141 | description for a particular option does not mention a source language, |
---|
142 | you can use that option with all supported languages. |
---|
143 | |
---|
144 | *Note Compiling C++ Programs: Invoking G++, for a summary of special |
---|
145 | options for compiling C++ programs. |
---|
146 | |
---|
147 | The `gcc' program accepts options and file names as operands. Many |
---|
148 | options have multiletter names; therefore multiple single-letter options |
---|
149 | may *not* be grouped: `-dr' is very different from `-d -r'. |
---|
150 | |
---|
151 | You can mix options and other arguments. For the most part, the |
---|
152 | order you use doesn't matter. Order does matter when you use several |
---|
153 | options of the same kind; for example, if you specify `-L' more than |
---|
154 | once, the directories are searched in the order specified. |
---|
155 | |
---|
156 | Many options have long names starting with `-f' or with `-W'--for |
---|
157 | example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on. |
---|
158 | Most of these have both positive and negative forms; the negative form |
---|
159 | of `-ffoo' would be `-fno-foo'. This manual documents only one of |
---|
160 | these two forms, whichever one is not the default. |
---|
161 | |
---|
162 | * Menu: |
---|
163 | |
---|
164 | * Option Summary:: Brief list of all options, without explanations. |
---|
165 | * Overall Options:: Controlling the kind of output: |
---|
166 | an executable, object files, assembler files, |
---|
167 | or preprocessed source. |
---|
168 | * Invoking G++:: Compiling C++ programs. |
---|
169 | * C Dialect Options:: Controlling the variant of C language compiled. |
---|
170 | * C++ Dialect Options:: Variations on C++. |
---|
171 | * Warning Options:: How picky should the compiler be? |
---|
172 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. |
---|
173 | * Optimize Options:: How much optimization? |
---|
174 | * Preprocessor Options:: Controlling header files and macro definitions. |
---|
175 | Also, getting dependency information for Make. |
---|
176 | * Assembler Options:: Passing options to the assembler. |
---|
177 | * Link Options:: Specifying libraries and so on. |
---|
178 | * Directory Options:: Where to find header files and libraries. |
---|
179 | Where to find the compiler executable files. |
---|
180 | * Target Options:: Running a cross-compiler, or an old version of GNU CC. |
---|
181 | * Submodel Options:: Specifying minor hardware or convention variations, |
---|
182 | such as 68010 vs 68020. |
---|
183 | * Code Gen Options:: Specifying conventions for function calls, data layout |
---|
184 | and register usage. |
---|
185 | * Environment Variables:: Env vars that affect GNU CC. |
---|
186 | * Running Protoize:: Automatically adding or removing function prototypes. |
---|
187 | |
---|
188 | |
---|
189 | File: gcc.info, Node: Option Summary, Next: Overall Options, Up: Invoking GCC |
---|
190 | |
---|
191 | Option Summary |
---|
192 | ============== |
---|
193 | |
---|
194 | Here is a summary of all the options, grouped by type. Explanations |
---|
195 | are in the following sections. |
---|
196 | |
---|
197 | *Overall Options* |
---|
198 | *Note Options Controlling the Kind of Output: Overall Options. |
---|
199 | -c -S -E -o FILE -pipe -v -x LANGUAGE |
---|
200 | |
---|
201 | *C Language Options* |
---|
202 | *Note Options Controlling C Dialect: C Dialect Options. |
---|
203 | -ansi -fallow-single-precision -fcond-mismatch -fno-asm |
---|
204 | -fno-builtin -ffreestanding -fhosted -fsigned-bitfields -fsigned-char |
---|
205 | -funsigned-bitfields -funsigned-char -fwritable-strings |
---|
206 | -traditional -traditional-cpp -trigraphs |
---|
207 | |
---|
208 | *C++ Language Options* |
---|
209 | *Note Options Controlling C++ Dialect: C++ Dialect Options. |
---|
210 | -fall-virtual -fdollars-in-identifiers -felide-constructors |
---|
211 | -fenum-int-equiv -fexternal-templates -ffor-scope -fno-for-scope |
---|
212 | -fhandle-signatures -fmemoize-lookups -fname-mangling-version-N |
---|
213 | -fno-default-inline -fno-gnu-keywords -fnonnull-objects -fguiding-decls |
---|
214 | -foperator-names -fstrict-prototype -fthis-is-variable |
---|
215 | -ftemplate-depth-N -nostdinc++ -traditional +eN |
---|
216 | |
---|
217 | *Warning Options* |
---|
218 | *Note Options to Request or Suppress Warnings: Warning Options. |
---|
219 | -fsyntax-only -pedantic -pedantic-errors |
---|
220 | -w -W -Wall -Waggregate-return -Wbad-function-cast |
---|
221 | -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment |
---|
222 | -Wconversion -Werror -Wformat |
---|
223 | -Wid-clash-LEN -Wimplicit -Wimplicit-int |
---|
224 | -Wimplicit-function-declarations -Wimport -Winline |
---|
225 | -Wlarger-than-LEN -Wmain -Wmissing-declarations |
---|
226 | -Wmissing-prototypes -Wnested-externs |
---|
227 | -Wno-import -Wold-style-cast -Woverloaded-virtual -Wparentheses |
---|
228 | -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow |
---|
229 | -Wsign-compare -Wstrict-prototypes -Wswitch -Wsynth |
---|
230 | -Wtemplate-debugging -Wtraditional -Wtrigraphs |
---|
231 | -Wundef -Wuninitialized -Wunused -Wwrite-strings |
---|
232 | |
---|
233 | *Debugging Options* |
---|
234 | *Note Options for Debugging Your Program or GCC: Debugging Options. |
---|
235 | -a -ax -dLETTERS -fpretend-float |
---|
236 | -fprofile-arcs -ftest-coverage |
---|
237 | -g -gLEVEL -gcoff -gdwarf -gdwarf-1 -gdwarf-1+ -gdwarf-2 |
---|
238 | -ggdb -gstabs -gstabs+ -gxcoff -gxcoff+ |
---|
239 | -p -pg -print-file-name=LIBRARY -print-libgcc-file-name |
---|
240 | -print-prog-name=PROGRAM -print-search-dirs -save-temps |
---|
241 | |
---|
242 | *Optimization Options* |
---|
243 | *Note Options that Control Optimization: Optimize Options. |
---|
244 | -fbranch-probabilities |
---|
245 | -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks |
---|
246 | -fdelayed-branch -fexpensive-optimizations |
---|
247 | -ffast-math -ffloat-store -fforce-addr -fforce-mem |
---|
248 | -ffunction-sections -finline-functions |
---|
249 | -fkeep-inline-functions -fno-default-inline |
---|
250 | -fno-defer-pop -fno-function-cse |
---|
251 | -fno-inline -fno-peephole -fomit-frame-pointer |
---|
252 | -frerun-cse-after-loop -fschedule-insns |
---|
253 | -fschedule-insns2 -fstrength-reduce -fthread-jumps |
---|
254 | -funroll-all-loops -funroll-loops |
---|
255 | -O -O0 -O1 -O2 -O3 |
---|
256 | |
---|
257 | *Preprocessor Options* |
---|
258 | *Note Options Controlling the Preprocessor: Preprocessor Options. |
---|
259 | -AQUESTION(ANSWER) -C -dD -dM -dN |
---|
260 | -DMACRO[=DEFN] -E -H |
---|
261 | -idirafter DIR |
---|
262 | -include FILE -imacros FILE |
---|
263 | -iprefix FILE -iwithprefix DIR |
---|
264 | -iwithprefixbefore DIR -isystem DIR |
---|
265 | -M -MD -MM -MMD -MG -nostdinc -P -trigraphs |
---|
266 | -undef -UMACRO -Wp,OPTION |
---|
267 | |
---|
268 | *Assembler Option* |
---|
269 | *Note Passing Options to the Assembler: Assembler Options. |
---|
270 | -Wa,OPTION |
---|
271 | |
---|
272 | *Linker Options* |
---|
273 | *Note Options for Linking: Link Options. |
---|
274 | OBJECT-FILE-NAME -lLIBRARY |
---|
275 | -nostartfiles -nodefaultlibs -nostdlib |
---|
276 | -s -static -shared -symbolic |
---|
277 | -Wl,OPTION -Xlinker OPTION |
---|
278 | -u SYMBOL |
---|
279 | |
---|
280 | *Directory Options* |
---|
281 | *Note Options for Directory Search: Directory Options. |
---|
282 | -BPREFIX -IDIR -I- -LDIR -specs=FILE |
---|
283 | |
---|
284 | *Target Options* |
---|
285 | *Note Target Options::. |
---|
286 | -b MACHINE -V VERSION |
---|
287 | |
---|
288 | *Machine Dependent Options* |
---|
289 | *Note Hardware Models and Configurations: Submodel Options. |
---|
290 | *M680x0 Options* |
---|
291 | -m68000 -m68020 -m68020-40 -m68020-60 -m68030 -m68040 |
---|
292 | -m68060 -m5200 -m68881 -mbitfield -mc68000 -mc68020 -mfpa |
---|
293 | -mnobitfield -mrtd -mshort -msoft-float -malign-int |
---|
294 | |
---|
295 | *VAX Options* |
---|
296 | -mg -mgnu -munix |
---|
297 | |
---|
298 | *SPARC Options* |
---|
299 | -mcpu=CPU TYPE |
---|
300 | -mtune=CPU TYPE |
---|
301 | -mcmodel=CODE MODEL |
---|
302 | -malign-jumps=NUM -malign-loops=NUM |
---|
303 | -malign-functions=NUM |
---|
304 | -m32 -m64 |
---|
305 | -mapp-regs -mbroken-saverestore -mcypress -mepilogue |
---|
306 | -mflat -mfpu -mhard-float -mhard-quad-float |
---|
307 | -mimpure-text -mlive-g0 -mno-app-regs -mno-epilogue |
---|
308 | -mno-flat -mno-fpu -mno-impure-text |
---|
309 | -mno-stack-bias -mno-unaligned-doubles |
---|
310 | -msoft-float -msoft-quad-float -msparclite -mstack-bias |
---|
311 | -msupersparc -munaligned-doubles -mv8 |
---|
312 | |
---|
313 | *Convex Options* |
---|
314 | -mc1 -mc2 -mc32 -mc34 -mc38 |
---|
315 | -margcount -mnoargcount |
---|
316 | -mlong32 -mlong64 |
---|
317 | -mvolatile-cache -mvolatile-nocache |
---|
318 | |
---|
319 | *AMD29K Options* |
---|
320 | -m29000 -m29050 -mbw -mnbw -mdw -mndw |
---|
321 | -mlarge -mnormal -msmall |
---|
322 | -mkernel-registers -mno-reuse-arg-regs |
---|
323 | -mno-stack-check -mno-storem-bug |
---|
324 | -mreuse-arg-regs -msoft-float -mstack-check |
---|
325 | -mstorem-bug -muser-registers |
---|
326 | |
---|
327 | *ARM Options* |
---|
328 | -mapcs-frame -mapcs-26 -mapcs-32 |
---|
329 | -mlittle-endian -mbig-endian -mwords-little-endian |
---|
330 | -mshort-load-bytes -mno-short-load-bytes |
---|
331 | -msoft-float -mhard-float |
---|
332 | -mbsd -mxopen -mno-symrename |
---|
333 | |
---|
334 | *MN10300 Options* |
---|
335 | -mmult-bug |
---|
336 | -mno-mult-bug |
---|
337 | |
---|
338 | *M32R/D Options* |
---|
339 | -mcode-model=MODEL TYPE -msdata=SDATA TYPE |
---|
340 | -G NUM |
---|
341 | |
---|
342 | *M88K Options* |
---|
343 | -m88000 -m88100 -m88110 -mbig-pic |
---|
344 | -mcheck-zero-division -mhandle-large-shift |
---|
345 | -midentify-revision -mno-check-zero-division |
---|
346 | -mno-ocs-debug-info -mno-ocs-frame-position |
---|
347 | -mno-optimize-arg-area -mno-serialize-volatile |
---|
348 | -mno-underscores -mocs-debug-info |
---|
349 | -mocs-frame-position -moptimize-arg-area |
---|
350 | -mserialize-volatile -mshort-data-NUM -msvr3 |
---|
351 | -msvr4 -mtrap-large-shift -muse-div-instruction |
---|
352 | -mversion-03.00 -mwarn-passed-structs |
---|
353 | |
---|
354 | *RS/6000 and PowerPC Options* |
---|
355 | -mcpu=CPU TYPE |
---|
356 | -mtune=CPU TYPE |
---|
357 | -mpower -mno-power -mpower2 -mno-power2 |
---|
358 | -mpowerpc -mno-powerpc |
---|
359 | -mpowerpc-gpopt -mno-powerpc-gpopt |
---|
360 | -mpowerpc-gfxopt -mno-powerpc-gfxopt |
---|
361 | -mnew-mnemonics -mno-new-mnemonics |
---|
362 | -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc |
---|
363 | -mxl-call -mno-xl-call -mthreads -mpe |
---|
364 | -msoft-float -mhard-float -mmultiple -mno-multiple |
---|
365 | -mstring -mno-string -mupdate -mno-update |
---|
366 | -mfused-madd -mno-fused-madd -mbit-align -mno-bit-align |
---|
367 | -mstrict-align -mno-strict-align -mrelocatable |
---|
368 | -mno-relocatable -mrelocatable-lib -mno-relocatable-lib |
---|
369 | -mtoc -mno-toc -mtraceback -mno-traceback |
---|
370 | -mlittle -mlittle-endian -mbig -mbig-endian |
---|
371 | -mcall-aix -mcall-sysv -mprototype -mno-prototype |
---|
372 | -msim -mmvme -mads -myellowknife -memb |
---|
373 | -msdata -msdata=OPT -G NUM |
---|
374 | |
---|
375 | *RT Options* |
---|
376 | -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs |
---|
377 | -mfull-fp-blocks -mhc-struct-return -min-line-mul |
---|
378 | -mminimum-fp-blocks -mnohc-struct-return |
---|
379 | |
---|
380 | *MIPS Options* |
---|
381 | -mabicalls -mcpu=CPU TYPE -membedded-data |
---|
382 | -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 |
---|
383 | -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 |
---|
384 | -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy |
---|
385 | -mmips-as -mmips-tfile -mno-abicalls |
---|
386 | -mno-embedded-data -mno-embedded-pic |
---|
387 | -mno-gpopt -mno-long-calls |
---|
388 | -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats |
---|
389 | -mrnames -msoft-float |
---|
390 | -m4650 -msingle-float -mmad |
---|
391 | -mstats -EL -EB -G NUM -nocpp |
---|
392 | |
---|
393 | *i386 Options* |
---|
394 | -mcpu=CPU TYPE |
---|
395 | -march=CPU TYPE |
---|
396 | -mieee-fp -mno-fancy-math-387 |
---|
397 | -mno-fp-ret-in-387 -msoft-float -msvr3-shlib |
---|
398 | -mno-wide-multiply -mrtd -malign-double |
---|
399 | -mreg-alloc=LIST -mregparm=NUM |
---|
400 | -malign-jumps=NUM -malign-loops=NUM |
---|
401 | -malign-functions=NUM |
---|
402 | |
---|
403 | *HPPA Options* |
---|
404 | -mbig-switch -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls |
---|
405 | -mgas -mjump-in-delay -mlong-load-store -mno-big-switch -mno-disable-fpregs |
---|
406 | -mno-disable-indexing -mno-fast-indirect-calls -mno-gas |
---|
407 | -mno-jump-in-delay |
---|
408 | -mno-long-load-store |
---|
409 | -mno-portable-runtime -mno-soft-float -mno-space -mno-space-regs |
---|
410 | -msoft-float |
---|
411 | -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime |
---|
412 | -mschedule=LIST -mspace -mspace-regs |
---|
413 | |
---|
414 | *Intel 960 Options* |
---|
415 | -mCPU TYPE -masm-compat -mclean-linkage |
---|
416 | -mcode-align -mcomplex-addr -mleaf-procedures |
---|
417 | -mic-compat -mic2.0-compat -mic3.0-compat |
---|
418 | -mintel-asm -mno-clean-linkage -mno-code-align |
---|
419 | -mno-complex-addr -mno-leaf-procedures |
---|
420 | -mno-old-align -mno-strict-align -mno-tail-call |
---|
421 | -mnumerics -mold-align -msoft-float -mstrict-align |
---|
422 | -mtail-call |
---|
423 | |
---|
424 | *DEC Alpha Options* |
---|
425 | -mfp-regs -mno-fp-regs -mno-soft-float -msoft-float |
---|
426 | -malpha-as -mgas |
---|
427 | -mieee -mieee-with-inexact -mieee-conformant |
---|
428 | -mfp-trap-mode=MODE -mfp-rounding-mode=MODE |
---|
429 | -mtrap-precision=MODE -mbuild-constants |
---|
430 | -mcpu=CPU TYPE |
---|
431 | -mbwx -mno-bwx -mcix -mno-cix -mmax -mno-max |
---|
432 | |
---|
433 | *Clipper Options* |
---|
434 | -mc300 -mc400 |
---|
435 | |
---|
436 | *H8/300 Options* |
---|
437 | -mrelax -mh -ms -mint32 -malign-300 |
---|
438 | |
---|
439 | *SH Options* |
---|
440 | -m1 -m2 -m3 -m3e -mb -ml -mrelax |
---|
441 | |
---|
442 | *System V Options* |
---|
443 | -Qy -Qn -YP,PATHS -Ym,DIR |
---|
444 | |
---|
445 | *V850 Options* |
---|
446 | -mlong-calls -mno-long-calls -mep -mno-ep |
---|
447 | -mprolog-function -mno-prolog-function -mspace |
---|
448 | -mtda=N -msda=N -mzda=N |
---|
449 | -mv850 -mbig-switch |
---|
450 | |
---|
451 | *Code Generation Options* |
---|
452 | *Note Options for Code Generation Conventions: Code Gen Options. |
---|
453 | -fcall-saved-REG -fcall-used-REG |
---|
454 | -ffixed-REG -finhibit-size-directive |
---|
455 | -fcheck-memory-usage -fprefix-function-name |
---|
456 | -fno-common -fno-ident -fno-gnu-linker |
---|
457 | -fpcc-struct-return -freg-struct-return |
---|
458 | -fshared-data -fpic -fPIC -fexceptions |
---|
459 | -fshort-enums -fshort-double -fvolatile -fvolatile-global |
---|
460 | -fverbose-asm -fpack-struct -fstack-check +e0 +e1 |
---|
461 | |
---|
462 | * Menu: |
---|
463 | |
---|
464 | * Overall Options:: Controlling the kind of output: |
---|
465 | an executable, object files, assembler files, |
---|
466 | or preprocessed source. |
---|
467 | * C Dialect Options:: Controlling the variant of C language compiled. |
---|
468 | * C++ Dialect Options:: Variations on C++. |
---|
469 | * Warning Options:: How picky should the compiler be? |
---|
470 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. |
---|
471 | * Optimize Options:: How much optimization? |
---|
472 | * Preprocessor Options:: Controlling header files and macro definitions. |
---|
473 | Also, getting dependency information for Make. |
---|
474 | * Assembler Options:: Passing options to the assembler. |
---|
475 | * Link Options:: Specifying libraries and so on. |
---|
476 | * Directory Options:: Where to find header files and libraries. |
---|
477 | Where to find the compiler executable files. |
---|
478 | * Target Options:: Running a cross-compiler, or an old version of GNU CC. |
---|
479 | |
---|
480 | |
---|
481 | File: gcc.info, Node: Overall Options, Next: Invoking G++, Prev: Option Summary, Up: Invoking GCC |
---|
482 | |
---|
483 | Options Controlling the Kind of Output |
---|
484 | ====================================== |
---|
485 | |
---|
486 | Compilation can involve up to four stages: preprocessing, compilation |
---|
487 | proper, assembly and linking, always in that order. The first three |
---|
488 | stages apply to an individual source file, and end by producing an |
---|
489 | object file; linking combines all the object files (those newly |
---|
490 | compiled, and those specified as input) into an executable file. |
---|
491 | |
---|
492 | For any given input file, the file name suffix determines what kind |
---|
493 | of compilation is done: |
---|
494 | |
---|
495 | `FILE.c' |
---|
496 | C source code which must be preprocessed. |
---|
497 | |
---|
498 | `FILE.i' |
---|
499 | C source code which should not be preprocessed. |
---|
500 | |
---|
501 | `FILE.ii' |
---|
502 | C++ source code which should not be preprocessed. |
---|
503 | |
---|
504 | `FILE.m' |
---|
505 | Objective-C source code. Note that you must link with the library |
---|
506 | `libobjc.a' to make an Objective-C program work. |
---|
507 | |
---|
508 | `FILE.h' |
---|
509 | C header file (not to be compiled or linked). |
---|
510 | |
---|
511 | `FILE.cc' |
---|
512 | `FILE.cxx' |
---|
513 | `FILE.cpp' |
---|
514 | `FILE.C' |
---|
515 | C++ source code which must be preprocessed. Note that in `.cxx', |
---|
516 | the last two letters must both be literally `x'. Likewise, `.C' |
---|
517 | refers to a literal capital C. |
---|
518 | |
---|
519 | `FILE.s' |
---|
520 | Assembler code. |
---|
521 | |
---|
522 | `FILE.S' |
---|
523 | Assembler code which must be preprocessed. |
---|
524 | |
---|
525 | `OTHER' |
---|
526 | An object file to be fed straight into linking. Any file name |
---|
527 | with no recognized suffix is treated this way. |
---|
528 | |
---|
529 | You can specify the input language explicitly with the `-x' option: |
---|
530 | |
---|
531 | `-x LANGUAGE' |
---|
532 | Specify explicitly the LANGUAGE for the following input files |
---|
533 | (rather than letting the compiler choose a default based on the |
---|
534 | file name suffix). This option applies to all following input |
---|
535 | files until the next `-x' option. Possible values for LANGUAGE |
---|
536 | are: |
---|
537 | c objective-c c++ |
---|
538 | c-header cpp-output c++-cpp-output |
---|
539 | assembler assembler-with-cpp |
---|
540 | |
---|
541 | `-x none' |
---|
542 | Turn off any specification of a language, so that subsequent files |
---|
543 | are handled according to their file name suffixes (as they are if |
---|
544 | `-x' has not been used at all). |
---|
545 | |
---|
546 | If you only want some of the stages of compilation, you can use `-x' |
---|
547 | (or filename suffixes) to tell `gcc' where to start, and one of the |
---|
548 | options `-c', `-S', or `-E' to say where `gcc' is to stop. Note that |
---|
549 | some combinations (for example, `-x cpp-output -E' instruct `gcc' to do |
---|
550 | nothing at all. |
---|
551 | |
---|
552 | `-c' |
---|
553 | Compile or assemble the source files, but do not link. The linking |
---|
554 | stage simply is not done. The ultimate output is in the form of an |
---|
555 | object file for each source file. |
---|
556 | |
---|
557 | By default, the object file name for a source file is made by |
---|
558 | replacing the suffix `.c', `.i', `.s', etc., with `.o'. |
---|
559 | |
---|
560 | Unrecognized input files, not requiring compilation or assembly, |
---|
561 | are ignored. |
---|
562 | |
---|
563 | `-S' |
---|
564 | Stop after the stage of compilation proper; do not assemble. The |
---|
565 | output is in the form of an assembler code file for each |
---|
566 | non-assembler input file specified. |
---|
567 | |
---|
568 | By default, the assembler file name for a source file is made by |
---|
569 | replacing the suffix `.c', `.i', etc., with `.s'. |
---|
570 | |
---|
571 | Input files that don't require compilation are ignored. |
---|
572 | |
---|
573 | `-E' |
---|
574 | Stop after the preprocessing stage; do not run the compiler |
---|
575 | proper. The output is in the form of preprocessed source code, |
---|
576 | which is sent to the standard output. |
---|
577 | |
---|
578 | Input files which don't require preprocessing are ignored. |
---|
579 | |
---|
580 | `-o FILE' |
---|
581 | Place output in file FILE. This applies regardless to whatever |
---|
582 | sort of output is being produced, whether it be an executable file, |
---|
583 | an object file, an assembler file or preprocessed C code. |
---|
584 | |
---|
585 | Since only one output file can be specified, it does not make |
---|
586 | sense to use `-o' when compiling more than one input file, unless |
---|
587 | you are producing an executable file as output. |
---|
588 | |
---|
589 | If `-o' is not specified, the default is to put an executable file |
---|
590 | in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its |
---|
591 | assembler file in `SOURCE.s', and all preprocessed C source on |
---|
592 | standard output. |
---|
593 | |
---|
594 | `-v' |
---|
595 | Print (on standard error output) the commands executed to run the |
---|
596 | stages of compilation. Also print the version number of the |
---|
597 | compiler driver program and of the preprocessor and the compiler |
---|
598 | proper. |
---|
599 | |
---|
600 | `-pipe' |
---|
601 | Use pipes rather than temporary files for communication between the |
---|
602 | various stages of compilation. This fails to work on some systems |
---|
603 | where the assembler is unable to read from a pipe; but the GNU |
---|
604 | assembler has no trouble. |
---|
605 | |
---|
606 | |
---|
607 | File: gcc.info, Node: Invoking G++, Next: C Dialect Options, Prev: Overall Options, Up: Invoking GCC |
---|
608 | |
---|
609 | Compiling C++ Programs |
---|
610 | ====================== |
---|
611 | |
---|
612 | C++ source files conventionally use one of the suffixes `.C', `.cc', |
---|
613 | `cpp', or `.cxx'; preprocessed C++ files use the suffix `.ii'. GNU CC |
---|
614 | recognizes files with these names and compiles them as C++ programs |
---|
615 | even if you call the compiler the same way as for compiling C programs |
---|
616 | (usually with the name `gcc'). |
---|
617 | |
---|
618 | However, C++ programs often require class libraries as well as a |
---|
619 | compiler that understands the C++ language--and under some |
---|
620 | circumstances, you might want to compile programs from standard input, |
---|
621 | or otherwise without a suffix that flags them as C++ programs. `g++' |
---|
622 | is a program that calls GNU CC with the default language set to C++, |
---|
623 | and automatically specifies linking against the C++ library. (1) On |
---|
624 | many systems, the script `g++' is also installed with the name `c++'. |
---|
625 | |
---|
626 | When you compile C++ programs, you may specify many of the same |
---|
627 | command-line options that you use for compiling programs in any |
---|
628 | language; or command-line options meaningful for C and related |
---|
629 | languages; or options that are meaningful only for C++ programs. *Note |
---|
630 | Options Controlling C Dialect: C Dialect Options, for explanations of |
---|
631 | options for languages related to C. *Note Options Controlling C++ |
---|
632 | Dialect: C++ Dialect Options, for explanations of options that are |
---|
633 | meaningful only for C++ programs. |
---|
634 | |
---|
635 | ---------- Footnotes ---------- |
---|
636 | |
---|
637 | (1) Prior to release 2 of the compiler, there was a separate `g++' |
---|
638 | compiler. That version was based on GNU CC, but not integrated with |
---|
639 | it. Versions of `g++' with a `1.XX' version number--for example, `g++' |
---|
640 | version 1.37 or 1.42--are much less reliable than the versions |
---|
641 | integrated with GCC 2. Moreover, combining G++ `1.XX' with a version 2 |
---|
642 | GCC will simply not work. |
---|
643 | |
---|
644 | |
---|
645 | File: gcc.info, Node: C Dialect Options, Next: C++ Dialect Options, Prev: Invoking G++, Up: Invoking GCC |
---|
646 | |
---|
647 | Options Controlling C Dialect |
---|
648 | ============================= |
---|
649 | |
---|
650 | The following options control the dialect of C (or languages derived |
---|
651 | from C, such as C++ and Objective C) that the compiler accepts: |
---|
652 | |
---|
653 | `-ansi' |
---|
654 | Support all ANSI standard C programs. |
---|
655 | |
---|
656 | This turns off certain features of GNU C that are incompatible |
---|
657 | with ANSI C, such as the `asm', `inline' and `typeof' keywords, and |
---|
658 | predefined macros such as `unix' and `vax' that identify the type |
---|
659 | of system you are using. It also enables the undesirable and |
---|
660 | rarely used ANSI trigraph feature, and it disables recognition of |
---|
661 | C++ style `//' comments. |
---|
662 | |
---|
663 | The alternate keywords `__asm__', `__extension__', `__inline__' |
---|
664 | and `__typeof__' continue to work despite `-ansi'. You would not |
---|
665 | want to use them in an ANSI C program, of course, but it is useful |
---|
666 | to put them in header files that might be included in compilations |
---|
667 | done with `-ansi'. Alternate predefined macros such as `__unix__' |
---|
668 | and `__vax__' are also available, with or without `-ansi'. |
---|
669 | |
---|
670 | The `-ansi' option does not cause non-ANSI programs to be rejected |
---|
671 | gratuitously. For that, `-pedantic' is required in addition to |
---|
672 | `-ansi'. *Note Warning Options::. |
---|
673 | |
---|
674 | The macro `__STRICT_ANSI__' is predefined when the `-ansi' option |
---|
675 | is used. Some header files may notice this macro and refrain from |
---|
676 | declaring certain functions or defining certain macros that the |
---|
677 | ANSI standard doesn't call for; this is to avoid interfering with |
---|
678 | any programs that might use these names for other things. |
---|
679 | |
---|
680 | The functions `alloca', `abort', `exit', and `_exit' are not |
---|
681 | builtin functions when `-ansi' is used. |
---|
682 | |
---|
683 | `-fno-asm' |
---|
684 | Do not recognize `asm', `inline' or `typeof' as a keyword, so that |
---|
685 | code can use these words as identifiers. You can use the keywords |
---|
686 | `__asm__', `__inline__' and `__typeof__' instead. `-ansi' implies |
---|
687 | `-fno-asm'. |
---|
688 | |
---|
689 | In C++, this switch only affects the `typeof' keyword, since `asm' |
---|
690 | and `inline' are standard keywords. You may want to use the |
---|
691 | `-fno-gnu-keywords' flag instead, as it also disables the other, |
---|
692 | C++-specific, extension keywords such as `headof'. |
---|
693 | |
---|
694 | `-fno-builtin' |
---|
695 | Don't recognize builtin functions that do not begin with two |
---|
696 | leading underscores. Currently, the functions affected include |
---|
697 | `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs', |
---|
698 | `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and |
---|
699 | `strlen'. |
---|
700 | |
---|
701 | GCC normally generates special code to handle certain builtin |
---|
702 | functions more efficiently; for instance, calls to `alloca' may |
---|
703 | become single instructions that adjust the stack directly, and |
---|
704 | calls to `memcpy' may become inline copy loops. The resulting |
---|
705 | code is often both smaller and faster, but since the function |
---|
706 | calls no longer appear as such, you cannot set a breakpoint on |
---|
707 | those calls, nor can you change the behavior of the functions by |
---|
708 | linking with a different library. |
---|
709 | |
---|
710 | The `-ansi' option prevents `alloca' and `ffs' from being builtin |
---|
711 | functions, since these functions do not have an ANSI standard |
---|
712 | meaning. |
---|
713 | |
---|
714 | `-fhosted' |
---|
715 | Assert that compilation takes place in a hosted environment. This |
---|
716 | implies `-fbuiltin'. A hosted environment is one in which the |
---|
717 | entire standard library is available, and in which `main' has a |
---|
718 | return type of `int'. Examples are nearly everything except a |
---|
719 | kernel. This is equivalent to `-fno-freestanding'. |
---|
720 | |
---|
721 | `-ffreestanding' |
---|
722 | Assert that compilation takes place in a freestanding environment. |
---|
723 | This implies `-fno-builtin'. A freestanding environment is one |
---|
724 | in which the standard library may not exist, and program startup |
---|
725 | may not necessarily be at `main'. The most obvious example is an |
---|
726 | OS kernel. This is equivalent to `-fno-hosted'. |
---|
727 | |
---|
728 | `-trigraphs' |
---|
729 | Support ANSI C trigraphs. You don't want to know about this |
---|
730 | brain-damage. The `-ansi' option implies `-trigraphs'. |
---|
731 | |
---|
732 | `-traditional' |
---|
733 | Attempt to support some aspects of traditional C compilers. |
---|
734 | Specifically: |
---|
735 | |
---|
736 | * All `extern' declarations take effect globally even if they |
---|
737 | are written inside of a function definition. This includes |
---|
738 | implicit declarations of functions. |
---|
739 | |
---|
740 | * The newer keywords `typeof', `inline', `signed', `const' and |
---|
741 | `volatile' are not recognized. (You can still use the |
---|
742 | alternative keywords such as `__typeof__', `__inline__', and |
---|
743 | so on.) |
---|
744 | |
---|
745 | * Comparisons between pointers and integers are always allowed. |
---|
746 | |
---|
747 | * Integer types `unsigned short' and `unsigned char' promote to |
---|
748 | `unsigned int'. |
---|
749 | |
---|
750 | * Out-of-range floating point literals are not an error. |
---|
751 | |
---|
752 | * Certain constructs which ANSI regards as a single invalid |
---|
753 | preprocessing number, such as `0xe-0xd', are treated as |
---|
754 | expressions instead. |
---|
755 | |
---|
756 | * String "constants" are not necessarily constant; they are |
---|
757 | stored in writable space, and identical looking constants are |
---|
758 | allocated separately. (This is the same as the effect of |
---|
759 | `-fwritable-strings'.) |
---|
760 | |
---|
761 | * All automatic variables not declared `register' are preserved |
---|
762 | by `longjmp'. Ordinarily, GNU C follows ANSI C: automatic |
---|
763 | variables not declared `volatile' may be clobbered. |
---|
764 | |
---|
765 | * The character escape sequences `\x' and `\a' evaluate as the |
---|
766 | literal characters `x' and `a' respectively. Without |
---|
767 | `-traditional', `\x' is a prefix for the hexadecimal |
---|
768 | representation of a character, and `\a' produces a bell. |
---|
769 | |
---|
770 | * In C++ programs, assignment to `this' is permitted with |
---|
771 | `-traditional'. (The option `-fthis-is-variable' also has |
---|
772 | this effect.) |
---|
773 | |
---|
774 | You may wish to use `-fno-builtin' as well as `-traditional' if |
---|
775 | your program uses names that are normally GNU C builtin functions |
---|
776 | for other purposes of its own. |
---|
777 | |
---|
778 | You cannot use `-traditional' if you include any header files that |
---|
779 | rely on ANSI C features. Some vendors are starting to ship |
---|
780 | systems with ANSI C header files and you cannot use `-traditional' |
---|
781 | on such systems to compile files that include any system headers. |
---|
782 | |
---|
783 | The `-traditional' option also enables the `-traditional-cpp' |
---|
784 | option, which is described next. |
---|
785 | |
---|
786 | `-traditional-cpp' |
---|
787 | Attempt to support some aspects of traditional C preprocessors. |
---|
788 | Specifically: |
---|
789 | |
---|
790 | * Comments convert to nothing at all, rather than to a space. |
---|
791 | This allows traditional token concatenation. |
---|
792 | |
---|
793 | * In a preprocessing directive, the `#' symbol must appear as |
---|
794 | the first character of a line. |
---|
795 | |
---|
796 | * Macro arguments are recognized within string constants in a |
---|
797 | macro definition (and their values are stringified, though |
---|
798 | without additional quote marks, when they appear in such a |
---|
799 | context). The preprocessor always considers a string |
---|
800 | constant to end at a newline. |
---|
801 | |
---|
802 | * The predefined macro `__STDC__' is not defined when you use |
---|
803 | `-traditional', but `__GNUC__' is (since the GNU extensions |
---|
804 | which `__GNUC__' indicates are not affected by |
---|
805 | `-traditional'). If you need to write header files that work |
---|
806 | differently depending on whether `-traditional' is in use, by |
---|
807 | testing both of these predefined macros you can distinguish |
---|
808 | four situations: GNU C, traditional GNU C, other ANSI C |
---|
809 | compilers, and other old C compilers. The predefined macro |
---|
810 | `__STDC_VERSION__' is also not defined when you use |
---|
811 | `-traditional'. *Note Standard Predefined Macros: |
---|
812 | (cpp.info)Standard Predefined, for more discussion of these |
---|
813 | and other predefined macros. |
---|
814 | |
---|
815 | * The preprocessor considers a string constant to end at a |
---|
816 | newline (unless the newline is escaped with `\'). (Without |
---|
817 | `-traditional', string constants can contain the newline |
---|
818 | character as typed.) |
---|
819 | |
---|
820 | `-fcond-mismatch' |
---|
821 | Allow conditional expressions with mismatched types in the second |
---|
822 | and third arguments. The value of such an expression is void. |
---|
823 | |
---|
824 | `-funsigned-char' |
---|
825 | Let the type `char' be unsigned, like `unsigned char'. |
---|
826 | |
---|
827 | Each kind of machine has a default for what `char' should be. It |
---|
828 | is either like `unsigned char' by default or like `signed char' by |
---|
829 | default. |
---|
830 | |
---|
831 | Ideally, a portable program should always use `signed char' or |
---|
832 | `unsigned char' when it depends on the signedness of an object. |
---|
833 | But many programs have been written to use plain `char' and expect |
---|
834 | it to be signed, or expect it to be unsigned, depending on the |
---|
835 | machines they were written for. This option, and its inverse, let |
---|
836 | you make such a program work with the opposite default. |
---|
837 | |
---|
838 | The type `char' is always a distinct type from each of `signed |
---|
839 | char' or `unsigned char', even though its behavior is always just |
---|
840 | like one of those two. |
---|
841 | |
---|
842 | `-fsigned-char' |
---|
843 | Let the type `char' be signed, like `signed char'. |
---|
844 | |
---|
845 | Note that this is equivalent to `-fno-unsigned-char', which is the |
---|
846 | negative form of `-funsigned-char'. Likewise, the option |
---|
847 | `-fno-signed-char' is equivalent to `-funsigned-char'. |
---|
848 | |
---|
849 | You may wish to use `-fno-builtin' as well as `-traditional' if |
---|
850 | your program uses names that are normally GNU C builtin functions |
---|
851 | for other purposes of its own. |
---|
852 | |
---|
853 | You cannot use `-traditional' if you include any header files that |
---|
854 | rely on ANSI C features. Some vendors are starting to ship |
---|
855 | systems with ANSI C header files and you cannot use `-traditional' |
---|
856 | on such systems to compile files that include any system headers. |
---|
857 | |
---|
858 | `-fsigned-bitfields' |
---|
859 | `-funsigned-bitfields' |
---|
860 | `-fno-signed-bitfields' |
---|
861 | `-fno-unsigned-bitfields' |
---|
862 | These options control whether a bitfield is signed or unsigned, |
---|
863 | when the declaration does not use either `signed' or `unsigned'. |
---|
864 | By default, such a bitfield is signed, because this is consistent: |
---|
865 | the basic integer types such as `int' are signed types. |
---|
866 | |
---|
867 | However, when `-traditional' is used, bitfields are all unsigned |
---|
868 | no matter what. |
---|
869 | |
---|
870 | `-fwritable-strings' |
---|
871 | Store string constants in the writable data segment and don't |
---|
872 | uniquize them. This is for compatibility with old programs which |
---|
873 | assume they can write into string constants. The option |
---|
874 | `-traditional' also has this effect. |
---|
875 | |
---|
876 | Writing into string constants is a very bad idea; "constants" |
---|
877 | should be constant. |
---|
878 | |
---|
879 | `-fallow-single-precision' |
---|
880 | Do not promote single precision math operations to double |
---|
881 | precision, even when compiling with `-traditional'. |
---|
882 | |
---|
883 | Traditional K&R C promotes all floating point operations to double |
---|
884 | precision, regardless of the sizes of the operands. On the |
---|
885 | architecture for which you are compiling, single precision may be |
---|
886 | faster than double precision. If you must use `-traditional', |
---|
887 | but want to use single precision operations when the operands are |
---|
888 | single precision, use this option. This option has no effect |
---|
889 | when compiling with ANSI or GNU C conventions (the default). |
---|
890 | |
---|
891 | |
---|
892 | File: gcc.info, Node: C++ Dialect Options, Next: Warning Options, Prev: C Dialect Options, Up: Invoking GCC |
---|
893 | |
---|
894 | Options Controlling C++ Dialect |
---|
895 | =============================== |
---|
896 | |
---|
897 | This section describes the command-line options that are only |
---|
898 | meaningful for C++ programs; but you can also use most of the GNU |
---|
899 | compiler options regardless of what language your program is in. For |
---|
900 | example, you might compile a file `firstClass.C' like this: |
---|
901 | |
---|
902 | g++ -g -felide-constructors -O -c firstClass.C |
---|
903 | |
---|
904 | In this example, only `-felide-constructors' is an option meant only |
---|
905 | for C++ programs; you can use the other options with any language |
---|
906 | supported by GNU CC. |
---|
907 | |
---|
908 | Here is a list of options that are *only* for compiling C++ programs: |
---|
909 | |
---|
910 | `-fno-access-control' |
---|
911 | Turn off all access checking. This switch is mainly useful for |
---|
912 | working around bugs in the access control code. |
---|
913 | |
---|
914 | `-fall-virtual' |
---|
915 | Treat all possible member functions as virtual, implicitly. All |
---|
916 | member functions (except for constructor functions and `new' or |
---|
917 | `delete' member operators) are treated as virtual functions of the |
---|
918 | class where they appear. |
---|
919 | |
---|
920 | This does not mean that all calls to these member functions will |
---|
921 | be made through the internal table of virtual functions. Under |
---|
922 | some circumstances, the compiler can determine that a call to a |
---|
923 | given virtual function can be made directly; in these cases the |
---|
924 | calls are direct in any case. |
---|
925 | |
---|
926 | `-fcheck-new' |
---|
927 | Check that the pointer returned by `operator new' is non-null |
---|
928 | before attempting to modify the storage allocated. The current |
---|
929 | Working Paper requires that `operator new' never return a null |
---|
930 | pointer, so this check is normally unnecessary. |
---|
931 | |
---|
932 | `-fconserve-space' |
---|
933 | Put uninitialized or runtime-initialized global variables into the |
---|
934 | common segment, as C does. This saves space in the executable at |
---|
935 | the cost of not diagnosing duplicate definitions. If you compile |
---|
936 | with this flag and your program mysteriously crashes after |
---|
937 | `main()' has completed, you may have an object that is being |
---|
938 | destroyed twice because two definitions were merged. |
---|
939 | |
---|
940 | `-fdollars-in-identifiers' |
---|
941 | Accept `$' in identifiers. You can also explicitly prohibit use of |
---|
942 | `$' with the option `-fno-dollars-in-identifiers'. (GNU C allows |
---|
943 | `$' by default on most target systems, but there are a few |
---|
944 | exceptions.) Traditional C allowed the character `$' to form part |
---|
945 | of identifiers. However, ANSI C and C++ forbid `$' in identifiers. |
---|
946 | |
---|
947 | `-fenum-int-equiv' |
---|
948 | Anachronistically permit implicit conversion of `int' to |
---|
949 | enumeration types. Current C++ allows conversion of `enum' to |
---|
950 | `int', but not the other way around. |
---|
951 | |
---|
952 | `-fexternal-templates' |
---|
953 | Cause template instantiations to obey `#pragma interface' and |
---|
954 | `implementation'; template instances are emitted or not according |
---|
955 | to the location of the template definition. *Note Template |
---|
956 | Instantiation::, for more information. |
---|
957 | |
---|
958 | This option is deprecated. |
---|
959 | |
---|
960 | `-falt-external-templates' |
---|
961 | Similar to -fexternal-templates, but template instances are |
---|
962 | emitted or not according to the place where they are first |
---|
963 | instantiated. *Note Template Instantiation::, for more |
---|
964 | information. |
---|
965 | |
---|
966 | This option is deprecated. |
---|
967 | |
---|
968 | `-ffor-scope' |
---|
969 | `-fno-for-scope' |
---|
970 | If -ffor-scope is specified, the scope of variables declared in a |
---|
971 | for-init-statement is limited to the `for' loop itself, as |
---|
972 | specified by the draft C++ standard. If -fno-for-scope is |
---|
973 | specified, the scope of variables declared in a for-init-statement |
---|
974 | extends to the end of the enclosing scope, as was the case in old |
---|
975 | versions of gcc, and other (traditional) implementations of C++. |
---|
976 | |
---|
977 | The default if neither flag is given to follow the standard, but |
---|
978 | to allow and give a warning for old-style code that would |
---|
979 | otherwise be invalid, or have different behavior. |
---|
980 | |
---|
981 | `-fno-gnu-keywords' |
---|
982 | Do not recognize `classof', `headof', `signature', `sigof' or |
---|
983 | `typeof' as a keyword, so that code can use these words as |
---|
984 | identifiers. You can use the keywords `__classof__', |
---|
985 | `__headof__', `__signature__', `__sigof__', and `__typeof__' |
---|
986 | instead. `-ansi' implies `-fno-gnu-keywords'. |
---|
987 | |
---|
988 | `-fguiding-decls' |
---|
989 | Treat a function declaration with the same type as a potential |
---|
990 | function template instantiation as though it declares that |
---|
991 | instantiation, not a normal function. If a definition is given |
---|
992 | for the function later in the translation unit (or another |
---|
993 | translation unit if the target supports weak symbols), that |
---|
994 | definition will be used; otherwise the template will be |
---|
995 | instantiated. This behavior reflects the C++ language prior to |
---|
996 | September 1996, when guiding declarations were removed. |
---|
997 | |
---|
998 | This option implies `-fname-mangling-version-0', and will not work |
---|
999 | with other name mangling versions. |
---|
1000 | |
---|
1001 | `-fno-implicit-templates' |
---|
1002 | Never emit code for templates which are instantiated implicitly |
---|
1003 | (i.e. by use); only emit code for explicit instantiations. *Note |
---|
1004 | Template Instantiation::, for more information. |
---|
1005 | |
---|
1006 | `-fhandle-signatures' |
---|
1007 | Recognize the `signature' and `sigof' keywords for specifying |
---|
1008 | abstract types. The default (`-fno-handle-signatures') is not to |
---|
1009 | recognize them. *Note Type Abstraction using Signatures: C++ |
---|
1010 | Signatures. |
---|
1011 | |
---|
1012 | `-fhuge-objects' |
---|
1013 | Support virtual function calls for objects that exceed the size |
---|
1014 | representable by a `short int'. Users should not use this flag by |
---|
1015 | default; if you need to use it, the compiler will tell you so. If |
---|
1016 | you compile any of your code with this flag, you must compile |
---|
1017 | *all* of your code with this flag (including the C++ library, if |
---|
1018 | you use it). |
---|
1019 | |
---|
1020 | This flag is not useful when compiling with -fvtable-thunks. |
---|
1021 | |
---|
1022 | `-fno-implement-inlines' |
---|
1023 | To save space, do not emit out-of-line copies of inline functions |
---|
1024 | controlled by `#pragma implementation'. This will cause linker |
---|
1025 | errors if these functions are not inlined everywhere they are |
---|
1026 | called. |
---|
1027 | |
---|
1028 | `-fmemoize-lookups' |
---|
1029 | `-fsave-memoized' |
---|
1030 | Use heuristics to compile faster. These heuristics are not |
---|
1031 | enabled by default, since they are only effective for certain |
---|
1032 | input files. Other input files compile more slowly. |
---|
1033 | |
---|
1034 | The first time the compiler must build a call to a member function |
---|
1035 | (or reference to a data member), it must (1) determine whether the |
---|
1036 | class implements member functions of that name; (2) resolve which |
---|
1037 | member function to call (which involves figuring out what sorts of |
---|
1038 | type conversions need to be made); and (3) check the visibility of |
---|
1039 | the member function to the caller. All of this adds up to slower |
---|
1040 | compilation. Normally, the second time a call is made to that |
---|
1041 | member function (or reference to that data member), it must go |
---|
1042 | through the same lengthy process again. This means that code like |
---|
1043 | this: |
---|
1044 | |
---|
1045 | cout << "This " << p << " has " << n << " legs.\n"; |
---|
1046 | |
---|
1047 | makes six passes through all three steps. By using a software |
---|
1048 | cache, a "hit" significantly reduces this cost. Unfortunately, |
---|
1049 | using the cache introduces another layer of mechanisms which must |
---|
1050 | be implemented, and so incurs its own overhead. |
---|
1051 | `-fmemoize-lookups' enables the software cache. |
---|
1052 | |
---|
1053 | Because access privileges (visibility) to members and member |
---|
1054 | functions may differ from one function context to the next, G++ |
---|
1055 | may need to flush the cache. With the `-fmemoize-lookups' flag, |
---|
1056 | the cache is flushed after every function that is compiled. The |
---|
1057 | `-fsave-memoized' flag enables the same software cache, but when |
---|
1058 | the compiler determines that the context of the last function |
---|
1059 | compiled would yield the same access privileges of the next |
---|
1060 | function to compile, it preserves the cache. This is most helpful |
---|
1061 | when defining many member functions for the same class: with the |
---|
1062 | exception of member functions which are friends of other classes, |
---|
1063 | each member function has exactly the same access privileges as |
---|
1064 | every other, and the cache need not be flushed. |
---|
1065 | |
---|
1066 | The code that implements these flags has rotted; you should |
---|
1067 | probably avoid using them. |
---|
1068 | |
---|
1069 | `-fstrict-prototype' |
---|
1070 | Within an `extern "C"' linkage specification, treat a function |
---|
1071 | declaration with no arguments, such as `int foo ();', as declaring |
---|
1072 | the function to take no arguments. Normally, such a declaration |
---|
1073 | means that the function `foo' can take any combination of |
---|
1074 | arguments, as in C. `-pedantic' implies `-fstrict-prototype' |
---|
1075 | unless overridden with `-fno-strict-prototype'. |
---|
1076 | |
---|
1077 | This flag no longer affects declarations with C++ linkage. |
---|
1078 | |
---|
1079 | `-fname-mangling-version-N' |
---|
1080 | Control the way in which names are mangled. Version 0 is |
---|
1081 | compatible with versions of g++ before 2.8. Version 1 is the |
---|
1082 | default. Version 1 will allow correct mangling of function |
---|
1083 | templates. For example, version 0 mangling does not mangle |
---|
1084 | foo<int, double> and foo<int, char> given this declaration: |
---|
1085 | |
---|
1086 | template <class T, class U> void foo(T t); |
---|
1087 | |
---|
1088 | `-fno-nonnull-objects' |
---|
1089 | Don't assume that a reference is initialized to refer to a valid |
---|
1090 | object. Although the current C++ Working Paper prohibits null |
---|
1091 | references, some old code may rely on them, and you can use |
---|
1092 | `-fno-nonnull-objects' to turn on checking. |
---|
1093 | |
---|
1094 | At the moment, the compiler only does this checking for |
---|
1095 | conversions to virtual base classes. |
---|
1096 | |
---|
1097 | `-foperator-names' |
---|
1098 | Recognize the operator name keywords `and', `bitand', `bitor', |
---|
1099 | `compl', `not', `or' and `xor' as synonyms for the symbols they |
---|
1100 | refer to. `-ansi' implies `-foperator-names'. |
---|
1101 | |
---|
1102 | `-fthis-is-variable' |
---|
1103 | Permit assignment to `this'. The incorporation of user-defined |
---|
1104 | free store management into C++ has made assignment to `this' an |
---|
1105 | anachronism. Therefore, by default it is invalid to assign to |
---|
1106 | `this' within a class member function; that is, GNU C++ treats |
---|
1107 | `this' in a member function of class `X' as a non-lvalue of type |
---|
1108 | `X *'. However, for backwards compatibility, you can make it |
---|
1109 | valid with `-fthis-is-variable'. |
---|
1110 | |
---|
1111 | `-fvtable-thunks' |
---|
1112 | Use `thunks' to implement the virtual function dispatch table |
---|
1113 | (`vtable'). The traditional (cfront-style) approach to |
---|
1114 | implementing vtables was to store a pointer to the function and two |
---|
1115 | offsets for adjusting the `this' pointer at the call site. Newer |
---|
1116 | implementations store a single pointer to a `thunk' function which |
---|
1117 | does any necessary adjustment and then calls the target function. |
---|
1118 | |
---|
1119 | This option also enables a heuristic for controlling emission of |
---|
1120 | vtables; if a class has any non-inline virtual functions, the |
---|
1121 | vtable will be emitted in the translation unit containing the |
---|
1122 | first one of those. |
---|
1123 | |
---|
1124 | `-ftemplate-depth-N' |
---|
1125 | Set the maximum instantiation depth for template classes to N. A |
---|
1126 | limit on the template instantiation depth is needed to detect |
---|
1127 | endless recursions during template class instantiation. ANSI/ISO |
---|
1128 | C++ conforming programs must not rely on a maximum depth greater |
---|
1129 | than 17. |
---|
1130 | |
---|
1131 | `-nostdinc++' |
---|
1132 | Do not search for header files in the standard directories |
---|
1133 | specific to C++, but do still search the other standard |
---|
1134 | directories. (This option is used when building the C++ library.) |
---|
1135 | |
---|
1136 | `-traditional' |
---|
1137 | For C++ programs (in addition to the effects that apply to both C |
---|
1138 | and C++), this has the same effect as `-fthis-is-variable'. *Note |
---|
1139 | Options Controlling C Dialect: C Dialect Options. |
---|
1140 | |
---|
1141 | In addition, these optimization, warning, and code generation options |
---|
1142 | have meanings only for C++ programs: |
---|
1143 | |
---|
1144 | `-fno-default-inline' |
---|
1145 | Do not assume `inline' for functions defined inside a class scope. |
---|
1146 | *Note Options That Control Optimization: Optimize Options. |
---|
1147 | |
---|
1148 | `-Wold-style-cast' |
---|
1149 | `-Woverloaded-virtual' |
---|
1150 | `-Wtemplate-debugging' |
---|
1151 | Warnings that apply only to C++ programs. *Note Options to |
---|
1152 | Request or Suppress Warnings: Warning Options. |
---|
1153 | |
---|
1154 | `-Weffc++' |
---|
1155 | Warn about violation of some style rules from Effective C++ by |
---|
1156 | Scott Myers. |
---|
1157 | |
---|
1158 | `+eN' |
---|
1159 | Control how virtual function definitions are used, in a fashion |
---|
1160 | compatible with `cfront' 1.x. *Note Options for Code Generation |
---|
1161 | Conventions: Code Gen Options. |
---|
1162 | |
---|