home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / UNIX / GNU / gcc-2.7.2.3.1-I / info / gcc.info-3 < prev    next >
Encoding:
GNU Info File  |  1997-09-12  |  45.2 KB  |  1,165 lines

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