home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / gnu / gcc-2.3.3-src.lha / src / amiga / gcc-2.3.3 / gcc.info-2 < prev    next >
Encoding:
GNU Info File  |  1994-02-07  |  47.0 KB  |  1,192 lines

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