Annotation of gcc/gcc.info-2, revision 1.1.1.5

1.1.1.5 ! root        1: This is Info file gcc.info, produced by Makeinfo-1.54 from the input
1.1       root        2: file gcc.texi.
                      3: 
                      4:    This file documents the use and the internals of the GNU compiler.
                      5: 
1.1.1.5 ! root        6:    Published by the Free Software Foundation 675 Massachusetts Avenue
        !             7: Cambridge, MA 02139 USA
        !             8: 
        !             9:    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
1.1       root       10: 
1.1.1.3   root       11:    Permission is granted to make and distribute verbatim copies of this
                     12: manual provided the copyright notice and this permission notice are
                     13: preserved on all copies.
1.1       root       14: 
                     15:    Permission is granted to copy and distribute modified versions of
                     16: this manual under the conditions for verbatim copying, provided also
1.1.1.4   root       17: that the sections entitled "GNU General Public License" and "Protect
                     18: Your Freedom--Fight `Look And Feel'" are included exactly as in the
                     19: original, and provided that the entire resulting derived work is
                     20: distributed under the terms of a permission notice identical to this
                     21: one.
1.1       root       22: 
                     23:    Permission is granted to copy and distribute translations of this
                     24: manual into another language, under the above conditions for modified
1.1.1.3   root       25: versions, except that the sections entitled "GNU General Public
1.1.1.4   root       26: License" and "Protect Your Freedom--Fight `Look And Feel'", and this
                     27: permission notice, may be included in translations approved by the Free
                     28: Software Foundation instead of in the original English.
                     29: 
                     30: 
1.1.1.5 ! root       31: File: gcc.info,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
        !            32: 
        !            33: Compiling C++ Programs
        !            34: ======================
        !            35: 
        !            36:    C++ source files conventionally use one of the suffixes `.C', `.cc',
        !            37: or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
        !            38: recognizes files with these names and compiles them as C++ programs
        !            39: even if you call the compiler the same way as for compiling C programs
        !            40: (usually with the name `gcc').
        !            41: 
        !            42:    However, C++ programs often require class libraries as well as a
        !            43: compiler that understands the C++ language--and under some
        !            44: circumstances, you might want to compile programs from standard input,
        !            45: or otherwise without a suffix that flags them as C++ programs.  `g++'
        !            46: is a shell script that calls GNU CC with the default language set to
        !            47: C++, and automatically specifies linking against the GNU class library
        !            48: libg++.  (1) On many systems, the script `g++' is also installed with
        !            49: the name `c++'.
        !            50: 
        !            51:    When you compile C++ programs, you may specify many of the same
        !            52: command-line options that you use for compiling programs in any
        !            53: language; or command-line options meaningful for C and related
        !            54: languages; or options that are meaningful only for C++ programs.  *Note
        !            55: Options Controlling C Dialect: C Dialect Options, for explanations of
        !            56: options for languages related to C.  *Note Options Controlling C++
        !            57: Dialect: C++ Dialect Options, for explanations of options that are
        !            58: meaningful only for C++ programs.
        !            59: 
        !            60:    ---------- Footnotes ----------
        !            61: 
        !            62:    (1)  Prior to release 2 of the compiler, there was a separate `g++'
        !            63: compiler.  That version was based on GNU CC, but not integrated with
        !            64: it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
        !            65: version 1.37 or 1.42--are much less reliable than the versions
        !            66: integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
        !            67: GCC will simply not work.
        !            68: 
        !            69: 
        !            70: File: gcc.info,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
1.1.1.4   root       71: 
1.1.1.5 ! root       72: Options Controlling C Dialect
        !            73: =============================
1.1.1.4   root       74: 
1.1.1.5 ! root       75:    The following options control the dialect of C (or languages derived
        !            76: from C, such as C++ and Objective C) that the compiler accepts:
1.1.1.4   root       77: 
                     78: `-ansi'
                     79:      Support all ANSI standard C programs.
                     80: 
                     81:      This turns off certain features of GNU C that are incompatible
                     82:      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
                     83:      predefined macros such as `unix' and `vax' that identify the type
                     84:      of system you are using.  It also enables the undesirable and
                     85:      rarely used ANSI trigraph feature, and disallows `$' as part of
                     86:      identifiers.
                     87: 
                     88:      The alternate keywords `__asm__', `__extension__', `__inline__'
                     89:      and `__typeof__' continue to work despite `-ansi'.  You would not
                     90:      want to use them in an ANSI C program, of course, but it useful to
                     91:      put them in header files that might be included in compilations
                     92:      done with `-ansi'.  Alternate predefined macros such as `__unix__'
                     93:      and `__vax__' are also available, with or without `-ansi'.
                     94: 
                     95:      The `-ansi' option does not cause non-ANSI programs to be rejected
                     96:      gratuitously.  For that, `-pedantic' is required in addition to
                     97:      `-ansi'.  *Note Warning Options::.
                     98: 
                     99:      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
                    100:      is used.  Some header files may notice this macro and refrain from
                    101:      declaring certain functions or defining certain macros that the
                    102:      ANSI standard doesn't call for; this is to avoid interfering with
                    103:      any programs that might use these names for other things.
                    104: 
                    105:      The functions `alloca', `abort', `exit', and `_exit' are not
                    106:      builtin functions when `-ansi' is used.
                    107: 
                    108: `-fno-asm'
                    109:      Do not recognize `asm', `inline' or `typeof' as a keyword.  These
1.1.1.5 ! root      110:      words may then be used as identifiers.  You can use the keywords
        !           111:      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
        !           112:      `-fno-asm'.
1.1.1.4   root      113: 
                    114: `-fno-builtin'
                    115:      Don't recognize built-in functions that do not begin with two
1.1.1.5 ! root      116:      leading underscores.  Currently, the functions affected include
        !           117:      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
1.1.1.4   root      118:      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
                    119:      `strlen'.
                    120: 
1.1.1.5 ! root      121:      The `-ansi' option prevents `alloca' and `ffs' from being builtin
        !           122:      functions, since these functions do not have an ANSI standard
        !           123:      meaning.
1.1.1.4   root      124: 
                    125: `-trigraphs'
                    126:      Support ANSI C trigraphs.  You don't want to know about this
                    127:      brain-damage.  The `-ansi' option implies `-trigraphs'.
                    128: 
                    129: `-traditional'
                    130:      Attempt to support some aspects of traditional C compilers.
                    131:      Specifically:
                    132: 
                    133:         * All `extern' declarations take effect globally even if they
                    134:           are written inside of a function definition.  This includes
                    135:           implicit declarations of functions.
                    136: 
1.1.1.5 ! root      137:         * The newer keywords `typeof', `inline', `signed', `const' and
1.1.1.4   root      138:           `volatile' are not recognized.  (You can still use the
                    139:           alternative keywords such as `__typeof__', `__inline__', and
                    140:           so on.)
                    141: 
                    142:         * Comparisons between pointers and integers are always allowed.
                    143: 
                    144:         * Integer types `unsigned short' and `unsigned char' promote to
                    145:           `unsigned int'.
                    146: 
                    147:         * Out-of-range floating point literals are not an error.
                    148: 
1.1.1.5 ! root      149:         * Certain constructs which ANSI regards as a single invalid
        !           150:           preprocessing number, such as `0xe-0xd', are treated as
        !           151:           expressions instead.
        !           152: 
1.1.1.4   root      153:         * String "constants" are not necessarily constant; they are
                    154:           stored in writable space, and identical looking constants are
                    155:           allocated separately.  (This is the same as the effect of
                    156:           `-fwritable-strings'.)
                    157: 
                    158:         * All automatic variables not declared `register' are preserved
                    159:           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
                    160:           variables not declared `volatile' may be clobbered.
                    161: 
                    162:         * In the preprocessor, comments convert to nothing at all,
                    163:           rather than to a space.  This allows traditional token
                    164:           concatenation.
                    165: 
                    166:         * In the preprocessor, macro arguments are recognized within
                    167:           string constants in a macro definition (and their values are
                    168:           stringified, though without additional quote marks, when they
                    169:           appear in such a context).  The preprocessor always considers
                    170:           a string constant to end at a newline.
                    171: 
                    172:         * The predefined macro `__STDC__' is not defined when you use
                    173:           `-traditional', but `__GNUC__' is (since the GNU extensions
                    174:           which `__GNUC__' indicates are not affected by
                    175:           `-traditional').  If you need to write header files that work
                    176:           differently depending on whether `-traditional' is in use, by
                    177:           testing both of these predefined macros you can distinguish
                    178:           four situations: GNU C, traditional GNU C, other ANSI C
1.1.1.5 ! root      179:           compilers, and other old C compilers.  *Note Standard
        !           180:           Predefined Macros: (cpp.info)Standard Predefined, for more
        !           181:           discussion of these and other predefined macros.
        !           182: 
        !           183:         * The preprocessor considers a string constant to end at a
        !           184:           newline (unless the newline is escaped with `\').  (Without
        !           185:           `-traditional', string constants can contain the newline
        !           186:           character as typed.)
        !           187: 
        !           188:         * The character escape sequences `\x' and `\a' evaluate as the
        !           189:           literal characters `x' and `a' respectively.  Without
        !           190:           `-traditional', `\x' is a prefix for the hexadecimal
        !           191:           representation of a character, and `\a' produces a bell.
        !           192: 
        !           193:         * In C++ programs, assignment to `this' is permitted with
        !           194:           `-traditional'.  (The option `-fthis-is-variable' also has
        !           195:           this effect.)
1.1.1.4   root      196: 
                    197:      You may wish to use `-fno-builtin' as well as `-traditional' if
                    198:      your program uses names that are normally GNU C builtin functions
                    199:      for other purposes of its own.
                    200: 
                    201: `-traditional-cpp'
                    202:      Attempt to support some aspects of traditional C preprocessors.
                    203:      This includes the last three items in the table immediately above,
                    204:      but none of the other effects of `-traditional'.
                    205: 
                    206: `-fcond-mismatch'
                    207:      Allow conditional expressions with mismatched types in the second
                    208:      and third arguments.  The value of such an expression is void.
                    209: 
                    210: `-funsigned-char'
                    211:      Let the type `char' be unsigned, like `unsigned char'.
                    212: 
                    213:      Each kind of machine has a default for what `char' should be.  It
                    214:      is either like `unsigned char' by default or like `signed char' by
                    215:      default.
                    216: 
                    217:      Ideally, a portable program should always use `signed char' or
                    218:      `unsigned char' when it depends on the signedness of an object.
                    219:      But many programs have been written to use plain `char' and expect
                    220:      it to be signed, or expect it to be unsigned, depending on the
                    221:      machines they were written for.  This option, and its inverse, let
                    222:      you make such a program work with the opposite default.
                    223: 
                    224:      The type `char' is always a distinct type from each of `signed
                    225:      char' or `unsigned char', even though its behavior is always just
                    226:      like one of those two.
                    227: 
                    228: `-fsigned-char'
                    229:      Let the type `char' be signed, like `signed char'.
                    230: 
                    231:      Note that this is equivalent to `-fno-unsigned-char', which is the
1.1.1.5 ! root      232:      negative form of `-funsigned-char'.  Likewise, the option
        !           233:      `-fno-signed-char' is equivalent to `-funsigned-char'.
1.1.1.4   root      234: 
                    235: `-fsigned-bitfields'
                    236: `-funsigned-bitfields'
                    237: `-fno-signed-bitfields'
                    238: `-fno-unsigned-bitfields'
                    239:      These options control whether a bitfield is signed or unsigned,
1.1.1.5 ! root      240:      when the declaration does not use either `signed' or `unsigned'.
1.1.1.4   root      241:      By default, such a bitfield is signed, because this is consistent:
                    242:      the basic integer types such as `int' are signed types.
                    243: 
                    244:      However, when `-traditional' is used, bitfields are all unsigned
                    245:      no matter what.
                    246: 
                    247: `-fwritable-strings'
                    248:      Store string constants in the writable data segment and don't
                    249:      uniquize them.  This is for compatibility with old programs which
1.1.1.5 ! root      250:      assume they can write into string constants.  The option
        !           251:      `-traditional' also has this effect.
1.1.1.4   root      252: 
                    253:      Writing into string constants is a very bad idea; "constants"
                    254:      should be constant.
1.1       root      255: 
                    256: 
1.1.1.5 ! root      257: File: gcc.info,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
        !           258: 
        !           259: Options Controlling C++ Dialect
        !           260: ===============================
        !           261: 
        !           262:    This section describes the command-line options that are only
        !           263: meaningful for C++ programs; but you can also use most of the GNU
        !           264: compiler options regardless of what language your program is in.  For
        !           265: example, you might compile a file `firstClass.C' like this:
        !           266: 
        !           267:      g++ -g -felide-constructors -O -c firstClass.C
        !           268: 
        !           269: In this example, only `-felide-constructors' is an option meant only
        !           270: for C++ programs; you can use the other options with any language
        !           271: supported by GNU CC.
        !           272: 
        !           273:    Here is a list of options that are *only* for compiling C++ programs:
        !           274: 
        !           275: `-fall-virtual'
        !           276:      Treat all possible member functions as virtual, implicitly.  All
        !           277:      member functions (except for constructor functions and `new' or
        !           278:      `delete' member operators) are treated as virtual functions of the
        !           279:      class where they appear.
        !           280: 
        !           281:      This does not mean that all calls to these member functions will
        !           282:      be made through the internal table of virtual functions.  Under
        !           283:      some circumstances, the compiler can determine that a call to a
        !           284:      given virtual function can be made directly; in these cases the
        !           285:      calls are direct in any case.
        !           286: 
        !           287: `-fdollars-in-identifiers'
        !           288:      Accept `$' in identifiers.  You can also explicitly prohibit use of
        !           289:      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
        !           290:      allows `$' by default on some target systems but not others.)
        !           291:      Traditional C allowed the character `$' to form part of
        !           292:      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
        !           293: 
        !           294: `-felide-constructors'
        !           295:      Elide constructors when this seems plausible.  With this option,
        !           296:      GNU C++ initializes `y' directly from the call to `foo' without
        !           297:      going through a temporary in the following code:
        !           298: 
        !           299:           A foo ();
        !           300:           A y = foo ();
        !           301: 
        !           302:      Without this option, GNU C++ (1) initializes `y' by calling the
        !           303:      appropriate constructor for type `A'; (2) assigns the result of
        !           304:      `foo' to a temporary; and, finally, (3) replaces the initial value
        !           305:      of `y' with the temporary.
        !           306: 
        !           307:      The default behavior (`-fno-elide-constructors') is specified by
        !           308:      the draft ANSI C++ standard.  If your program's constructors have
        !           309:      side effects, `-felide-constructors' can change your program's
        !           310:      behavior, since some constructor calls may be omitted.
        !           311: 
        !           312: `-fenum-int-equiv'
        !           313:      Permit implicit conversion of `int' to enumeration types.  Normally
        !           314:      GNU C++ allows conversion of `enum' to `int', but not the other
        !           315:      way around.
        !           316: 
        !           317: `-fmemoize-lookups'
        !           318: `-fsave-memoized'
        !           319:      Use heuristics to compile faster.  These heuristics are not
        !           320:      enabled by default, since they are only effective for certain
        !           321:      input files.  Other input files compile more slowly.
        !           322: 
        !           323:      The first time the compiler must build a call to a member function
        !           324:      (or reference to a data member), it must (1) determine whether the
        !           325:      class implements member functions of that name; (2) resolve which
        !           326:      member function to call (which involves figuring out what sorts of
        !           327:      type conversions need to be made); and (3) check the visibility of
        !           328:      the member function to the caller.  All of this adds up to slower
        !           329:      compilation.  Normally, the second time a call is made to that
        !           330:      member function (or reference to that data member), it must go
        !           331:      through the same lengthy process again.  This means that code like
        !           332:      this:
        !           333: 
        !           334:           cout << "This " << p << " has " << n << " legs.\n";
        !           335: 
        !           336:      makes six passes through all three steps.  By using a software
        !           337:      cache, a "hit" significantly reduces this cost.  Unfortunately,
        !           338:      using the cache introduces another layer of mechanisms which must
        !           339:      be implemented, and so incurs its own overhead.
        !           340:      `-fmemoize-lookups' enables the software cache.
        !           341: 
        !           342:      Because access privileges (visibility) to members and member
        !           343:      functions may differ from one function context to the next, G++
        !           344:      may need to flush the cache.  With the `-fmemoize-lookups' flag,
        !           345:      the cache is flushed after every function that is compiled.  The
        !           346:      `-fsave-memoized' flag enables the same software cache, but when
        !           347:      the compiler determines that the context of the last function
        !           348:      compiled would yield the same access privileges of the next
        !           349:      function to compile, it preserves the cache.  This is most helpful
        !           350:      when defining many member functions for the same class: with the
        !           351:      exception of member functions which are friends of other classes,
        !           352:      each member function has exactly the same access privileges as
        !           353:      every other, and the cache need not be flushed.
        !           354: 
        !           355: `-fno-strict-prototype'
        !           356:      Treat a function declaration with no arguments, such as `int foo
        !           357:      ();', as C would treat it--as saying nothing about the number of
        !           358:      arguments or their types.  Normally, such a declaration in C++
        !           359:      means that the function `foo' takes no arguments.
        !           360: 
        !           361: `-fnonnull-objects'
        !           362:      Assume that objects reached through references are not null.
        !           363: 
        !           364:      Normally, GNU C++ makes conservative assumptions about objects
        !           365:      reached through references.  For example, the compiler must check
        !           366:      that `a' is not null in code like the following:
        !           367: 
        !           368:           obj &a = g ();
        !           369:           a.f (2);
        !           370: 
        !           371:      Checking that references of this sort have non-null values requires
        !           372:      extra code, however, and it is unnecessary for many programs.  You
        !           373:      can use `-fnonnull-objects' to omit the checks for null, if your
        !           374:      program doesn't require checking.
        !           375: 
        !           376: `-fthis-is-variable'
        !           377:      Permit assignment to `this'.  The incorporation of user-defined
        !           378:      free store management into C++ has made assignment to `this' an
        !           379:      anachronism.  Therefore, by default it is invalid to assign to
        !           380:      `this' within a class member function; that is, GNU C++ treats the
        !           381:      type of `this' in a member function of class `X' to be `X *const'.
        !           382:      However, for backwards compatibility, you can make it valid with
        !           383:      `-fthis-is-variable'.
        !           384: 
        !           385: `-nostdinc++'
        !           386:      Do not search for header files in the standard directories
        !           387:      specific to C++, but do still search the other standard
        !           388:      directories.  (This option is used when building libg++.)
        !           389: 
        !           390: `-traditional'
        !           391:      For C++ programs (in addition to the effects that apply to both C
        !           392:      and C++), this has the same effect as `-fthis-is-variable'.  *Note
        !           393:      Options Controlling C Dialect: C Dialect Options.
        !           394: 
        !           395:    In addition, these optimization, warning, and code generation options
        !           396: have meanings only for C++ programs:
        !           397: 
        !           398: `-fno-default-inline'
        !           399:      Do not assume `inline' for functions defined inside a class scope.
        !           400:      *Note Options That Control Optimization: Optimize Options.
        !           401: 
        !           402: `-Wenum-clash'
        !           403: `-Woverloaded-virtual'
        !           404: `-Wtemplate-debugging'
        !           405:      Warnings that apply only to C++ programs.  *Note Options to
        !           406:      Request or Suppress Warnings: Warning Options.
        !           407: 
        !           408: `+eN'
        !           409:      Control how virtual function definitions are used, in a fashion
        !           410:      compatible with `cfront' 1.x.  *Note Options for Code Generation
        !           411:      Conventions: Code Gen Options.
        !           412: 
        !           413: 
        !           414: File: gcc.info,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
1.1       root      415: 
                    416: Options to Request or Suppress Warnings
                    417: =======================================
                    418: 
1.1.1.3   root      419:    Warnings are diagnostic messages that report constructions which are
                    420: not inherently erroneous but which are risky or suggest there may have
                    421: been an error.
1.1       root      422: 
                    423:    You can request many specific warnings with options beginning `-W',
1.1.1.5 ! root      424: for example `-Wimplicit' to request warnings on implicit declarations.
1.1.1.3   root      425: Each of these specific warning options also has a negative form
1.1.1.5 ! root      426: beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
1.1       root      427: This manual lists only one of the two forms, whichever is not the
                    428: default.
                    429: 
                    430:    These options control the amount and kinds of warnings produced by
                    431: GNU CC:
                    432: 
                    433: `-fsyntax-only'
1.1.1.5 ! root      434:      Check the code for syntax errors, but don't do anything beyond
        !           435:      that.
1.1       root      436: 
                    437: `-w'
                    438:      Inhibit all warning messages.
                    439: 
1.1.1.4   root      440: `-Wno-import'
1.1.1.2   root      441:      Inhibit warning messages about the use of `#import'.
                    442: 
1.1       root      443: `-pedantic'
                    444:      Issue all the warnings demanded by strict ANSI standard C; reject
                    445:      all programs that use forbidden extensions.
                    446: 
                    447:      Valid ANSI standard C programs should compile properly with or
1.1.1.5 ! root      448:      without this option (though a rare few will require `-ansi').
1.1       root      449:      However, without this option, certain GNU extensions and
                    450:      traditional C features are supported as well.  With this option,
                    451:      they are rejected.
                    452: 
                    453:      `-pedantic' does not cause warning messages for use of the
                    454:      alternate keywords whose names begin and end with `__'.  Pedantic
                    455:      warnings are also disabled in the expression that follows
                    456:      `__extension__'.  However, only system header files should use
1.1.1.5 ! root      457:      these escape routes; application programs should avoid them.
        !           458:      *Note Alternate Keywords::.
1.1       root      459: 
1.1.1.3   root      460:      This option is not intended to be useful; it exists only to satisfy
                    461:      pedants who would otherwise claim that GNU CC fails to support the
                    462:      ANSI standard.
                    463: 
                    464:      Some users try to use `-pedantic' to check programs for strict ANSI
                    465:      C conformance.  They soon find that it does not do quite what they
                    466:      want: it finds some non-ANSI practices, but not all--only those
                    467:      for which ANSI C *requires* a diagnostic.
1.1       root      468: 
                    469:      A feature to report any failure to conform to ANSI C might be
                    470:      useful in some instances, but would require considerable
1.1.1.3   root      471:      additional work and would be quite different from `-pedantic'.  We
                    472:      recommend, rather, that users take advantage of the extensions of
                    473:      GNU C and disregard the limitations of other compilers.  Aside
1.1       root      474:      from certain supercomputers and obsolete small machines, there is
                    475:      less and less reason ever to use any other C compiler other than
                    476:      for bootstrapping GNU CC.
                    477: 
                    478: `-pedantic-errors'
                    479:      Like `-pedantic', except that errors are produced rather than
                    480:      warnings.
                    481: 
                    482: `-W'
                    483:      Print extra warning messages for these events:
                    484: 
1.1.1.3   root      485:         * A nonvolatile automatic variable might be changed by a call to
                    486:           `longjmp'.  These warnings as well are possible only in
1.1       root      487:           optimizing compilation.
                    488: 
                    489:           The compiler sees only the calls to `setjmp'.  It cannot know
                    490:           where `longjmp' will be called; in fact, a signal handler
1.1.1.3   root      491:           could call it at any point in the code.  As a result, you may
                    492:           get a warning even when there is in fact no problem because
                    493:           `longjmp' cannot in fact be called at the place which would
                    494:           cause a problem.
1.1       root      495: 
1.1.1.5 ! root      496:         * A function can return either with or without a value.
1.1       root      497:           (Falling off the end of the function body is considered
1.1.1.3   root      498:           returning without a value.)  For example, this function would
                    499:           evoke such a warning:
1.1       root      500: 
                    501:                foo (a)
                    502:                {
                    503:                  if (a > 0)
                    504:                    return a;
                    505:                }
                    506: 
                    507:         * An expression-statement contains no side effects.
                    508: 
                    509:         * An unsigned value is compared against zero with `>' or `<='.
                    510: 
1.1.1.4   root      511:         * A comparison like `x<=y<=z' appears; this is equivalent to
                    512:           `(x<=y ? 1 : 0) <= z', which is a different interpretation
                    513:           from that of ordinary mathematical notation.
                    514: 
                    515:         * Storage-class specifiers like `static' are not the first
                    516:           things in a declaration.  According to the C Standard, this
                    517:           usage is obsolescent.
                    518: 
1.1.1.5 ! root      519:         * An aggregate has a partly bracketed initializer.  For
        !           520:           example, the following code would evoke such a warning,
        !           521:           because braces are missing around the initializer for `x.h':
1.1.1.4   root      522: 
                    523:                struct s { int f, g; };
                    524:                struct t { struct s h; int i; };
                    525:                struct t x = { 1, 2, 3 };
                    526: 
1.1       root      527: `-Wimplicit'
                    528:      Warn whenever a function or parameter is implicitly declared.
                    529: 
                    530: `-Wreturn-type'
                    531:      Warn whenever a function is defined with a return-type that
                    532:      defaults to `int'.  Also warn about any `return' statement with no
                    533:      return-value in a function whose return-type is not `void'.
                    534: 
                    535: `-Wunused'
                    536:      Warn whenever a local variable is unused aside from its
                    537:      declaration, whenever a function is declared static but never
                    538:      defined, and whenever a statement computes a result that is
                    539:      explicitly not used.
                    540: 
1.1.1.4   root      541:      If you want to prevent a warning for a particular variable, you
                    542:      can use this macro:
                    543: 
                    544:           #define USE(var) \
                    545:             static void * use_##var = (&use_##var, (void *) &var)
                    546:           
                    547:           USE (string);
                    548: 
1.1       root      549: `-Wswitch'
                    550:      Warn whenever a `switch' statement has an index of enumeral type
                    551:      and lacks a `case' for one or more of the named codes of that
                    552:      enumeration.  (The presence of a `default' label prevents this
                    553:      warning.)  `case' labels outside the enumeration range also
                    554:      provoke warnings when this option is used.
                    555: 
                    556: `-Wcomment'
                    557:      Warn whenever a comment-start sequence `/*' appears in a comment.
                    558: 
                    559: `-Wtrigraphs'
                    560:      Warn if any trigraphs are encountered (assuming they are enabled).
                    561: 
                    562: `-Wformat'
                    563:      Check calls to `printf' and `scanf', etc., to make sure that the
                    564:      arguments supplied have types appropriate to the format string
                    565:      specified.
                    566: 
                    567: `-Wchar-subscripts'
1.1.1.3   root      568:      Warn if an array subscript has type `char'.  This is a common cause
                    569:      of error, as programmers often forget that this type is signed on
                    570:      some machines.
1.1       root      571: 
                    572: `-Wuninitialized'
                    573:      An automatic variable is used without first being initialized.
                    574: 
                    575:      These warnings are possible only in optimizing compilation,
                    576:      because they require data flow information that is computed only
                    577:      when optimizing.  If you don't specify `-O', you simply won't get
                    578:      these warnings.
                    579: 
                    580:      These warnings occur only for variables that are candidates for
                    581:      register allocation.  Therefore, they do not occur for a variable
                    582:      that is declared `volatile', or whose address is taken, or whose
1.1.1.3   root      583:      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
                    584:      structures, unions or arrays, even when they are in registers.
1.1       root      585: 
                    586:      Note that there may be no warning about a variable that is used
                    587:      only to compute a value that itself is never used, because such
                    588:      computations may be deleted by data flow analysis before the
                    589:      warnings are printed.
                    590: 
                    591:      These warnings are made optional because GNU CC is not smart
                    592:      enough to see all the reasons why the code might be correct
                    593:      despite appearing to have an error.  Here is one example of how
                    594:      this can happen:
                    595: 
                    596:           {
                    597:             int x;
                    598:             switch (y)
                    599:               {
                    600:               case 1: x = 1;
                    601:                 break;
                    602:               case 2: x = 4;
                    603:                 break;
                    604:               case 3: x = 5;
                    605:               }
                    606:             foo (x);
                    607:           }
                    608: 
                    609:      If the value of `y' is always 1, 2 or 3, then `x' is always
1.1.1.3   root      610:      initialized, but GNU CC doesn't know this.  Here is another common
                    611:      case:
1.1       root      612: 
                    613:           {
                    614:             int save_y;
                    615:             if (change_y) save_y = y, y = new_y;
                    616:             ...
                    617:             if (change_y) y = save_y;
                    618:           }
                    619: 
                    620:      This has no bug because `save_y' is used only if it is set.
                    621: 
1.1.1.5 ! root      622:      Some spurious warnings can be avoided if you declare all the
        !           623:      functions you use that never return as `volatile'.  *Note Function
1.1.1.3   root      624:      Attributes::.
1.1       root      625: 
1.1.1.2   root      626: `-Wparentheses'
1.1.1.5 ! root      627:      Warn if parentheses are omitted in certain contexts, such as when
        !           628:      there is an assignment in a context where a truth value is
        !           629:      expected, or when operators are nested whose precedence people
        !           630:      often get confused about.
        !           631: 
        !           632: `-Wenum-clash'
        !           633:      Warn about conversion between different enumeration types.  (C++
        !           634:      only).
        !           635: 
        !           636: `-Wtemplate-debugging'
        !           637:      When using templates in a C++ program, warn if debugging is not yet
        !           638:      fully available (C++ only).
1.1.1.2   root      639: 
1.1       root      640: `-Wall'
1.1.1.3   root      641:      All of the above `-W' options combined.  These are all the options
                    642:      which pertain to usage that we recommend avoiding and that we
                    643:      believe is easy to avoid, even in conjunction with macros.
1.1       root      644: 
                    645:    The remaining `-W...' options are not implied by `-Wall' because
                    646: they warn about constructions that we consider reasonable to use, on
                    647: occasion, in clean programs.
                    648: 
                    649: `-Wtraditional'
                    650:      Warn about certain constructs that behave differently in
                    651:      traditional and ANSI C.
                    652: 
                    653:         * Macro arguments occurring within string constants in the
1.1.1.5 ! root      654:           macro body.  These would substitute the argument in
1.1       root      655:           traditional C, but are part of the constant in ANSI C.
                    656: 
1.1.1.3   root      657:         * A function declared external in one block and then used after
                    658:           the end of the block.
1.1       root      659: 
                    660:         * A `switch' statement has an operand of type `long'.
                    661: 
                    662: `-Wshadow'
                    663:      Warn whenever a local variable shadows another local variable.
                    664: 
                    665: `-Wid-clash-LEN'
                    666:      Warn whenever two distinct identifiers match in the first LEN
                    667:      characters.  This may help you prepare a program that will compile
                    668:      with certain obsolete, brain-damaged compilers.
                    669: 
                    670: `-Wpointer-arith'
                    671:      Warn about anything that depends on the "size of" a function type
                    672:      or of `void'.  GNU C assigns these types a size of 1, for
1.1.1.3   root      673:      convenience in calculations with `void *' pointers and pointers to
                    674:      functions.
1.1       root      675: 
                    676: `-Wcast-qual'
                    677:      Warn whenever a pointer is cast so as to remove a type qualifier
                    678:      from the target type.  For example, warn if a `const char *' is
                    679:      cast to an ordinary `char *'.
                    680: 
                    681: `-Wcast-align'
                    682:      Warn whenever a pointer is cast such that the required alignment
                    683:      of the target is increased.  For example, warn if a `char *' is
1.1.1.3   root      684:      cast to an `int *' on machines where integers can only be accessed
                    685:      at two- or four-byte boundaries.
1.1       root      686: 
                    687: `-Wwrite-strings'
                    688:      Give string constants the type `const char[LENGTH]' so that
                    689:      copying the address of one into a non-`const' `char *' pointer
                    690:      will get a warning.  These warnings will help you find at compile
                    691:      time code that can try to write into a string constant, but only
                    692:      if you have been very careful about using `const' in declarations
                    693:      and prototypes.  Otherwise, it will just be a nuisance; this is
                    694:      why we did not make `-Wall' request these warnings.
                    695: 
                    696: `-Wconversion'
                    697:      Warn if a prototype causes a type conversion that is different
                    698:      from what would happen to the same argument in the absence of a
                    699:      prototype.  This includes conversions of fixed point to floating
                    700:      and vice versa, and conversions changing the width or signedness
                    701:      of a fixed point argument except when the same as the default
                    702:      promotion.
                    703: 
1.1.1.5 ! root      704:      Also, warn if a negative integer constant expression is implicitly
        !           705:      converted to an unsigned type.  For example, warn about the
        !           706:      assignment `x = -1' if `x' is unsigned.  But do not warn about
        !           707:      explicit casts like `(unsigned) -1'.
        !           708: 
1.1       root      709: `-Waggregate-return'
1.1.1.3   root      710:      Warn if any functions that return structures or unions are defined
                    711:      or called.  (In languages where you can return an array, this also
                    712:      elicits a warning.)
1.1       root      713: 
                    714: `-Wstrict-prototypes'
                    715:      Warn if a function is declared or defined without specifying the
                    716:      argument types.  (An old-style function definition is permitted
1.1.1.3   root      717:      without a warning if preceded by a declaration which specifies the
                    718:      argument types.)
1.1       root      719: 
                    720: `-Wmissing-prototypes'
                    721:      Warn if a global function is defined without a previous prototype
                    722:      declaration.  This warning is issued even if the definition itself
                    723:      provides a prototype.  The aim is to detect global functions that
                    724:      fail to be declared in header files.
                    725: 
                    726: `-Wredundant-decls'
                    727:      Warn if anything is declared more than once in the same scope,
                    728:      even in cases where multiple declaration is valid and changes
                    729:      nothing.
                    730: 
                    731: `-Wnested-externs'
                    732:      Warn if an `extern' declaration is encountered within an function.
                    733: 
1.1.1.2   root      734: `-Winline'
                    735:      Warn if a function can not be inlined, and either it was declared
                    736:      as inline, or else the `-finline-functions' option was given.
1.1       root      737: 
1.1.1.5 ! root      738: `-Woverloaded-virtual'
        !           739:      Warn when a derived class function declaration may be an error in
        !           740:      defining a virtual function (C++ only).  In a derived class, the
        !           741:      definitions of virtual functions must match the type signature of a
        !           742:      virtual function declared in the base class.  With this option, the
        !           743:      compiler warns when you define a function with the same name as a
        !           744:      virtual function, but with a type signature that does not match any
        !           745:      declarations from the base class.
        !           746: 
1.1       root      747: `-Werror'
                    748:      Make all warnings into errors.
                    749: 
                    750: 
                    751: File: gcc.info,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
                    752: 
                    753: Options for Debugging Your Program or GNU CC
                    754: ============================================
                    755: 
                    756:    GNU CC has various special options that are used for debugging
                    757: either your program or GCC:
                    758: 
                    759: `-g'
                    760:      Produce debugging information in the operating system's native
1.1.1.2   root      761:      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
1.1       root      762:      debugging information.
                    763: 
                    764:      On most systems that use stabs format, `-g' enables use of extra
1.1.1.3   root      765:      debugging information that only GDB can use; this extra information
1.1.1.4   root      766:      makes debugging work better in GDB but will probably make other
                    767:      debuggers crash or refuse to read the program.  If you want to
                    768:      control for certain whether to generate the extra information, use
                    769:      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
                    770:      `-gdwarf' (see below).
1.1       root      771: 
                    772:      Unlike most other C compilers, GNU CC allows you to use `-g' with
                    773:      `-O'.  The shortcuts taken by optimized code may occasionally
                    774:      produce surprising results: some variables you declared may not
                    775:      exist at all; flow of control may briefly move where you did not
                    776:      expect it; some statements may not be executed because they
                    777:      compute constant results or their values were already at hand;
                    778:      some statements may execute in different places because they were
                    779:      moved out of loops.
                    780: 
                    781:      Nevertheless it proves possible to debug optimized output.  This
                    782:      makes it reasonable to use the optimizer for programs that might
                    783:      have bugs.
                    784: 
                    785:      The following options are useful when GNU CC is generated with the
                    786:      capability for more than one debugging format.
                    787: 
                    788: `-ggdb'
                    789:      Produce debugging information in the native format (if that is
                    790:      supported), including GDB extensions if at all possible.
                    791: 
                    792: `-gstabs'
                    793:      Produce debugging information in stabs format (if that is
                    794:      supported), without GDB extensions.  This is the format used by
                    795:      DBX on most BSD systems.
                    796: 
                    797: `-gstabs+'
                    798:      Produce debugging information in stabs format (if that is
1.1.1.4   root      799:      supported), using GNU extensions understood only by the GNU
                    800:      debugger (GDB).  The use of these extensions is likely to make
                    801:      other debuggers crash or refuse to read the program.
1.1       root      802: 
                    803: `-gcoff'
                    804:      Produce debugging information in COFF format (if that is
1.1.1.5 ! root      805:      supported).  This is the format used by SDB on most System V
1.1.1.4   root      806:      systems prior to System V Release 4.
1.1       root      807: 
1.1.1.2   root      808: `-gxcoff'
                    809:      Produce debugging information in XCOFF format (if that is
1.1.1.5 ! root      810:      supported).  This is the format used by the DBX debugger on IBM
1.1.1.4   root      811:      RS/6000 systems.
                    812: 
                    813: `-gxcoff+'
                    814:      Produce debugging information in XCOFF format (if that is
                    815:      supported), using GNU extensions understood only by the GNU
                    816:      debugger (GDB).  The use of these extensions is likely to make
                    817:      other debuggers crash or refuse to read the program.
1.1.1.2   root      818: 
1.1       root      819: `-gdwarf'
                    820:      Produce debugging information in DWARF format (if that is
1.1.1.5 ! root      821:      supported).  This is the format used by SDB on most System V
1.1.1.4   root      822:      Release 4 systems.
                    823: 
                    824: `-gdwarf+'
                    825:      Produce debugging information in DWARF format (if that is
                    826:      supported), using GNU extensions understood only by the GNU
                    827:      debugger (GDB).  The use of these extensions is likely to make
                    828:      other debuggers crash or refuse to read the program.
1.1       root      829: 
                    830: `-gLEVEL'
                    831: `-ggdbLEVEL'
                    832: `-gstabsLEVEL'
                    833: `-gcoffLEVEL'
1.1.1.2   root      834: `-gxcoffLEVEL'
1.1       root      835: `-gdwarfLEVEL'
                    836:      Request debugging information and also use LEVEL to specify how
                    837:      much information.  The default level is 2.
                    838: 
1.1.1.3   root      839:      Level 1 produces minimal information, enough for making backtraces
                    840:      in parts of the program that you don't plan to debug.  This
                    841:      includes descriptions of functions and external variables, but no
                    842:      information about local variables and no line numbers.
1.1       root      843: 
                    844:      Level 3 includes extra information, such as all the macro
                    845:      definitions present in the program.  Some debuggers support macro
                    846:      expansion when you use `-g3'.
                    847: 
                    848: `-p'
                    849:      Generate extra code to write profile information suitable for the
1.1.1.5 ! root      850:      analysis program `prof'.  You must use this option when compiling
        !           851:      the source files you want data about, and you must also use it when
        !           852:      linking.
1.1       root      853: 
                    854: `-pg'
                    855:      Generate extra code to write profile information suitable for the
1.1.1.5 ! root      856:      analysis program `gprof'.  You must use this option when compiling
        !           857:      the source files you want data about, and you must also use it when
        !           858:      linking.
1.1       root      859: 
                    860: `-a'
                    861:      Generate extra code to write profile information for basic blocks,
1.1.1.3   root      862:      which will record the number of times each basic block is executed.
                    863:      This data could be analyzed by a program like `tcov'.  Note,
                    864:      however, that the format of the data is not what `tcov' expects.
                    865:      Eventually GNU `gprof' should be extended to process this data.
1.1       root      866: 
                    867: `-dLETTERS'
1.1.1.3   root      868:      Says to make debugging dumps during compilation at times specified
                    869:      by LETTERS.  This is used for debugging the compiler.  The file
                    870:      names for most of the dumps are made by appending a word to the
                    871:      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
                    872:      possible letters for use in LETTERS, and their meanings:
1.1       root      873: 
                    874:     `M'
                    875:           Dump all macro definitions, at the end of preprocessing, and
                    876:           write no output.
                    877: 
                    878:     `N'
                    879:           Dump all macro names, at the end of preprocessing.
                    880: 
                    881:     `D'
                    882:           Dump all macro definitions, at the end of preprocessing, in
                    883:           addition to normal output.
                    884: 
                    885:     `y'
                    886:           Dump debugging information during parsing, to standard error.
                    887: 
                    888:     `r'
                    889:           Dump after RTL generation, to `FILE.rtl'.
                    890: 
                    891:     `x'
1.1.1.5 ! root      892:           Just generate RTL for a function instead of compiling it.
1.1       root      893:           Usually used with `r'.
                    894: 
                    895:     `j'
                    896:           Dump after first jump optimization, to `FILE.jump'.
                    897: 
                    898:     `s'
1.1.1.3   root      899:           Dump after CSE (including the jump optimization that sometimes
                    900:           follows CSE), to `FILE.cse'.
1.1       root      901: 
                    902:     `L'
                    903:           Dump after loop optimization, to `FILE.loop'.
                    904: 
                    905:     `t'
                    906:           Dump after the second CSE pass (including the jump
                    907:           optimization that sometimes follows CSE), to `FILE.cse2'.
                    908: 
                    909:     `f'
                    910:           Dump after flow analysis, to `FILE.flow'.
                    911: 
                    912:     `c'
1.1.1.5 ! root      913:           Dump after instruction combination, to the file
        !           914:           `FILE.combine'.
1.1       root      915: 
                    916:     `S'
                    917:           Dump after the first instruction scheduling pass, to
                    918:           `FILE.sched'.
                    919: 
                    920:     `l'
1.1.1.5 ! root      921:           Dump after local register allocation, to `FILE.lreg'.
1.1       root      922: 
                    923:     `g'
1.1.1.5 ! root      924:           Dump after global register allocation, to `FILE.greg'.
1.1       root      925: 
                    926:     `R'
                    927:           Dump after the second instruction scheduling pass, to
                    928:           `FILE.sched2'.
                    929: 
                    930:     `J'
                    931:           Dump after last jump optimization, to `FILE.jump2'.
                    932: 
                    933:     `d'
                    934:           Dump after delayed branch scheduling, to `FILE.dbr'.
                    935: 
                    936:     `k'
                    937:           Dump after conversion from registers to stack, to
                    938:           `FILE.stack'.
                    939: 
                    940:     `a'
                    941:           Produce all the dumps listed above.
                    942: 
                    943:     `m'
                    944:           Print statistics on memory usage, at the end of the run, to
                    945:           standard error.
                    946: 
                    947:     `p'
                    948:           Annotate the assembler output with a comment indicating which
                    949:           pattern and alternative was used.
                    950: 
                    951: `-fpretend-float'
                    952:      When running a cross-compiler, pretend that the target machine
                    953:      uses the same floating point format as the host machine.  This
                    954:      causes incorrect output of the actual floating constants, but the
                    955:      actual instruction sequence will probably be the same as GNU CC
                    956:      would make when running on the target machine.
                    957: 
                    958: `-save-temps'
                    959:      Store the usual "temporary" intermediate files permanently; place
                    960:      them in the current directory and name them based on the source
1.1.1.3   root      961:      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
                    962:      files `foo.i' and `foo.s', as well as `foo.o'.
1.1       root      963: 
1.1.1.5 ! root      964: `-print-libgcc-file-name'
        !           965:      Print the full absolute name of the library file `libgcc.a' that
        !           966:      would be used when linking--and don't do anything else.  With this
        !           967:      option, GNU CC does not compile or link anything; it just prints
        !           968:      the file name.
        !           969: 
        !           970:      This is useful when you use `-nostdlib' but you do want to link
        !           971:      with `libgcc.a'.  You can do
        !           972: 
        !           973:           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
        !           974: 
1.1       root      975: 
                    976: File: gcc.info,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
                    977: 
                    978: Options That Control Optimization
                    979: =================================
                    980: 
                    981:    These options control various sorts of optimizations:
                    982: 
                    983: `-O'
1.1.1.4   root      984: `-O1'
1.1       root      985:      Optimize.  Optimizing compilation takes somewhat more time, and a
                    986:      lot more memory for a large function.
                    987: 
                    988:      Without `-O', the compiler's goal is to reduce the cost of
1.1.1.3   root      989:      compilation and to make debugging produce the expected results.
1.1       root      990:      Statements are independent: if you stop the program with a
                    991:      breakpoint between statements, you can then assign a new value to
                    992:      any variable or change the program counter to any other statement
                    993:      in the function and get exactly the results you would expect from
                    994:      the source code.
                    995: 
                    996:      Without `-O', only variables declared `register' are allocated in
                    997:      registers.  The resulting compiled code is a little worse than
                    998:      produced by PCC without `-O'.
                    999: 
                   1000:      With `-O', the compiler tries to reduce code size and execution
                   1001:      time.
                   1002: 
1.1.1.5 ! root     1003:      When `-O' is specified, the two options `-fthread-jumps' and
        !          1004:      `-fdelayed-branch' are turned on.  On some machines other flags may
        !          1005:      also be turned on.
1.1       root     1006: 
                   1007: `-O2'
1.1.1.3   root     1008:      Optimize even more.  Nearly all supported optimizations that do not
                   1009:      involve a space-speed tradeoff are performed.  As compared to `-O',
                   1010:      this option increases both compilation time and the performance of
                   1011:      the generated code.
                   1012: 
1.1.1.5 ! root     1013:      `-O2' turns on all optional optimizations except for loop unrolling
        !          1014:      and frame pointer elimination.
1.1       root     1015: 
1.1.1.4   root     1016: `-O0'
                   1017:      Do not optimize.
                   1018: 
                   1019:      If you use multiple `-O' options, with or without level numbers,
                   1020:      the last such option is the one that is effective.
                   1021: 
1.1.1.5 ! root     1022:    Options of the form `-fFLAG' specify machine-independent flags.
1.1       root     1023: Most flags have both positive and negative forms; the negative form of
1.1.1.3   root     1024: `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
1.1.1.5 ! root     1025: is listed--the one which is not the default.  You can figure out the
1.1.1.3   root     1026: other form by either removing `no-' or adding it.
1.1       root     1027: 
                   1028: `-ffloat-store'
1.1.1.4   root     1029:      Do not store floating point variables in registers, and inhibit
                   1030:      other options that might change whether a floating point value is
                   1031:      taken from a register or memory.
                   1032: 
                   1033:      This option prevents undesirable excess precision on machines such
                   1034:      as the 68000 where the floating registers (of the 68881) keep more
                   1035:      precision than a `double' is supposed to have.  For most programs,
                   1036:      the excess precision does only good, but a few programs rely on the
                   1037:      precise definition of IEEE floating point.  Use `-ffloat-store' for
                   1038:      such programs.
1.1       root     1039: 
1.1.1.5 ! root     1040: `-fno-default-inline'
        !          1041:      Do not make member functions inline by default merely because they
        !          1042:      are defined inside the class scope (C++ only).  Otherwise, when
        !          1043:      you specify `-O', member functions defined inside class scope are
        !          1044:      compiled inline by default; i.e., you don't need to add `inline'
        !          1045:      in front of the member function name.
        !          1046: 
1.1       root     1047: `-fno-defer-pop'
                   1048:      Always pop the arguments to each function call as soon as that
                   1049:      function returns.  For machines which must pop arguments after a
                   1050:      function call, the compiler normally lets arguments accumulate on
                   1051:      the stack for several function calls and pops them all at once.
                   1052: 
                   1053: `-fforce-mem'
                   1054:      Force memory operands to be copied into registers before doing
                   1055:      arithmetic on them.  This may produce better code by making all
                   1056:      memory references potential common subexpressions.  When they are
                   1057:      not common subexpressions, instruction combination should
                   1058:      eliminate the separate register-load.  I am interested in hearing
                   1059:      about the difference this makes.
                   1060: 
                   1061: `-fforce-addr'
                   1062:      Force memory address constants to be copied into registers before
                   1063:      doing arithmetic on them.  This may produce better code just as
                   1064:      `-fforce-mem' may.  I am interested in hearing about the
                   1065:      difference this makes.
                   1066: 
                   1067: `-fomit-frame-pointer'
                   1068:      Don't keep the frame pointer in a register for functions that
                   1069:      don't need one.  This avoids the instructions to save, set up and
                   1070:      restore frame pointers; it also makes an extra register available
                   1071:      in many functions.  *It also makes debugging impossible on some
                   1072:      machines.*
                   1073: 
1.1.1.3   root     1074:      On some machines, such as the Vax, this flag has no effect, because
                   1075:      the standard calling sequence automatically handles the frame
                   1076:      pointer and nothing is saved by pretending it doesn't exist.  The
                   1077:      machine-description macro `FRAME_POINTER_REQUIRED' controls
                   1078:      whether a target machine supports this flag.  *Note Registers::.
                   1079: 
                   1080: `-fno-inline'
                   1081:      Don't pay attention to the `inline' keyword.  Normally this option
                   1082:      is used to keep the compiler from expanding any functions inline.
1.1.1.4   root     1083:      Note that if you are not optimizing, no functions can be expanded
                   1084:      inline.
1.1       root     1085: 
                   1086: `-finline-functions'
                   1087:      Integrate all simple functions into their callers.  The compiler
1.1.1.3   root     1088:      heuristically decides which functions are simple enough to be worth
                   1089:      integrating in this way.
1.1       root     1090: 
                   1091:      If all calls to a given function are integrated, and the function
                   1092:      is declared `static', then the function is normally not output as
                   1093:      assembler code in its own right.
                   1094: 
                   1095: `-fkeep-inline-functions'
                   1096:      Even if all calls to a given function are integrated, and the
                   1097:      function is declared `static', nevertheless output a separate
                   1098:      run-time callable version of the function.
                   1099: 
                   1100: `-fno-function-cse'
                   1101:      Do not put function addresses in registers; make each instruction
                   1102:      that calls a constant function contain the function's address
                   1103:      explicitly.
                   1104: 
                   1105:      This option results in less efficient code, but some strange hacks
                   1106:      that alter the assembler output may be confused by the
                   1107:      optimizations performed when this option is not used.
                   1108: 
1.1.1.3   root     1109: `-ffast-math'
1.1.1.5 ! root     1110:      This option allows GCC to violate some ANSI or IEEE rules and/or
        !          1111:      specifications in the interest of optimizing code for speed.  For
        !          1112:      example, it allows the compiler to assume arguments to the `sqrt'
        !          1113:      function are non-negative numbers.
1.1.1.3   root     1114: 
                   1115:      This option should never be turned on by any `-O' option since it
                   1116:      can result in incorrect output for programs which depend on an
                   1117:      exact implementation of IEEE or ANSI rules/specifications for math
                   1118:      functions.
                   1119: 
1.1       root     1120:    The following options control specific optimizations.  The `-O2'
                   1121: option turns on all of these optimizations except `-funroll-loops' and
1.1.1.5 ! root     1122: `-funroll-all-loops'.  On most machines, the `-O' option turns on the
1.1       root     1123: `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
1.1.1.5 ! root     1124: may handle it differently.
1.1       root     1125: 
                   1126:    You can use the following flags in the rare cases when "fine-tuning"
                   1127: of optimizations to be performed is desired.
                   1128: 
                   1129: `-fstrength-reduce'
                   1130:      Perform the optimizations of loop strength reduction and
                   1131:      elimination of iteration variables.
                   1132: 
                   1133: `-fthread-jumps'
1.1.1.3   root     1134:      Perform optimizations where we check to see if a jump branches to a
1.1.1.5 ! root     1135:      location where another comparison subsumed by the first is found.
1.1.1.3   root     1136:      If so, the first branch is redirected to either the destination of
                   1137:      the second branch or a point immediately following it, depending
                   1138:      on whether the condition is known to be true or false.
1.1       root     1139: 
                   1140: `-fcse-follow-jumps'
1.1.1.3   root     1141:      In common subexpression elimination, scan through jump instructions
                   1142:      when the target of the jump is not reached by any other path.  For
                   1143:      example, when CSE encounters an `if' statement with an `else'
                   1144:      clause, CSE will follow the jump when the condition tested is
                   1145:      false.
                   1146: 
                   1147: `-fcse-skip-blocks'
                   1148:      This is similar to `-fcse-follow-jumps', but causes CSE to follow
                   1149:      jumps which conditionally skip over blocks.  When CSE encounters a
                   1150:      simple `if' statement with no else clause, `-fcse-skip-blocks'
                   1151:      causes CSE to follow the jump around the body of the `if'.
1.1       root     1152: 
                   1153: `-frerun-cse-after-loop'
                   1154:      Re-run common subexpression elimination after loop optimizations
                   1155:      has been performed.
                   1156: 
                   1157: `-fexpensive-optimizations'
                   1158:      Perform a number of minor optimizations that are relatively
                   1159:      expensive.
                   1160: 
                   1161: `-fdelayed-branch'
                   1162:      If supported for the target machine, attempt to reorder
                   1163:      instructions to exploit instruction slots available after delayed
                   1164:      branch instructions.
                   1165: 
                   1166: `-fschedule-insns'
                   1167:      If supported for the target machine, attempt to reorder
                   1168:      instructions to eliminate execution stalls due to required data
                   1169:      being unavailable.  This helps machines that have slow floating
                   1170:      point or memory load instructions by allowing other instructions
                   1171:      to be issued until the result of the load or floating point
                   1172:      instruction is required.
                   1173: 
                   1174: `-fschedule-insns2'
                   1175:      Similar to `-fschedule-insns', but requests an additional pass of
1.1.1.5 ! root     1176:      instruction scheduling after register allocation has been done.
1.1       root     1177:      This is especially useful on machines with a relatively small
                   1178:      number of registers and where memory load instructions take more
                   1179:      than one cycle.
                   1180: 
1.1.1.3   root     1181: `-fcaller-saves'
                   1182:      Enable values to be allocated in registers that will be clobbered
                   1183:      by function calls, by emitting extra instructions to save and
                   1184:      restore the registers around such calls.  Such allocation is done
                   1185:      only when it seems to result in better code than would otherwise
                   1186:      be produced.
                   1187: 
                   1188:      This option is enabled by default on certain machines, usually
                   1189:      those which have no call-preserved registers to use instead.
                   1190: 
1.1       root     1191: `-funroll-loops'
1.1.1.3   root     1192:      Perform the optimization of loop unrolling.  This is only done for
                   1193:      loops whose number of iterations can be determined at compile time
1.1.1.5 ! root     1194:      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
1.1       root     1195:      `-frerun-cse-after-loop'.
                   1196: 
                   1197: `-funroll-all-loops'
                   1198:      Perform the optimization of loop unrolling.  This is done for all
1.1.1.5 ! root     1199:      loops and usually makes programs run more slowly.
        !          1200:      `-funroll-all-loops' implies `-fstrength-reduce' as well as
1.1       root     1201:      `-frerun-cse-after-loop'.
                   1202: 
                   1203: `-fno-peephole'
                   1204:      Disable any machine-specific peephole optimizations.
                   1205: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.