[8833] | 1 | This is Info file gcc.info, produced by Makeinfo-1.55 from the input |
---|
| 2 | 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 Free Software |
---|
| 10 | 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: Option Summary, Next: Overall Options, Up: Invoking GCC |
---|
| 34 | |
---|
| 35 | Option Summary |
---|
| 36 | ============== |
---|
| 37 | |
---|
| 38 | Here is a summary of all the options, grouped by type. Explanations |
---|
| 39 | are in the following sections. |
---|
| 40 | |
---|
| 41 | *Overall Options* |
---|
| 42 | *Note Options Controlling the Kind of Output: Overall Options. |
---|
| 43 | -c -S -E -o FILE -pipe -v -x LANGUAGE |
---|
| 44 | |
---|
| 45 | *C Language Options* |
---|
| 46 | *Note Options Controlling C Dialect: C Dialect Options. |
---|
| 47 | -ansi -fallow-single-precision -fcond-mismatch -fno-asm |
---|
| 48 | -fno-builtin -fsigned-bitfields -fsigned-char |
---|
| 49 | -funsigned-bitfields -funsigned-char -fwritable-strings |
---|
| 50 | -traditional -traditional-cpp -trigraphs |
---|
| 51 | |
---|
| 52 | *C++ Language Options* |
---|
| 53 | *Note Options Controlling C++ Dialect: C++ Dialect Options. |
---|
| 54 | -fall-virtual -fdollars-in-identifiers -felide-constructors |
---|
| 55 | -fenum-int-equiv -fexternal-templates -ffor-scope -fno-for-scope |
---|
| 56 | -fhandle-signatures -fmemoize-lookups -fno-default-inline -fno-gnu-keywords |
---|
| 57 | -fnonnull-objects -foperator-names -fstrict-prototype |
---|
| 58 | -fthis-is-variable -nostdinc++ -traditional +eN |
---|
| 59 | |
---|
| 60 | *Warning Options* |
---|
| 61 | *Note Options to Request or Suppress Warnings: Warning Options. |
---|
| 62 | -fsyntax-only -pedantic -pedantic-errors |
---|
| 63 | -w -W -Wall -Waggregate-return -Wbad-function-cast |
---|
| 64 | -Wcast-align -Wcast-qual -Wchar-subscript -Wcomment |
---|
| 65 | -Wconversion -Wenum-clash -Werror -Wformat |
---|
| 66 | -Wid-clash-LEN -Wimplicit -Wimport -Winline |
---|
| 67 | -Wlarger-than-LEN -Wmissing-declarations |
---|
| 68 | -Wmissing-prototypes -Wnested-externs |
---|
| 69 | -Wno-import -Woverloaded-virtual -Wparentheses |
---|
| 70 | -Wpointer-arith -Wredundant-decls -Wreorder -Wreturn-type -Wshadow |
---|
| 71 | -Wstrict-prototypes -Wswitch -Wsynth -Wtemplate-debugging |
---|
| 72 | -Wtraditional -Wtrigraphs -Wuninitialized -Wunused |
---|
| 73 | -Wwrite-strings |
---|
| 74 | |
---|
| 75 | *Debugging Options* |
---|
| 76 | *Note Options for Debugging Your Program or GCC: Debugging Options. |
---|
| 77 | -a -dLETTERS -fpretend-float |
---|
| 78 | -g -gLEVEL -gcoff -gdwarf -gdwarf+ |
---|
| 79 | -ggdb -gstabs -gstabs+ -gxcoff -gxcoff+ |
---|
| 80 | -p -pg -print-file-name=LIBRARY -print-libgcc-file-name |
---|
| 81 | -print-prog-name=PROGRAM -print-search-dirs -save-temps |
---|
| 82 | |
---|
| 83 | *Optimization Options* |
---|
| 84 | *Note Options that Control Optimization: Optimize Options. |
---|
| 85 | -fcaller-saves -fcse-follow-jumps -fcse-skip-blocks |
---|
| 86 | -fdelayed-branch -fexpensive-optimizations |
---|
| 87 | -ffast-math -ffloat-store -fforce-addr -fforce-mem |
---|
| 88 | -finline-functions -fkeep-inline-functions |
---|
| 89 | -fno-default-inline -fno-defer-pop -fno-function-cse |
---|
| 90 | -fno-inline -fno-peephole -fomit-frame-pointer |
---|
| 91 | -frerun-cse-after-loop -fschedule-insns |
---|
| 92 | -fschedule-insns2 -fstrength-reduce -fthread-jumps |
---|
| 93 | -funroll-all-loops -funroll-loops |
---|
| 94 | -O -O0 -O1 -O2 -O3 |
---|
| 95 | |
---|
| 96 | *Preprocessor Options* |
---|
| 97 | *Note Options Controlling the Preprocessor: Preprocessor Options. |
---|
| 98 | -AQUESTION(ANSWER) -C -dD -dM -dN |
---|
| 99 | -DMACRO[=DEFN] -E -H |
---|
| 100 | -idirafter DIR |
---|
| 101 | -include FILE -imacros FILE |
---|
| 102 | -iprefix FILE -iwithprefix DIR |
---|
| 103 | -iwithprefixbefore DIR -isystem DIR |
---|
| 104 | -M -MD -MM -MMD -MG -nostdinc -P -trigraphs |
---|
| 105 | -undef -UMACRO -Wp,OPTION |
---|
| 106 | |
---|
| 107 | *Assembler Option* |
---|
| 108 | *Note Passing Options to the Assembler: Assembler Options. |
---|
| 109 | -Wa,OPTION |
---|
| 110 | |
---|
| 111 | *Linker Options* |
---|
| 112 | *Note Options for Linking: Link Options. |
---|
| 113 | OBJECT-FILE-NAME -lLIBRARY |
---|
| 114 | -nostartfiles -nodefaultlibs -nostdlib |
---|
| 115 | -s -static -shared -symbolic |
---|
| 116 | -Wl,OPTION -Xlinker OPTION |
---|
| 117 | -u SYMBOL |
---|
| 118 | |
---|
| 119 | *Directory Options* |
---|
| 120 | *Note Options for Directory Search: Directory Options. |
---|
| 121 | -BPREFIX -IDIR -I- -LDIR |
---|
| 122 | |
---|
| 123 | *Target Options* |
---|
| 124 | *Note Target Options::. |
---|
| 125 | -b MACHINE -V VERSION |
---|
| 126 | |
---|
| 127 | *Machine Dependent Options* |
---|
| 128 | *Note Hardware Models and Configurations: Submodel Options. |
---|
| 129 | *M680x0 Options* |
---|
| 130 | -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881 |
---|
| 131 | -mbitfield -mc68000 -mc68020 -mfpa -mnobitfield |
---|
| 132 | -mrtd -mshort -msoft-float |
---|
| 133 | |
---|
| 134 | *VAX Options* |
---|
| 135 | -mg -mgnu -munix |
---|
| 136 | |
---|
| 137 | *SPARC Options* |
---|
| 138 | -mapp-regs -mcypress -mepilogue -mflat -mfpu -mhard-float |
---|
| 139 | -mhard-quad-float -mno-app-regs -mno-flat -mno-fpu |
---|
| 140 | -mno-epilogue -mno-unaligned-doubles |
---|
| 141 | -msoft-float -msoft-quad-float |
---|
| 142 | -msparclite -msupersparc -munaligned-doubles -mv8 |
---|
| 143 | |
---|
| 144 | SPARC V9 compilers support the following options |
---|
| 145 | in addition to the above: |
---|
| 146 | |
---|
| 147 | -mmedlow -mmedany |
---|
| 148 | -mint32 -mint64 -mlong32 -mlong64 |
---|
| 149 | -mno-stack-bias -mstack-bias |
---|
| 150 | |
---|
| 151 | *Convex Options* |
---|
| 152 | -mc1 -mc2 -mc32 -mc34 -mc38 |
---|
| 153 | -margcount -mnoargcount |
---|
| 154 | -mlong32 -mlong64 |
---|
| 155 | -mvolatile-cache -mvolatile-nocache |
---|
| 156 | |
---|
| 157 | *AMD29K Options* |
---|
| 158 | -m29000 -m29050 -mbw -mnbw -mdw -mndw |
---|
| 159 | -mlarge -mnormal -msmall |
---|
| 160 | -mkernel-registers -mno-reuse-arg-regs |
---|
| 161 | -mno-stack-check -mno-storem-bug |
---|
| 162 | -mreuse-arg-regs -msoft-float -mstack-check |
---|
| 163 | -mstorem-bug -muser-registers |
---|
| 164 | |
---|
| 165 | *ARM Options* |
---|
| 166 | -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename |
---|
| 167 | |
---|
| 168 | *M88K Options* |
---|
| 169 | -m88000 -m88100 -m88110 -mbig-pic |
---|
| 170 | -mcheck-zero-division -mhandle-large-shift |
---|
| 171 | -midentify-revision -mno-check-zero-division |
---|
| 172 | -mno-ocs-debug-info -mno-ocs-frame-position |
---|
| 173 | -mno-optimize-arg-area -mno-serialize-volatile |
---|
| 174 | -mno-underscores -mocs-debug-info |
---|
| 175 | -mocs-frame-position -moptimize-arg-area |
---|
| 176 | -mserialize-volatile -mshort-data-NUM -msvr3 |
---|
| 177 | -msvr4 -mtrap-large-shift -muse-div-instruction |
---|
| 178 | -mversion-03.00 -mwarn-passed-structs |
---|
| 179 | |
---|
| 180 | *RS/6000 and PowerPC Options* |
---|
| 181 | -mcpu=CPU TYPE |
---|
| 182 | -mpower -mno-power -mpower2 -mno-power2 |
---|
| 183 | -mpowerpc -mno-powerpc |
---|
| 184 | -mpowerpc-gpopt -mno-powerpc-gpopt |
---|
| 185 | -mpowerpc-gfxopt -mno-powerpc-gfxopt |
---|
| 186 | -mnew-mnemonics -mno-new-mnemonics |
---|
| 187 | -mfull-toc -mminimal-toc -mno-fop-in-toc -mno-sum-in-toc |
---|
| 188 | -msoft-float -mhard-float -mmultiple -mno-multiple |
---|
| 189 | -mstring -mno-string -mbit-align -mno-bit-align |
---|
| 190 | -mstrict-align -mno-strict-align -mrelocatable -mno-relocatable |
---|
| 191 | -mtoc -mno-toc -mtraceback -mno-traceback |
---|
| 192 | -mlittle -mlittle-endian -mbig -mbig-endian |
---|
| 193 | -mcall-aix -mcall-sysv -mprototype |
---|
| 194 | |
---|
| 195 | *RT Options* |
---|
| 196 | -mcall-lib-mul -mfp-arg-in-fpregs -mfp-arg-in-gregs |
---|
| 197 | -mfull-fp-blocks -mhc-struct-return -min-line-mul |
---|
| 198 | -mminimum-fp-blocks -mnohc-struct-return |
---|
| 199 | |
---|
| 200 | *MIPS Options* |
---|
| 201 | -mabicalls -mcpu=CPU TYPE -membedded-data |
---|
| 202 | -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 |
---|
| 203 | -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 |
---|
| 204 | -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy |
---|
| 205 | -mmips-as -mmips-tfile -mno-abicalls |
---|
| 206 | -mno-embedded-data -mno-embedded-pic |
---|
| 207 | -mno-gpopt -mno-long-calls |
---|
| 208 | -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats |
---|
| 209 | -mrnames -msoft-float |
---|
| 210 | -m4650 -msingle-float -mmad |
---|
| 211 | -mstats -EL -EB -G NUM -nocpp |
---|
| 212 | |
---|
| 213 | *i386 Options* |
---|
| 214 | -m486 -m386 -mieee-fp -mno-fancy-math-387 |
---|
| 215 | -mno-fp-ret-in-387 -msoft-float -msvr3-shlib |
---|
| 216 | -mno-wide-multiply -mrtd -malign-double |
---|
| 217 | -mreg-alloc=LIST -mregparm=NUM |
---|
| 218 | -malign-jumps=NUM -malign-loops=NUM |
---|
| 219 | -malign-functions=NUM |
---|
| 220 | |
---|
| 221 | *HPPA Options* |
---|
| 222 | -mdisable-fpregs -mdisable-indexing -mfast-indirect-calls |
---|
| 223 | -mgas -mjump-in-delay -mlong-millicode-calls -mno-disable-fpregs |
---|
| 224 | -mno-disable-indexing -mno-fast-indirect-calls -mno-gas |
---|
| 225 | -mno-jump-in-delay -mno-millicode-long-calls |
---|
| 226 | -mno-portable-runtime -mno-soft-float -msoft-float |
---|
| 227 | -mpa-risc-1-0 -mpa-risc-1-1 -mportable-runtime -mschedule=LIST |
---|
| 228 | |
---|
| 229 | *Intel 960 Options* |
---|
| 230 | -mCPU TYPE -masm-compat -mclean-linkage |
---|
| 231 | -mcode-align -mcomplex-addr -mleaf-procedures |
---|
| 232 | -mic-compat -mic2.0-compat -mic3.0-compat |
---|
| 233 | -mintel-asm -mno-clean-linkage -mno-code-align |
---|
| 234 | -mno-complex-addr -mno-leaf-procedures |
---|
| 235 | -mno-old-align -mno-strict-align -mno-tail-call |
---|
| 236 | -mnumerics -mold-align -msoft-float -mstrict-align |
---|
| 237 | -mtail-call |
---|
| 238 | |
---|
| 239 | *DEC Alpha Options* |
---|
| 240 | -mfp-regs -mno-fp-regs -mno-soft-float |
---|
| 241 | -msoft-float |
---|
| 242 | |
---|
| 243 | *Clipper Options* |
---|
| 244 | -mc300 -mc400 |
---|
| 245 | |
---|
| 246 | *H8/300 Options* |
---|
| 247 | -mrelax -mh |
---|
| 248 | |
---|
| 249 | *System V Options* |
---|
| 250 | -Qy -Qn -YP,PATHS -Ym,DIR |
---|
| 251 | |
---|
| 252 | *Code Generation Options* |
---|
| 253 | *Note Options for Code Generation Conventions: Code Gen Options. |
---|
| 254 | -fcall-saved-REG -fcall-used-REG |
---|
| 255 | -ffixed-REG -finhibit-size-directive |
---|
| 256 | -fno-common -fno-ident -fno-gnu-linker |
---|
| 257 | -fpcc-struct-return -fpic -fPIC |
---|
| 258 | -freg-struct-return -fshared-data -fshort-enums |
---|
| 259 | -fshort-double -fvolatile -fvolatile-global |
---|
| 260 | -fverbose-asm -fpack-struct +e0 +e1 |
---|
| 261 | |
---|
| 262 | * Menu: |
---|
| 263 | |
---|
| 264 | * Overall Options:: Controlling the kind of output: |
---|
| 265 | an executable, object files, assembler files, |
---|
| 266 | or preprocessed source. |
---|
| 267 | * C Dialect Options:: Controlling the variant of C language compiled. |
---|
| 268 | * C++ Dialect Options:: Variations on C++. |
---|
| 269 | * Warning Options:: How picky should the compiler be? |
---|
| 270 | * Debugging Options:: Symbol tables, measurements, and debugging dumps. |
---|
| 271 | * Optimize Options:: How much optimization? |
---|
| 272 | * Preprocessor Options:: Controlling header files and macro definitions. |
---|
| 273 | Also, getting dependency information for Make. |
---|
| 274 | * Assembler Options:: Passing options to the assembler. |
---|
| 275 | * Link Options:: Specifying libraries and so on. |
---|
| 276 | * Directory Options:: Where to find header files and libraries. |
---|
| 277 | Where to find the compiler executable files. |
---|
| 278 | * Target Options:: Running a cross-compiler, or an old version of GNU CC. |
---|
| 279 | |
---|
| 280 | |
---|
| 281 | File: gcc.info, Node: Overall Options, Next: Invoking G++, Prev: Option Summary, Up: Invoking GCC |
---|
| 282 | |
---|
| 283 | Options Controlling the Kind of Output |
---|
| 284 | ====================================== |
---|
| 285 | |
---|
| 286 | Compilation can involve up to four stages: preprocessing, compilation |
---|
| 287 | proper, assembly and linking, always in that order. The first three |
---|
| 288 | stages apply to an individual source file, and end by producing an |
---|
| 289 | object file; linking combines all the object files (those newly |
---|
| 290 | compiled, and those specified as input) into an executable file. |
---|
| 291 | |
---|
| 292 | For any given input file, the file name suffix determines what kind |
---|
| 293 | of compilation is done: |
---|
| 294 | |
---|
| 295 | `FILE.c' |
---|
| 296 | C source code which must be preprocessed. |
---|
| 297 | |
---|
| 298 | `FILE.i' |
---|
| 299 | C source code which should not be preprocessed. |
---|
| 300 | |
---|
| 301 | `FILE.ii' |
---|
| 302 | C++ source code which should not be preprocessed. |
---|
| 303 | |
---|
| 304 | `FILE.m' |
---|
| 305 | Objective-C source code. Note that you must link with the library |
---|
| 306 | `libobjc.a' to make an Objective-C program work. |
---|
| 307 | |
---|
| 308 | `FILE.h' |
---|
| 309 | C header file (not to be compiled or linked). |
---|
| 310 | |
---|
| 311 | `FILE.cc' |
---|
| 312 | `FILE.cxx' |
---|
| 313 | `FILE.cpp' |
---|
| 314 | `FILE.C' |
---|
| 315 | C++ source code which must be preprocessed. Note that in `.cxx', |
---|
| 316 | the last two letters must both be literally `x'. Likewise, `.C' |
---|
| 317 | refers to a literal capital C. |
---|
| 318 | |
---|
| 319 | `FILE.s' |
---|
| 320 | Assembler code. |
---|
| 321 | |
---|
| 322 | `FILE.S' |
---|
| 323 | Assembler code which must be preprocessed. |
---|
| 324 | |
---|
| 325 | `OTHER' |
---|
| 326 | An object file to be fed straight into linking. Any file name |
---|
| 327 | with no recognized suffix is treated this way. |
---|
| 328 | |
---|
| 329 | You can specify the input language explicitly with the `-x' option: |
---|
| 330 | |
---|
| 331 | `-x LANGUAGE' |
---|
| 332 | Specify explicitly the LANGUAGE for the following input files |
---|
| 333 | (rather than letting the compiler choose a default based on the |
---|
| 334 | file name suffix). This option applies to all following input |
---|
| 335 | files until the next `-x' option. Possible values for LANGUAGE |
---|
| 336 | are: |
---|
| 337 | c objective-c c++ |
---|
| 338 | c-header cpp-output c++-cpp-output |
---|
| 339 | assembler assembler-with-cpp |
---|
| 340 | |
---|
| 341 | `-x none' |
---|
| 342 | Turn off any specification of a language, so that subsequent files |
---|
| 343 | are handled according to their file name suffixes (as they are if |
---|
| 344 | `-x' has not been used at all). |
---|
| 345 | |
---|
| 346 | If you only want some of the stages of compilation, you can use `-x' |
---|
| 347 | (or filename suffixes) to tell `gcc' where to start, and one of the |
---|
| 348 | options `-c', `-S', or `-E' to say where `gcc' is to stop. Note that |
---|
| 349 | some combinations (for example, `-x cpp-output -E' instruct `gcc' to do |
---|
| 350 | nothing at all. |
---|
| 351 | |
---|
| 352 | `-c' |
---|
| 353 | Compile or assemble the source files, but do not link. The linking |
---|
| 354 | stage simply is not done. The ultimate output is in the form of an |
---|
| 355 | object file for each source file. |
---|
| 356 | |
---|
| 357 | By default, the object file name for a source file is made by |
---|
| 358 | replacing the suffix `.c', `.i', `.s', etc., with `.o'. |
---|
| 359 | |
---|
| 360 | Unrecognized input files, not requiring compilation or assembly, |
---|
| 361 | are ignored. |
---|
| 362 | |
---|
| 363 | `-S' |
---|
| 364 | Stop after the stage of compilation proper; do not assemble. The |
---|
| 365 | output is in the form of an assembler code file for each |
---|
| 366 | non-assembler input file specified. |
---|
| 367 | |
---|
| 368 | By default, the assembler file name for a source file is made by |
---|
| 369 | replacing the suffix `.c', `.i', etc., with `.s'. |
---|
| 370 | |
---|
| 371 | Input files that don't require compilation are ignored. |
---|
| 372 | |
---|
| 373 | `-E' |
---|
| 374 | Stop after the preprocessing stage; do not run the compiler |
---|
| 375 | proper. The output is in the form of preprocessed source code, |
---|
| 376 | which is sent to the standard output. |
---|
| 377 | |
---|
| 378 | Input files which don't require preprocessing are ignored. |
---|
| 379 | |
---|
| 380 | `-o FILE' |
---|
| 381 | Place output in file FILE. This applies regardless to whatever |
---|
| 382 | sort of output is being produced, whether it be an executable file, |
---|
| 383 | an object file, an assembler file or preprocessed C code. |
---|
| 384 | |
---|
| 385 | Since only one output file can be specified, it does not make |
---|
| 386 | sense to use `-o' when compiling more than one input file, unless |
---|
| 387 | you are producing an executable file as output. |
---|
| 388 | |
---|
| 389 | If `-o' is not specified, the default is to put an executable file |
---|
| 390 | in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its |
---|
| 391 | assembler file in `SOURCE.s', and all preprocessed C source on |
---|
| 392 | standard output. |
---|
| 393 | |
---|
| 394 | `-v' |
---|
| 395 | Print (on standard error output) the commands executed to run the |
---|
| 396 | stages of compilation. Also print the version number of the |
---|
| 397 | compiler driver program and of the preprocessor and the compiler |
---|
| 398 | proper. |
---|
| 399 | |
---|
| 400 | `-pipe' |
---|
| 401 | Use pipes rather than temporary files for communication between the |
---|
| 402 | various stages of compilation. This fails to work on some systems |
---|
| 403 | where the assembler is unable to read from a pipe; but the GNU |
---|
| 404 | assembler has no trouble. |
---|
| 405 | |
---|
| 406 | |
---|
| 407 | File: gcc.info, Node: Invoking G++, Next: C Dialect Options, Prev: Overall Options, Up: Invoking GCC |
---|
| 408 | |
---|
| 409 | Compiling C++ Programs |
---|
| 410 | ====================== |
---|
| 411 | |
---|
| 412 | C++ source files conventionally use one of the suffixes `.C', `.cc', |
---|
| 413 | `cpp', or `.cxx'; preprocessed C++ files use the suffix `.ii'. GNU CC |
---|
| 414 | recognizes files with these names and compiles them as C++ programs |
---|
| 415 | even if you call the compiler the same way as for compiling C programs |
---|
| 416 | (usually with the name `gcc'). |
---|
| 417 | |
---|
| 418 | However, C++ programs often require class libraries as well as a |
---|
| 419 | compiler that understands the C++ language--and under some |
---|
| 420 | circumstances, you might want to compile programs from standard input, |
---|
| 421 | or otherwise without a suffix that flags them as C++ programs. `g++' |
---|
| 422 | is a program that calls GNU CC with the default language set to C++, |
---|
| 423 | and automatically specifies linking against the GNU class library |
---|
| 424 | libg++. (1) On many systems, the script `g++' is also installed with |
---|
| 425 | the name `c++'. |
---|
| 426 | |
---|
| 427 | When you compile C++ programs, you may specify many of the same |
---|
| 428 | command-line options that you use for compiling programs in any |
---|
| 429 | language; or command-line options meaningful for C and related |
---|
| 430 | languages; or options that are meaningful only for C++ programs. *Note |
---|
| 431 | Options Controlling C Dialect: C Dialect Options, for explanations of |
---|
| 432 | options for languages related to C. *Note Options Controlling C++ |
---|
| 433 | Dialect: C++ Dialect Options, for explanations of options that are |
---|
| 434 | meaningful only for C++ programs. |
---|
| 435 | |
---|
| 436 | ---------- Footnotes ---------- |
---|
| 437 | |
---|
| 438 | (1) Prior to release 2 of the compiler, there was a separate `g++' |
---|
| 439 | compiler. That version was based on GNU CC, but not integrated with |
---|
| 440 | it. Versions of `g++' with a `1.XX' version number--for example, `g++' |
---|
| 441 | version 1.37 or 1.42--are much less reliable than the versions |
---|
| 442 | integrated with GCC 2. Moreover, combining G++ `1.XX' with a version 2 |
---|
| 443 | GCC will simply not work. |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | File: gcc.info, Node: C Dialect Options, Next: C++ Dialect Options, Prev: Invoking G++, Up: Invoking GCC |
---|
| 447 | |
---|
| 448 | Options Controlling C Dialect |
---|
| 449 | ============================= |
---|
| 450 | |
---|
| 451 | The following options control the dialect of C (or languages derived |
---|
| 452 | from C, such as C++ and Objective C) that the compiler accepts: |
---|
| 453 | |
---|
| 454 | `-ansi' |
---|
| 455 | Support all ANSI standard C programs. |
---|
| 456 | |
---|
| 457 | This turns off certain features of GNU C that are incompatible |
---|
| 458 | with ANSI C, such as the `asm', `inline' and `typeof' keywords, and |
---|
| 459 | predefined macros such as `unix' and `vax' that identify the type |
---|
| 460 | of system you are using. It also enables the undesirable and |
---|
| 461 | rarely used ANSI trigraph feature, disallows `$' as part of |
---|
| 462 | identifiers, and disables recognition of C++ style `//' comments. |
---|
| 463 | |
---|
| 464 | The alternate keywords `__asm__', `__extension__', `__inline__' |
---|
| 465 | and `__typeof__' continue to work despite `-ansi'. You would not |
---|
| 466 | want to use them in an ANSI C program, of course, but it is useful |
---|
| 467 | to put them in header files that might be included in compilations |
---|
| 468 | done with `-ansi'. Alternate predefined macros such as `__unix__' |
---|
| 469 | and `__vax__' are also available, with or without `-ansi'. |
---|
| 470 | |
---|
| 471 | The `-ansi' option does not cause non-ANSI programs to be rejected |
---|
| 472 | gratuitously. For that, `-pedantic' is required in addition to |
---|
| 473 | `-ansi'. *Note Warning Options::. |
---|
| 474 | |
---|
| 475 | The macro `__STRICT_ANSI__' is predefined when the `-ansi' option |
---|
| 476 | is used. Some header files may notice this macro and refrain from |
---|
| 477 | declaring certain functions or defining certain macros that the |
---|
| 478 | ANSI standard doesn't call for; this is to avoid interfering with |
---|
| 479 | any programs that might use these names for other things. |
---|
| 480 | |
---|
| 481 | The functions `alloca', `abort', `exit', and `_exit' are not |
---|
| 482 | builtin functions when `-ansi' is used. |
---|
| 483 | |
---|
| 484 | `-fno-asm' |
---|
| 485 | Do not recognize `asm', `inline' or `typeof' as a keyword, so that |
---|
| 486 | code can use these words as identifiers. You can use the keywords |
---|
| 487 | `__asm__', `__inline__' and `__typeof__' instead. `-ansi' implies |
---|
| 488 | `-fno-asm'. |
---|
| 489 | |
---|
| 490 | In C++, this switch only affects the `typeof' keyword, since `asm' |
---|
| 491 | and `inline' are standard keywords. You may want to use the |
---|
| 492 | `-fno-gnu-keywords' flag instead, as it also disables the other, |
---|
| 493 | C++-specific, extension keywords such as `headof'. |
---|
| 494 | |
---|
| 495 | `-fno-builtin' |
---|
| 496 | Don't recognize builtin functions that do not begin with two |
---|
| 497 | leading underscores. Currently, the functions affected include |
---|
| 498 | `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs', |
---|
| 499 | `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and |
---|
| 500 | `strlen'. |
---|
| 501 | |
---|
| 502 | GCC normally generates special code to handle certain builtin |
---|
| 503 | functions more efficiently; for instance, calls to `alloca' may |
---|
| 504 | become single instructions that adjust the stack directly, and |
---|
| 505 | calls to `memcpy' may become inline copy loops. The resulting |
---|
| 506 | code is often both smaller and faster, but since the function |
---|
| 507 | calls no longer appear as such, you cannot set a breakpoint on |
---|
| 508 | those calls, nor can you change the behavior of the functions by |
---|
| 509 | linking with a different library. |
---|
| 510 | |
---|
| 511 | The `-ansi' option prevents `alloca' and `ffs' from being builtin |
---|
| 512 | functions, since these functions do not have an ANSI standard |
---|
| 513 | meaning. |
---|
| 514 | |
---|
| 515 | `-trigraphs' |
---|
| 516 | Support ANSI C trigraphs. You don't want to know about this |
---|
| 517 | brain-damage. The `-ansi' option implies `-trigraphs'. |
---|
| 518 | |
---|
| 519 | `-traditional' |
---|
| 520 | Attempt to support some aspects of traditional C compilers. |
---|
| 521 | Specifically: |
---|
| 522 | |
---|
| 523 | * All `extern' declarations take effect globally even if they |
---|
| 524 | are written inside of a function definition. This includes |
---|
| 525 | implicit declarations of functions. |
---|
| 526 | |
---|
| 527 | * The newer keywords `typeof', `inline', `signed', `const' and |
---|
| 528 | `volatile' are not recognized. (You can still use the |
---|
| 529 | alternative keywords such as `__typeof__', `__inline__', and |
---|
| 530 | so on.) |
---|
| 531 | |
---|
| 532 | * Comparisons between pointers and integers are always allowed. |
---|
| 533 | |
---|
| 534 | * Integer types `unsigned short' and `unsigned char' promote to |
---|
| 535 | `unsigned int'. |
---|
| 536 | |
---|
| 537 | * Out-of-range floating point literals are not an error. |
---|
| 538 | |
---|
| 539 | * Certain constructs which ANSI regards as a single invalid |
---|
| 540 | preprocessing number, such as `0xe-0xd', are treated as |
---|
| 541 | expressions instead. |
---|
| 542 | |
---|
| 543 | * String "constants" are not necessarily constant; they are |
---|
| 544 | stored in writable space, and identical looking constants are |
---|
| 545 | allocated separately. (This is the same as the effect of |
---|
| 546 | `-fwritable-strings'.) |
---|
| 547 | |
---|
| 548 | * All automatic variables not declared `register' are preserved |
---|
| 549 | by `longjmp'. Ordinarily, GNU C follows ANSI C: automatic |
---|
| 550 | variables not declared `volatile' may be clobbered. |
---|
| 551 | |
---|
| 552 | * The character escape sequences `\x' and `\a' evaluate as the |
---|
| 553 | literal characters `x' and `a' respectively. Without |
---|
| 554 | `-traditional', `\x' is a prefix for the hexadecimal |
---|
| 555 | representation of a character, and `\a' produces a bell. |
---|
| 556 | |
---|
| 557 | * In C++ programs, assignment to `this' is permitted with |
---|
| 558 | `-traditional'. (The option `-fthis-is-variable' also has |
---|
| 559 | this effect.) |
---|
| 560 | |
---|
| 561 | You may wish to use `-fno-builtin' as well as `-traditional' if |
---|
| 562 | your program uses names that are normally GNU C builtin functions |
---|
| 563 | for other purposes of its own. |
---|
| 564 | |
---|
| 565 | You cannot use `-traditional' if you include any header files that |
---|
| 566 | rely on ANSI C features. Some vendors are starting to ship |
---|
| 567 | systems with ANSI C header files and you cannot use `-traditional' |
---|
| 568 | on such systems to compile files that include any system headers. |
---|
| 569 | |
---|
| 570 | `' |
---|
| 571 | In the preprocessor, comments convert to nothing at all, rather |
---|
| 572 | than to a space. This allows traditional token concatenation. |
---|
| 573 | |
---|
| 574 | `' |
---|
| 575 | In preprocessing directive, the `#' symbol must appear as the first |
---|
| 576 | character of a line. |
---|
| 577 | |
---|
| 578 | `' |
---|
| 579 | In the preprocessor, macro arguments are recognized within string |
---|
| 580 | constants in a macro definition (and their values are stringified, |
---|
| 581 | though without additional quote marks, when they appear in such a |
---|
| 582 | context). The preprocessor always considers a string constant to |
---|
| 583 | end at a newline. |
---|
| 584 | |
---|
| 585 | `' |
---|
| 586 | The predefined macro `__STDC__' is not defined when you use |
---|
| 587 | `-traditional', but `__GNUC__' is (since the GNU extensions which |
---|
| 588 | `__GNUC__' indicates are not affected by `-traditional'). If you |
---|
| 589 | need to write header files that work differently depending on |
---|
| 590 | whether `-traditional' is in use, by testing both of these |
---|
| 591 | predefined macros you can distinguish four situations: GNU C, |
---|
| 592 | traditional GNU C, other ANSI C compilers, and other old C |
---|
| 593 | compilers. The predefined macro `__STDC_VERSION__' is also not |
---|
| 594 | defined when you use `-traditional'. *Note Standard Predefined |
---|
| 595 | Macros: (cpp.info)Standard Predefined, for more discussion of |
---|
| 596 | these and other predefined macros. |
---|
| 597 | |
---|
| 598 | `' |
---|
| 599 | The preprocessor considers a string constant to end at a newline |
---|
| 600 | (unless the newline is escaped with `\'). (Without `-traditional', |
---|
| 601 | string constants can contain the newline character as typed.) |
---|
| 602 | |
---|
| 603 | `-traditional-cpp' |
---|
| 604 | Attempt to support some aspects of traditional C preprocessors. |
---|
| 605 | This includes the last five items in the table immediately above, |
---|
| 606 | but none of the other effects of `-traditional'. |
---|
| 607 | |
---|
| 608 | `-fcond-mismatch' |
---|
| 609 | Allow conditional expressions with mismatched types in the second |
---|
| 610 | and third arguments. The value of such an expression is void. |
---|
| 611 | |
---|
| 612 | `-funsigned-char' |
---|
| 613 | Let the type `char' be unsigned, like `unsigned char'. |
---|
| 614 | |
---|
| 615 | Each kind of machine has a default for what `char' should be. It |
---|
| 616 | is either like `unsigned char' by default or like `signed char' by |
---|
| 617 | default. |
---|
| 618 | |
---|
| 619 | Ideally, a portable program should always use `signed char' or |
---|
| 620 | `unsigned char' when it depends on the signedness of an object. |
---|
| 621 | But many programs have been written to use plain `char' and expect |
---|
| 622 | it to be signed, or expect it to be unsigned, depending on the |
---|
| 623 | machines they were written for. This option, and its inverse, let |
---|
| 624 | you make such a program work with the opposite default. |
---|
| 625 | |
---|
| 626 | The type `char' is always a distinct type from each of `signed |
---|
| 627 | char' or `unsigned char', even though its behavior is always just |
---|
| 628 | like one of those two. |
---|
| 629 | |
---|
| 630 | `-fsigned-char' |
---|
| 631 | Let the type `char' be signed, like `signed char'. |
---|
| 632 | |
---|
| 633 | Note that this is equivalent to `-fno-unsigned-char', which is the |
---|
| 634 | negative form of `-funsigned-char'. Likewise, the option |
---|
| 635 | `-fno-signed-char' is equivalent to `-funsigned-char'. |
---|
| 636 | |
---|
| 637 | `-fsigned-bitfields' |
---|
| 638 | `-funsigned-bitfields' |
---|
| 639 | `-fno-signed-bitfields' |
---|
| 640 | `-fno-unsigned-bitfields' |
---|
| 641 | These options control whether a bitfield is signed or unsigned, |
---|
| 642 | when the declaration does not use either `signed' or `unsigned'. |
---|
| 643 | By default, such a bitfield is signed, because this is consistent: |
---|
| 644 | the basic integer types such as `int' are signed types. |
---|
| 645 | |
---|
| 646 | However, when `-traditional' is used, bitfields are all unsigned |
---|
| 647 | no matter what. |
---|
| 648 | |
---|
| 649 | `-fwritable-strings' |
---|
| 650 | Store string constants in the writable data segment and don't |
---|
| 651 | uniquize them. This is for compatibility with old programs which |
---|
| 652 | assume they can write into string constants. The option |
---|
| 653 | `-traditional' also has this effect. |
---|
| 654 | |
---|
| 655 | Writing into string constants is a very bad idea; "constants" |
---|
| 656 | should be constant. |
---|
| 657 | |
---|
| 658 | `-fallow-single-precision' |
---|
| 659 | Do not promote single precision math operations to double |
---|
| 660 | precision, even when compiling with `-traditional'. |
---|
| 661 | |
---|
| 662 | Traditional K&R C promotes all floating point operations to double |
---|
| 663 | precision, regardless of the sizes of the operands. On the |
---|
| 664 | architecture for which you are compiling, single precision may be |
---|
| 665 | faster than double precision. If you must use `-traditional', |
---|
| 666 | but want to use single precision operations when the operands are |
---|
| 667 | single precision, use this option. This option has no effect |
---|
| 668 | when compiling with ANSI or GNU C conventions (the default). |
---|
| 669 | |
---|
| 670 | |
---|
| 671 | File: gcc.info, Node: C++ Dialect Options, Next: Warning Options, Prev: C Dialect Options, Up: Invoking GCC |
---|
| 672 | |
---|
| 673 | Options Controlling C++ Dialect |
---|
| 674 | =============================== |
---|
| 675 | |
---|
| 676 | This section describes the command-line options that are only |
---|
| 677 | meaningful for C++ programs; but you can also use most of the GNU |
---|
| 678 | compiler options regardless of what language your program is in. For |
---|
| 679 | example, you might compile a file `firstClass.C' like this: |
---|
| 680 | |
---|
| 681 | g++ -g -felide-constructors -O -c firstClass.C |
---|
| 682 | |
---|
| 683 | In this example, only `-felide-constructors' is an option meant only |
---|
| 684 | for C++ programs; you can use the other options with any language |
---|
| 685 | supported by GNU CC. |
---|
| 686 | |
---|
| 687 | Here is a list of options that are *only* for compiling C++ programs: |
---|
| 688 | |
---|
| 689 | `-fno-access-control' |
---|
| 690 | Turn off all access checking. This switch is mainly useful for |
---|
| 691 | working around bugs in the access control code. |
---|
| 692 | |
---|
| 693 | `-fall-virtual' |
---|
| 694 | Treat all possible member functions as virtual, implicitly. All |
---|
| 695 | member functions (except for constructor functions and `new' or |
---|
| 696 | `delete' member operators) are treated as virtual functions of the |
---|
| 697 | class where they appear. |
---|
| 698 | |
---|
| 699 | This does not mean that all calls to these member functions will |
---|
| 700 | be made through the internal table of virtual functions. Under |
---|
| 701 | some circumstances, the compiler can determine that a call to a |
---|
| 702 | given virtual function can be made directly; in these cases the |
---|
| 703 | calls are direct in any case. |
---|
| 704 | |
---|
| 705 | `-fcheck-new' |
---|
| 706 | Check that the pointer returned by `operator new' is non-null |
---|
| 707 | before attempting to modify the storage allocated. The current |
---|
| 708 | Working Paper requires that `operator new' never return a null |
---|
| 709 | pointer, so this check is normally unnecessary. |
---|
| 710 | |
---|
| 711 | `-fconserve-space' |
---|
| 712 | Put uninitialized or runtime-initialized global variables into the |
---|
| 713 | common segment, as C does. This saves space in the executable at |
---|
| 714 | the cost of not diagnosing duplicate definitions. If you compile |
---|
| 715 | with this flag and your program mysteriously crashes after |
---|
| 716 | `main()' has completed, you may have an object that is being |
---|
| 717 | destroyed twice because two definitions were merged. |
---|
| 718 | |
---|
| 719 | `-fdollars-in-identifiers' |
---|
| 720 | Accept `$' in identifiers. You can also explicitly prohibit use of |
---|
| 721 | `$' with the option `-fno-dollars-in-identifiers'. (GNU C++ |
---|
| 722 | allows `$' by default on some target systems but not others.) |
---|
| 723 | Traditional C allowed the character `$' to form part of |
---|
| 724 | identifiers. However, ANSI C and C++ forbid `$' in identifiers. |
---|
| 725 | |
---|
| 726 | `-fenum-int-equiv' |
---|
| 727 | Anachronistically permit implicit conversion of `int' to |
---|
| 728 | enumeration types. Current C++ allows conversion of `enum' to |
---|
| 729 | `int', but not the other way around. |
---|
| 730 | |
---|
| 731 | `-fexternal-templates' |
---|
| 732 | Cause template instantiations to obey `#pragma interface' and |
---|
| 733 | `implementation'; template instances are emitted or not according |
---|
| 734 | to the location of the template definition. *Note Template |
---|
| 735 | Instantiation::, for more information. |
---|
| 736 | |
---|
| 737 | `-falt-external-templates' |
---|
| 738 | Similar to -fexternal-templates, but template instances are |
---|
| 739 | emitted or not according to the place where they are first |
---|
| 740 | instantiated. *Note Template Instantiation::, for more |
---|
| 741 | information. |
---|
| 742 | |
---|
| 743 | `-ffor-scope' |
---|
| 744 | `-fno-for-scope' |
---|
| 745 | If -ffor-scope is specified, the scope of variables declared in a |
---|
| 746 | for-init-statement is limited to the `for' loop itself, as |
---|
| 747 | specified by the draft C++ standard. If -fno-for-scope is |
---|
| 748 | specified, the scope of variables declared in a for-init-statement |
---|
| 749 | extends to the end of the enclosing scope, as was the case in old |
---|
| 750 | versions of gcc, and other (traditional) implementations of C++. |
---|
| 751 | |
---|
| 752 | The default if neither flag is given to follow the standard, but |
---|
| 753 | to allow and give a warning for old-style code that would |
---|
| 754 | otherwise be invalid, or have different behavior. |
---|
| 755 | |
---|
| 756 | `-fno-gnu-keywords' |
---|
| 757 | Do not recognize `classof', `headof', `signature', `sigof' or |
---|
| 758 | `typeof' as a keyword, so that code can use these words as |
---|
| 759 | identifiers. You can use the keywords `__classof__', |
---|
| 760 | `__headof__', `__signature__', `__sigof__', and `__typeof__' |
---|
| 761 | instead. `-ansi' implies `-fno-gnu-keywords'. |
---|
| 762 | |
---|
| 763 | `-fno-implicit-templates' |
---|
| 764 | Never emit code for templates which are instantiated implicitly |
---|
| 765 | (i.e. by use); only emit code for explicit instantiations. *Note |
---|
| 766 | Template Instantiation::, for more information. |
---|
| 767 | |
---|
| 768 | `-fhandle-signatures' |
---|
| 769 | Recognize the `signature' and `sigof' keywords for specifying |
---|
| 770 | abstract types. The default (`-fno-handle-signatures') is not to |
---|
| 771 | recognize them. *Note Type Abstraction using Signatures: C++ |
---|
| 772 | Signatures. |
---|
| 773 | |
---|
| 774 | `-fhuge-objects' |
---|
| 775 | Support virtual function calls for objects that exceed the size |
---|
| 776 | representable by a `short int'. Users should not use this flag by |
---|
| 777 | default; if you need to use it, the compiler will tell you so. If |
---|
| 778 | you compile any of your code with this flag, you must compile |
---|
| 779 | *all* of your code with this flag (including libg++, if you use |
---|
| 780 | it). |
---|
| 781 | |
---|
| 782 | This flag is not useful when compiling with -fvtable-thunks. |
---|
| 783 | |
---|
| 784 | `-fno-implement-inlines' |
---|
| 785 | To save space, do not emit out-of-line copies of inline functions |
---|
| 786 | controlled by `#pragma implementation'. This will cause linker |
---|
| 787 | errors if these functions are not inlined everywhere they are |
---|
| 788 | called. |
---|
| 789 | |
---|
| 790 | `-fmemoize-lookups' |
---|
| 791 | `-fsave-memoized' |
---|
| 792 | Use heuristics to compile faster. These heuristics are not |
---|
| 793 | enabled by default, since they are only effective for certain |
---|
| 794 | input files. Other input files compile more slowly. |
---|
| 795 | |
---|
| 796 | The first time the compiler must build a call to a member function |
---|
| 797 | (or reference to a data member), it must (1) determine whether the |
---|
| 798 | class implements member functions of that name; (2) resolve which |
---|
| 799 | member function to call (which involves figuring out what sorts of |
---|
| 800 | type conversions need to be made); and (3) check the visibility of |
---|
| 801 | the member function to the caller. All of this adds up to slower |
---|
| 802 | compilation. Normally, the second time a call is made to that |
---|
| 803 | member function (or reference to that data member), it must go |
---|
| 804 | through the same lengthy process again. This means that code like |
---|
| 805 | this: |
---|
| 806 | |
---|
| 807 | cout << "This " << p << " has " << n << " legs.\n"; |
---|
| 808 | |
---|
| 809 | makes six passes through all three steps. By using a software |
---|
| 810 | cache, a "hit" significantly reduces this cost. Unfortunately, |
---|
| 811 | using the cache introduces another layer of mechanisms which must |
---|
| 812 | be implemented, and so incurs its own overhead. |
---|
| 813 | `-fmemoize-lookups' enables the software cache. |
---|
| 814 | |
---|
| 815 | Because access privileges (visibility) to members and member |
---|
| 816 | functions may differ from one function context to the next, G++ |
---|
| 817 | may need to flush the cache. With the `-fmemoize-lookups' flag, |
---|
| 818 | the cache is flushed after every function that is compiled. The |
---|
| 819 | `-fsave-memoized' flag enables the same software cache, but when |
---|
| 820 | the compiler determines that the context of the last function |
---|
| 821 | compiled would yield the same access privileges of the next |
---|
| 822 | function to compile, it preserves the cache. This is most helpful |
---|
| 823 | when defining many member functions for the same class: with the |
---|
| 824 | exception of member functions which are friends of other classes, |
---|
| 825 | each member function has exactly the same access privileges as |
---|
| 826 | every other, and the cache need not be flushed. |
---|
| 827 | |
---|
| 828 | The code that implements these flags has rotted; you should |
---|
| 829 | probably avoid using them. |
---|
| 830 | |
---|
| 831 | `-fstrict-prototype' |
---|
| 832 | Within an `extern "C"' linkage specification, treat a function |
---|
| 833 | declaration with no arguments, such as `int foo ();', as declaring |
---|
| 834 | the function to take no arguments. Normally, such a declaration |
---|
| 835 | means that the function `foo' can take any combination of |
---|
| 836 | arguments, as in C. `-pedantic' implies `-fstrict-prototype' |
---|
| 837 | unless overridden with `-fno-strict-prototype'. |
---|
| 838 | |
---|
| 839 | This flag no longer affects declarations with C++ linkage. |
---|
| 840 | |
---|
| 841 | `-fno-nonnull-objects' |
---|
| 842 | Don't assume that a reference is initialized to refer to a valid |
---|
| 843 | object. Although the current C++ Working Paper prohibits null |
---|
| 844 | references, some old code may rely on them, and you can use |
---|
| 845 | `-fno-nonnull-objects' to turn on checking. |
---|
| 846 | |
---|
| 847 | At the moment, the compiler only does this checking for |
---|
| 848 | conversions to virtual base classes. |
---|
| 849 | |
---|
| 850 | `-foperator-names' |
---|
| 851 | Recognize the operator name keywords `and', `bitand', `bitor', |
---|
| 852 | `compl', `not', `or' and `xor' as synonyms for the symbols they |
---|
| 853 | refer to. `-ansi' implies `-foperator-names'. |
---|
| 854 | |
---|
| 855 | `-fthis-is-variable' |
---|
| 856 | Permit assignment to `this'. The incorporation of user-defined |
---|
| 857 | free store management into C++ has made assignment to `this' an |
---|
| 858 | anachronism. Therefore, by default it is invalid to assign to |
---|
| 859 | `this' within a class member function; that is, GNU C++ treats |
---|
| 860 | `this' in a member function of class `X' as a non-lvalue of type |
---|
| 861 | `X *'. However, for backwards compatibility, you can make it |
---|
| 862 | valid with `-fthis-is-variable'. |
---|
| 863 | |
---|
| 864 | `-fvtable-thunks' |
---|
| 865 | Use `thunks' to implement the virtual function dispatch table |
---|
| 866 | (`vtable'). The traditional (cfront-style) approach to |
---|
| 867 | implementing vtables was to store a pointer to the function and two |
---|
| 868 | offsets for adjusting the `this' pointer at the call site. Newer |
---|
| 869 | implementations store a single pointer to a `thunk' function which |
---|
| 870 | does any necessary adjustment and then calls the target function. |
---|
| 871 | |
---|
| 872 | This option also enables a heuristic for controlling emission of |
---|
| 873 | vtables; if a class has any non-inline virtual functions, the |
---|
| 874 | vtable will be emitted in the translation unit containing the |
---|
| 875 | first one of those. |
---|
| 876 | |
---|
| 877 | `-nostdinc++' |
---|
| 878 | Do not search for header files in the standard directories |
---|
| 879 | specific to C++, but do still search the other standard |
---|
| 880 | directories. (This option is used when building libg++.) |
---|
| 881 | |
---|
| 882 | `-traditional' |
---|
| 883 | For C++ programs (in addition to the effects that apply to both C |
---|
| 884 | and C++), this has the same effect as `-fthis-is-variable'. *Note |
---|
| 885 | Options Controlling C Dialect: C Dialect Options. |
---|
| 886 | |
---|
| 887 | In addition, these optimization, warning, and code generation options |
---|
| 888 | have meanings only for C++ programs: |
---|
| 889 | |
---|
| 890 | `-fno-default-inline' |
---|
| 891 | Do not assume `inline' for functions defined inside a class scope. |
---|
| 892 | *Note Options That Control Optimization: Optimize Options. |
---|
| 893 | |
---|
| 894 | `-Wenum-clash' |
---|
| 895 | `-Woverloaded-virtual' |
---|
| 896 | `-Wtemplate-debugging' |
---|
| 897 | Warnings that apply only to C++ programs. *Note Options to |
---|
| 898 | Request or Suppress Warnings: Warning Options. |
---|
| 899 | |
---|
| 900 | `+eN' |
---|
| 901 | Control how virtual function definitions are used, in a fashion |
---|
| 902 | compatible with `cfront' 1.x. *Note Options for Code Generation |
---|
| 903 | Conventions: Code Gen Options. |
---|
| 904 | |
---|