home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / gcc-2.5.8-bin.lha / info / gcc.info-2 (.txt) < prev    next >
GNU Info File  |  1994-02-21  |  43KB  |  803 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.55 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  23. Compiling C++ Programs
  24. ======================
  25.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  26. or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  27. recognizes files with these names and compiles them as C++ programs
  28. even if you call the compiler the same way as for compiling C programs
  29. (usually with the name `gcc').
  30.    However, C++ programs often require class libraries as well as a
  31. compiler that understands the C++ language--and under some
  32. circumstances, you might want to compile programs from standard input,
  33. or otherwise without a suffix that flags them as C++ programs.  `g++'
  34. is a shell script that calls GNU CC with the default language set to
  35. C++, and automatically specifies linking against the GNU class library
  36. libg++.  (1) On many systems, the script `g++' is also installed with
  37. the name `c++'.
  38.    When you compile C++ programs, you may specify many of the same
  39. command-line options that you use for compiling programs in any
  40. language; or command-line options meaningful for C and related
  41. languages; or options that are meaningful only for C++ programs.  *Note
  42. Options Controlling C Dialect: C Dialect Options, for explanations of
  43. options for languages related to C.  *Note Options Controlling C++
  44. Dialect: C++ Dialect Options, for explanations of options that are
  45. meaningful only for C++ programs.
  46.    ---------- Footnotes ----------
  47.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  48. compiler.  That version was based on GNU CC, but not integrated with
  49. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  50. version 1.37 or 1.42--are much less reliable than the versions
  51. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  52. GCC will simply not work.
  53. File: gcc.info,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  54. Options Controlling C Dialect
  55. =============================
  56.    The following options control the dialect of C (or languages derived
  57. from C, such as C++ and Objective C) that the compiler accepts:
  58. `-ansi'
  59.      Support all ANSI standard C programs.
  60.      This turns off certain features of GNU C that are incompatible
  61.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  62.      predefined macros such as `unix' and `vax' that identify the type
  63.      of system you are using.  It also enables the undesirable and
  64.      rarely used ANSI trigraph feature, and disallows `$' as part of
  65.      identifiers.
  66.      The alternate keywords `__asm__', `__extension__', `__inline__'
  67.      and `__typeof__' continue to work despite `-ansi'.  You would not
  68.      want to use them in an ANSI C program, of course, but it useful to
  69.      put them in header files that might be included in compilations
  70.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  71.      and `__vax__' are also available, with or without `-ansi'.
  72.      The `-ansi' option does not cause non-ANSI programs to be rejected
  73.      gratuitously.  For that, `-pedantic' is required in addition to
  74.      `-ansi'.  *Note Warning Options::.
  75.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  76.      is used.  Some header files may notice this macro and refrain from
  77.      declaring certain functions or defining certain macros that the
  78.      ANSI standard doesn't call for; this is to avoid interfering with
  79.      any programs that might use these names for other things.
  80.      The functions `alloca', `abort', `exit', and `_exit' are not
  81.      builtin functions when `-ansi' is used.
  82. `-fno-asm'
  83.      Do not recognize `asm', `inline' or `typeof' as a keyword.  These
  84.      words may then be used as identifiers.  You can use the keywords
  85.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  86.      `-fno-asm'.
  87. `-fno-builtin'
  88.      Don't recognize builtin functions that do not begin with two
  89.      leading underscores.  Currently, the functions affected include
  90.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  91.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  92.      `strlen'.
  93.      GCC normally generates special code to handle certain builtin
  94.      functions more efficiently; for instance, calls to `alloca' may
  95.      become single instructions that adjust the stack directly, and
  96.      calls to `memcpy' may become inline copy loops.  The resulting
  97.      code is often both smaller and faster, but since the function
  98.      calls no longer appear as such, you cannot set a breakpoint on
  99.      those calls, nor can you change the behavior of the functions by
  100.      linking with a different library.
  101.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  102.      functions, since these functions do not have an ANSI standard
  103.      meaning.
  104. `-trigraphs'
  105.      Support ANSI C trigraphs.  You don't want to know about this
  106.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  107. `-traditional'
  108.      Attempt to support some aspects of traditional C compilers.
  109.      Specifically:
  110.         * All `extern' declarations take effect globally even if they
  111.           are written inside of a function definition.  This includes
  112.           implicit declarations of functions.
  113.         * The newer keywords `typeof', `inline', `signed', `const' and
  114.           `volatile' are not recognized.  (You can still use the
  115.           alternative keywords such as `__typeof__', `__inline__', and
  116.           so on.)
  117.         * Comparisons between pointers and integers are always allowed.
  118.         * Integer types `unsigned short' and `unsigned char' promote to
  119.           `unsigned int'.
  120.         * Out-of-range floating point literals are not an error.
  121.         * Certain constructs which ANSI regards as a single invalid
  122.           preprocessing number, such as `0xe-0xd', are treated as
  123.           expressions instead.
  124.         * String "constants" are not necessarily constant; they are
  125.           stored in writable space, and identical looking constants are
  126.           allocated separately.  (This is the same as the effect of
  127.           `-fwritable-strings'.)
  128.         * All automatic variables not declared `register' are preserved
  129.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  130.           variables not declared `volatile' may be clobbered.
  131.         * In the preprocessor, comments convert to nothing at all,
  132.           rather than to a space.  This allows traditional token
  133.           concatenation.
  134.         * In the preprocessor, macro arguments are recognized within
  135.           string constants in a macro definition (and their values are
  136.           stringified, though without additional quote marks, when they
  137.           appear in such a context).  The preprocessor always considers
  138.           a string constant to end at a newline.
  139.         * The predefined macro `__STDC__' is not defined when you use
  140.           `-traditional', but `__GNUC__' is (since the GNU extensions
  141.           which `__GNUC__' indicates are not affected by
  142.           `-traditional').  If you need to write header files that work
  143.           differently depending on whether `-traditional' is in use, by
  144.           testing both of these predefined macros you can distinguish
  145.           four situations: GNU C, traditional GNU C, other ANSI C
  146.           compilers, and other old C compilers.  *Note Standard
  147.           Predefined Macros: (cpp.info)Standard Predefined, for more
  148.           discussion of these and other predefined macros.
  149.         * The preprocessor considers a string constant to end at a
  150.           newline (unless the newline is escaped with `\').  (Without
  151.           `-traditional', string constants can contain the newline
  152.           character as typed.)
  153.         * The character escape sequences `\x' and `\a' evaluate as the
  154.           literal characters `x' and `a' respectively.  Without
  155.           `-traditional', `\x' is a prefix for the hexadecimal
  156.           representation of a character, and `\a' produces a bell.
  157.         * In C++ programs, assignment to `this' is permitted with
  158.           `-traditional'.  (The option `-fthis-is-variable' also has
  159.           this effect.)
  160.      You may wish to use `-fno-builtin' as well as `-traditional' if
  161.      your program uses names that are normally GNU C builtin functions
  162.      for other purposes of its own.
  163. `-traditional-cpp'
  164.      Attempt to support some aspects of traditional C preprocessors.
  165.      This includes the last three items in the table immediately above,
  166.      but none of the other effects of `-traditional'.
  167. `-fcond-mismatch'
  168.      Allow conditional expressions with mismatched types in the second
  169.      and third arguments.  The value of such an expression is void.
  170. `-funsigned-char'
  171.      Let the type `char' be unsigned, like `unsigned char'.
  172.      Each kind of machine has a default for what `char' should be.  It
  173.      is either like `unsigned char' by default or like `signed char' by
  174.      default.
  175.      Ideally, a portable program should always use `signed char' or
  176.      `unsigned char' when it depends on the signedness of an object.
  177.      But many programs have been written to use plain `char' and expect
  178.      it to be signed, or expect it to be unsigned, depending on the
  179.      machines they were written for.  This option, and its inverse, let
  180.      you make such a program work with the opposite default.
  181.      The type `char' is always a distinct type from each of `signed
  182.      char' or `unsigned char', even though its behavior is always just
  183.      like one of those two.
  184. `-fsigned-char'
  185.      Let the type `char' be signed, like `signed char'.
  186.      Note that this is equivalent to `-fno-unsigned-char', which is the
  187.      negative form of `-funsigned-char'.  Likewise, the option
  188.      `-fno-signed-char' is equivalent to `-funsigned-char'.
  189. `-fsigned-bitfields'
  190. `-funsigned-bitfields'
  191. `-fno-signed-bitfields'
  192. `-fno-unsigned-bitfields'
  193.      These options control whether a bitfield is signed or unsigned,
  194.      when the declaration does not use either `signed' or `unsigned'.
  195.      By default, such a bitfield is signed, because this is consistent:
  196.      the basic integer types such as `int' are signed types.
  197.      However, when `-traditional' is used, bitfields are all unsigned
  198.      no matter what.
  199. `-fwritable-strings'
  200.      Store string constants in the writable data segment and don't
  201.      uniquize them.  This is for compatibility with old programs which
  202.      assume they can write into string constants.  The option
  203.      `-traditional' also has this effect.
  204.      Writing into string constants is a very bad idea; "constants"
  205.      should be constant.
  206. `-fallow-single-precision'
  207.      Do not promote single precision math operations to double
  208.      precision, even when compiling with `-traditional'.
  209.      Traditional K&R C promotes all floating point operations to double
  210.      precision, regardless of the sizes of the operands.   On the
  211.      architecture for which you are compiling, single precision may be
  212.      faster than double precision.   If you must use `-traditional',
  213.      but want to use single precision operations when the operands are
  214.      single precision, use this option.   This option has no effect
  215.      when compiling with ANSI or GNU C conventions (the default).
  216. File: gcc.info,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
  217. Options Controlling C++ Dialect
  218. ===============================
  219.    This section describes the command-line options that are only
  220. meaningful for C++ programs; but you can also use most of the GNU
  221. compiler options regardless of what language your program is in.  For
  222. example, you might compile a file `firstClass.C' like this:
  223.      g++ -g -felide-constructors -O -c firstClass.C
  224. In this example, only `-felide-constructors' is an option meant only
  225. for C++ programs; you can use the other options with any language
  226. supported by GNU CC.
  227.    Here is a list of options that are *only* for compiling C++ programs:
  228. `-fall-virtual'
  229.      Treat all possible member functions as virtual, implicitly.  All
  230.      member functions (except for constructor functions and `new' or
  231.      `delete' member operators) are treated as virtual functions of the
  232.      class where they appear.
  233.      This does not mean that all calls to these member functions will
  234.      be made through the internal table of virtual functions.  Under
  235.      some circumstances, the compiler can determine that a call to a
  236.      given virtual function can be made directly; in these cases the
  237.      calls are direct in any case.
  238. `-fdollars-in-identifiers'
  239.      Accept `$' in identifiers.  You can also explicitly prohibit use of
  240.      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
  241.      allows `$' by default on some target systems but not others.)
  242.      Traditional C allowed the character `$' to form part of
  243.      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
  244. `-felide-constructors'
  245.      Elide constructors when this seems plausible.  With this option,
  246.      GNU C++ initializes `y' directly from the call to `foo' without
  247.      going through a temporary in the following code:
  248.           A foo ();
  249.           A y = foo ();
  250.      Without this option, GNU C++ (1) initializes `y' by calling the
  251.      appropriate constructor for type `A'; (2) assigns the result of
  252.      `foo' to a temporary; and, finally, (3) replaces the initial value
  253.      of `y' with the temporary.
  254.      The default behavior (`-fno-elide-constructors') is specified by
  255.      the draft ANSI C++ standard.  If your program's constructors have
  256.      side effects, `-felide-constructors' can change your program's
  257.      behavior, since some constructor calls may be omitted.
  258. `-fenum-int-equiv'
  259.      Permit implicit conversion of `int' to enumeration types.  Normally
  260.      GNU C++ allows conversion of `enum' to `int', but not the other
  261.      way around.
  262. `-fexternal-templates'
  263.      Produce smaller code for template declarations, by generating only
  264.      a single copy of each template function where it is defined.  To
  265.      use this option successfully, you must also mark all files that
  266.      use templates with either `#pragma implementation' (the
  267.      definition) or `#pragma interface' (declarations).  *Note
  268.      Declarations and Definitions in One Header: C++ Interface, for more
  269.      discussion of these pragmas.
  270.      When your code is compiled with `-fexternal-templates', all
  271.      template instantiations are external.  You must arrange for all
  272.      necessary instantiations to appear in the implementation file; you
  273.      can do this with a `typedef' that references each instantiation
  274.      needed.  Conversely, when you compile using the default option
  275.      `-fno-external-templates', all template instantiations are
  276.      explicitly internal.
  277.      You do not need to specify `-fexternal-templates' when compiling a
  278.      file that does not define and instantiate templates used in other
  279.      files, even if your file *uses* templates defined in other files
  280.      that are compiled with `-fexternal-templates'.  The only side
  281.      effect is an increase in object size for each file that you
  282.      compile without `-fexternal-templates'.
  283. `-fmemoize-lookups'
  284. `-fsave-memoized'
  285.      Use heuristics to compile faster.  These heuristics are not
  286.      enabled by default, since they are only effective for certain
  287.      input files.  Other input files compile more slowly.
  288.      The first time the compiler must build a call to a member function
  289.      (or reference to a data member), it must (1) determine whether the
  290.      class implements member functions of that name; (2) resolve which
  291.      member function to call (which involves figuring out what sorts of
  292.      type conversions need to be made); and (3) check the visibility of
  293.      the member function to the caller.  All of this adds up to slower
  294.      compilation.  Normally, the second time a call is made to that
  295.      member function (or reference to that data member), it must go
  296.      through the same lengthy process again.  This means that code like
  297.      this:
  298.           cout << "This " << p << " has " << n << " legs.\n";
  299.      makes six passes through all three steps.  By using a software
  300.      cache, a "hit" significantly reduces this cost.  Unfortunately,
  301.      using the cache introduces another layer of mechanisms which must
  302.      be implemented, and so incurs its own overhead.
  303.      `-fmemoize-lookups' enables the software cache.
  304.      Because access privileges (visibility) to members and member
  305.      functions may differ from one function context to the next, G++
  306.      may need to flush the cache.  With the `-fmemoize-lookups' flag,
  307.      the cache is flushed after every function that is compiled.  The
  308.      `-fsave-memoized' flag enables the same software cache, but when
  309.      the compiler determines that the context of the last function
  310.      compiled would yield the same access privileges of the next
  311.      function to compile, it preserves the cache.  This is most helpful
  312.      when defining many member functions for the same class: with the
  313.      exception of member functions which are friends of other classes,
  314.      each member function has exactly the same access privileges as
  315.      every other, and the cache need not be flushed.
  316. `-fno-strict-prototype'
  317.      Treat a function declaration with no arguments, such as `int foo
  318.      ();', as C would treat it--as saying nothing about the number of
  319.      arguments or their types.  Normally, such a declaration in C++
  320.      means that the function `foo' takes no arguments.
  321. `-fnonnull-objects'
  322.      Assume that objects reached through references are not null.
  323.      Normally, GNU C++ makes conservative assumptions about objects
  324.      reached through references.  For example, the compiler must check
  325.      that `a' is not null in code like the following:
  326.           obj &a = g ();
  327.           a.f (2);
  328.      Checking that references of this sort have non-null values requires
  329.      extra code, however, and it is unnecessary for many programs.  You
  330.      can use `-fnonnull-objects' to omit the checks for null, if your
  331.      program doesn't require checking.
  332. `-fthis-is-variable'
  333.      Permit assignment to `this'.  The incorporation of user-defined
  334.      free store management into C++ has made assignment to `this' an
  335.      anachronism.  Therefore, by default it is invalid to assign to
  336.      `this' within a class member function; that is, GNU C++ treats the
  337.      type of `this' in a member function of class `X' to be `X *const'.
  338.      However, for backwards compatibility, you can make it valid with
  339.      `-fthis-is-variable'.
  340. `-nostdinc++'
  341.      Do not search for header files in the standard directories
  342.      specific to C++, but do still search the other standard
  343.      directories.  (This option is used when building libg++.)
  344. `-traditional'
  345.      For C++ programs (in addition to the effects that apply to both C
  346.      and C++), this has the same effect as `-fthis-is-variable'.  *Note
  347.      Options Controlling C Dialect: C Dialect Options.
  348.    In addition, these optimization, warning, and code generation options
  349. have meanings only for C++ programs:
  350. `-fno-default-inline'
  351.      Do not assume `inline' for functions defined inside a class scope.
  352.      *Note Options That Control Optimization: Optimize Options.
  353. `-Wenum-clash'
  354. `-Woverloaded-virtual'
  355. `-Wtemplate-debugging'
  356.      Warnings that apply only to C++ programs.  *Note Options to
  357.      Request or Suppress Warnings: Warning Options.
  358. `+eN'
  359.      Control how virtual function definitions are used, in a fashion
  360.      compatible with `cfront' 1.x.  *Note Options for Code Generation
  361.      Conventions: Code Gen Options.
  362. File: gcc.info,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
  363. Options to Request or Suppress Warnings
  364. =======================================
  365.    Warnings are diagnostic messages that report constructions which are
  366. not inherently erroneous but which are risky or suggest there may have
  367. been an error.
  368.    You can request many specific warnings with options beginning `-W',
  369. for example `-Wimplicit' to request warnings on implicit declarations.
  370. Each of these specific warning options also has a negative form
  371. beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
  372. This manual lists only one of the two forms, whichever is not the
  373. default.
  374.    These options control the amount and kinds of warnings produced by
  375. GNU CC:
  376. `-fsyntax-only'
  377.      Check the code for syntax errors, but don't do anything beyond
  378.      that.
  379.      Inhibit all warning messages.
  380. `-Wno-import'
  381.      Inhibit warning messages about the use of `#import'.
  382. `-pedantic'
  383.      Issue all the warnings demanded by strict ANSI standard C; reject
  384.      all programs that use forbidden extensions.
  385.      Valid ANSI standard C programs should compile properly with or
  386.      without this option (though a rare few will require `-ansi').
  387.      However, without this option, certain GNU extensions and
  388.      traditional C features are supported as well.  With this option,
  389.      they are rejected.
  390.      `-pedantic' does not cause warning messages for use of the
  391.      alternate keywords whose names begin and end with `__'.  Pedantic
  392.      warnings are also disabled in the expression that follows
  393.      `__extension__'.  However, only system header files should use
  394.      these escape routes; application programs should avoid them.
  395.      *Note Alternate Keywords::.
  396.      This option is not intended to be useful; it exists only to satisfy
  397.      pedants who would otherwise claim that GNU CC fails to support the
  398.      ANSI standard.
  399.      Some users try to use `-pedantic' to check programs for strict ANSI
  400.      C conformance.  They soon find that it does not do quite what they
  401.      want: it finds some non-ANSI practices, but not all--only those
  402.      for which ANSI C *requires* a diagnostic.
  403.      A feature to report any failure to conform to ANSI C might be
  404.      useful in some instances, but would require considerable
  405.      additional work and would be quite different from `-pedantic'.  We
  406.      recommend, rather, that users take advantage of the extensions of
  407.      GNU C and disregard the limitations of other compilers.  Aside
  408.      from certain supercomputers and obsolete small machines, there is
  409.      less and less reason ever to use any other C compiler other than
  410.      for bootstrapping GNU CC.
  411. `-pedantic-errors'
  412.      Like `-pedantic', except that errors are produced rather than
  413.      warnings.
  414.      Print extra warning messages for these events:
  415.         * A nonvolatile automatic variable might be changed by a call to
  416.           `longjmp'.  These warnings as well are possible only in
  417.           optimizing compilation.
  418.           The compiler sees only the calls to `setjmp'.  It cannot know
  419.           where `longjmp' will be called; in fact, a signal handler
  420.           could call it at any point in the code.  As a result, you may
  421.           get a warning even when there is in fact no problem because
  422.           `longjmp' cannot in fact be called at the place which would
  423.           cause a problem.
  424.         * A function can return either with or without a value.
  425.           (Falling off the end of the function body is considered
  426.           returning without a value.)  For example, this function would
  427.           evoke such a warning:
  428.                foo (a)
  429.                {
  430.                  if (a > 0)
  431.                    return a;
  432.                }
  433.         * An expression-statement contains no side effects.
  434.         * An unsigned value is compared against zero with `>' or `<='.
  435.         * A comparison like `x<=y<=z' appears; this is equivalent to
  436.           `(x<=y ? 1 : 0) <= z', which is a different interpretation
  437.           from that of ordinary mathematical notation.
  438.         * Storage-class specifiers like `static' are not the first
  439.           things in a declaration.  According to the C Standard, this
  440.           usage is obsolescent.
  441.         * An aggregate has a partly bracketed initializer.  For
  442.           example, the following code would evoke such a warning,
  443.           because braces are missing around the initializer for `x.h':
  444.                struct s { int f, g; };
  445.                struct t { struct s h; int i; };
  446.                struct t x = { 1, 2, 3 };
  447. `-Wimplicit'
  448.      Warn whenever a function or parameter is implicitly declared.
  449. `-Wreturn-type'
  450.      Warn whenever a function is defined with a return-type that
  451.      defaults to `int'.  Also warn about any `return' statement with no
  452.      return-value in a function whose return-type is not `void'.
  453. `-Wunused'
  454.      Warn whenever a local variable is unused aside from its
  455.      declaration, whenever a function is declared static but never
  456.      defined, and whenever a statement computes a result that is
  457.      explicitly not used.
  458.      If you want to prevent a warning for a particular variable, you
  459.      can use this macro:
  460.           #define USE(var) \
  461.             static void * use_##var = (&use_##var, (void *) &var)
  462.           
  463.           USE (string);
  464. `-Wswitch'
  465.      Warn whenever a `switch' statement has an index of enumeral type
  466.      and lacks a `case' for one or more of the named codes of that
  467.      enumeration.  (The presence of a `default' label prevents this
  468.      warning.)  `case' labels outside the enumeration range also
  469.      provoke warnings when this option is used.
  470. `-Wcomment'
  471.      Warn whenever a comment-start sequence `/*' appears in a comment.
  472. `-Wtrigraphs'
  473.      Warn if any trigraphs are encountered (assuming they are enabled).
  474. `-Wformat'
  475.      Check calls to `printf' and `scanf', etc., to make sure that the
  476.      arguments supplied have types appropriate to the format string
  477.      specified.
  478. `-Wchar-subscripts'
  479.      Warn if an array subscript has type `char'.  This is a common cause
  480.      of error, as programmers often forget that this type is signed on
  481.      some machines.
  482. `-Wuninitialized'
  483.      An automatic variable is used without first being initialized.
  484.      These warnings are possible only in optimizing compilation,
  485.      because they require data flow information that is computed only
  486.      when optimizing.  If you don't specify `-O', you simply won't get
  487.      these warnings.
  488.      These warnings occur only for variables that are candidates for
  489.      register allocation.  Therefore, they do not occur for a variable
  490.      that is declared `volatile', or whose address is taken, or whose
  491.      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  492.      structures, unions or arrays, even when they are in registers.
  493.      Note that there may be no warning about a variable that is used
  494.      only to compute a value that itself is never used, because such
  495.      computations may be deleted by data flow analysis before the
  496.      warnings are printed.
  497.      These warnings are made optional because GNU CC is not smart
  498.      enough to see all the reasons why the code might be correct
  499.      despite appearing to have an error.  Here is one example of how
  500.      this can happen:
  501.           {
  502.             int x;
  503.             switch (y)
  504.               {
  505.               case 1: x = 1;
  506.                 break;
  507.               case 2: x = 4;
  508.                 break;
  509.               case 3: x = 5;
  510.               }
  511.             foo (x);
  512.           }
  513.      If the value of `y' is always 1, 2 or 3, then `x' is always
  514.      initialized, but GNU CC doesn't know this.  Here is another common
  515.      case:
  516.           {
  517.             int save_y;
  518.             if (change_y) save_y = y, y = new_y;
  519.             ...
  520.             if (change_y) y = save_y;
  521.           }
  522.      This has no bug because `save_y' is used only if it is set.
  523.      Some spurious warnings can be avoided if you declare all the
  524.      functions you use that never return as `volatile'.  *Note Function
  525.      Attributes::.
  526. `-Wparentheses'
  527.      Warn if parentheses are omitted in certain contexts, such as when
  528.      there is an assignment in a context where a truth value is
  529.      expected, or when operators are nested whose precedence people
  530.      often get confused about.
  531. `-Wenum-clash'
  532.      Warn about conversion between different enumeration types.  (C++
  533.      only).
  534. `-Wtemplate-debugging'
  535.      When using templates in a C++ program, warn if debugging is not yet
  536.      fully available (C++ only).
  537. `-Wall'
  538.      All of the above `-W' options combined.  These are all the options
  539.      which pertain to usage that we recommend avoiding and that we
  540.      believe is easy to avoid, even in conjunction with macros.
  541.    The remaining `-W...' options are not implied by `-Wall' because
  542. they warn about constructions that we consider reasonable to use, on
  543. occasion, in clean programs.
  544. `-Wtraditional'
  545.      Warn about certain constructs that behave differently in
  546.      traditional and ANSI C.
  547.         * Macro arguments occurring within string constants in the
  548.           macro body.  These would substitute the argument in
  549.           traditional C, but are part of the constant in ANSI C.
  550.         * A function declared external in one block and then used after
  551.           the end of the block.
  552.         * A `switch' statement has an operand of type `long'.
  553. `-Wshadow'
  554.      Warn whenever a local variable shadows another local variable.
  555. `-Wid-clash-LEN'
  556.      Warn whenever two distinct identifiers match in the first LEN
  557.      characters.  This may help you prepare a program that will compile
  558.      with certain obsolete, brain-damaged compilers.
  559. `-Wpointer-arith'
  560.      Warn about anything that depends on the "size of" a function type
  561.      or of `void'.  GNU C assigns these types a size of 1, for
  562.      convenience in calculations with `void *' pointers and pointers to
  563.      functions.
  564. `-Wcast-qual'
  565.      Warn whenever a pointer is cast so as to remove a type qualifier
  566.      from the target type.  For example, warn if a `const char *' is
  567.      cast to an ordinary `char *'.
  568. `-Wcast-align'
  569.      Warn whenever a pointer is cast such that the required alignment
  570.      of the target is increased.  For example, warn if a `char *' is
  571.      cast to an `int *' on machines where integers can only be accessed
  572.      at two- or four-byte boundaries.
  573. `-Wwrite-strings'
  574.      Give string constants the type `const char[LENGTH]' so that
  575.      copying the address of one into a non-`const' `char *' pointer
  576.      will get a warning.  These warnings will help you find at compile
  577.      time code that can try to write into a string constant, but only
  578.      if you have been very careful about using `const' in declarations
  579.      and prototypes.  Otherwise, it will just be a nuisance; this is
  580.      why we did not make `-Wall' request these warnings.
  581. `-Wconversion'
  582.      Warn if a prototype causes a type conversion that is different
  583.      from what would happen to the same argument in the absence of a
  584.      prototype.  This includes conversions of fixed point to floating
  585.      and vice versa, and conversions changing the width or signedness
  586.      of a fixed point argument except when the same as the default
  587.      promotion.
  588.      Also, warn if a negative integer constant expression is implicitly
  589.      converted to an unsigned type.  For example, warn about the
  590.      assignment `x = -1' if `x' is unsigned.  But do not warn about
  591.      explicit casts like `(unsigned) -1'.
  592. `-Waggregate-return'
  593.      Warn if any functions that return structures or unions are defined
  594.      or called.  (In languages where you can return an array, this also
  595.      elicits a warning.)
  596. `-Wstrict-prototypes'
  597.      Warn if a function is declared or defined without specifying the
  598.      argument types.  (An old-style function definition is permitted
  599.      without a warning if preceded by a declaration which specifies the
  600.      argument types.)
  601. `-Wmissing-prototypes'
  602.      Warn if a global function is defined without a previous prototype
  603.      declaration.  This warning is issued even if the definition itself
  604.      provides a prototype.  The aim is to detect global functions that
  605.      fail to be declared in header files.
  606. `-Wredundant-decls'
  607.      Warn if anything is declared more than once in the same scope,
  608.      even in cases where multiple declaration is valid and changes
  609.      nothing.
  610. `-Wnested-externs'
  611.      Warn if an `extern' declaration is encountered within an function.
  612. `-Winline'
  613.      Warn if a function can not be inlined, and either it was declared
  614.      as inline, or else the `-finline-functions' option was given.
  615. `-Woverloaded-virtual'
  616.      Warn when a derived class function declaration may be an error in
  617.      defining a virtual function (C++ only).  In a derived class, the
  618.      definitions of virtual functions must match the type signature of a
  619.      virtual function declared in the base class.  With this option, the
  620.      compiler warns when you define a function with the same name as a
  621.      virtual function, but with a type signature that does not match any
  622.      declarations from the base class.
  623. `-Werror'
  624.      Make all warnings into errors.
  625. File: gcc.info,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  626. Options for Debugging Your Program or GNU CC
  627. ============================================
  628.    GNU CC has various special options that are used for debugging
  629. either your program or GCC:
  630.      Produce debugging information in the operating system's native
  631.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  632.      debugging information.
  633.      On most systems that use stabs format, `-g' enables use of extra
  634.      debugging information that only GDB can use; this extra information
  635.      makes debugging work better in GDB but will probably make other
  636.      debuggers crash or refuse to read the program.  If you want to
  637.      control for certain whether to generate the extra information, use
  638.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
  639.      `-gdwarf' (see below).
  640.      Unlike most other C compilers, GNU CC allows you to use `-g' with
  641.      `-O'.  The shortcuts taken by optimized code may occasionally
  642.      produce surprising results: some variables you declared may not
  643.      exist at all; flow of control may briefly move where you did not
  644.      expect it; some statements may not be executed because they
  645.      compute constant results or their values were already at hand;
  646.      some statements may execute in different places because they were
  647.      moved out of loops.
  648.      Nevertheless it proves possible to debug optimized output.  This
  649.      makes it reasonable to use the optimizer for programs that might
  650.      have bugs.
  651.      The following options are useful when GNU CC is generated with the
  652.      capability for more than one debugging format.
  653. `-ggdb'
  654.      Produce debugging information in the native format (if that is
  655.      supported), including GDB extensions if at all possible.
  656. `-gstabs'
  657.      Produce debugging information in stabs format (if that is
  658.      supported), without GDB extensions.  This is the format used by
  659.      DBX on most BSD systems.  On MIPS and Alpha systems this option
  660.      produces embedded stabs debugging output which is not understood
  661.      by DBX.
  662. `-gstabs+'
  663.      Produce debugging information in stabs format (if that is
  664.      supported), using GNU extensions understood only by the GNU
  665.      debugger (GDB).  The use of these extensions is likely to make
  666.      other debuggers crash or refuse to read the program.
  667. `-gcoff'
  668.      Produce debugging information in COFF format (if that is
  669.      supported).  This is the format used by SDB on most System V
  670.      systems prior to System V Release 4.
  671. `-gxcoff'
  672.      Produce debugging information in XCOFF format (if that is
  673.      supported).  This is the format used by the DBX debugger on IBM
  674.      RS/6000 systems.
  675. `-gxcoff+'
  676.      Produce debugging information in XCOFF format (if that is
  677.      supported), using GNU extensions understood only by the GNU
  678.      debugger (GDB).  The use of these extensions is likely to make
  679.      other debuggers crash or refuse to read the program.
  680. `-gdwarf'
  681.      Produce debugging information in DWARF format (if that is
  682.      supported).  This is the format used by SDB on most System V
  683.      Release 4 systems.
  684. `-gdwarf+'
  685.      Produce debugging information in DWARF format (if that is
  686.      supported), using GNU extensions understood only by the GNU
  687.      debugger (GDB).  The use of these extensions is likely to make
  688.      other debuggers crash or refuse to read the program.
  689. `-gLEVEL'
  690. `-ggdbLEVEL'
  691. `-gstabsLEVEL'
  692. `-gcoffLEVEL'
  693. `-gxcoffLEVEL'
  694. `-gdwarfLEVEL'
  695.      Request debugging information and also use LEVEL to specify how
  696.      much information.  The default level is 2.
  697.      Level 1 produces minimal information, enough for making backtraces
  698.      in parts of the program that you don't plan to debug.  This
  699.      includes descriptions of functions and external variables, but no
  700.      information about local variables and no line numbers.
  701.      Level 3 includes extra information, such as all the macro
  702.      definitions present in the program.  Some debuggers support macro
  703.      expansion when you use `-g3'.
  704.      Generate extra code to write profile information suitable for the
  705.      analysis program `prof'.  You must use this option when compiling
  706.      the source files you want data about, and you must also use it when
  707.      linking.
  708. `-pg'
  709.      Generate extra code to write profile information suitable for the
  710.      analysis program `gprof'.  You must use this option when compiling
  711.      the source files you want data about, and you must also use it when
  712.      linking.
  713.      Generate extra code to write profile information for basic blocks,
  714.      which will record the number of times each basic block is
  715.      executed, the basic block start address, and the function name
  716.      containing the basic block.  If `-g' is used, the line number and
  717.      filename of the start of the basic block will also be recorded.
  718.      If not overridden by the machine description, the default action is
  719.      to append to the text file `bb.out'.
  720.      This data could be analyzed by a program like `tcov'.  Note,
  721.      however, that the format of the data is not what `tcov' expects.
  722.      Eventually GNU `gprof' should be extended to process this data.
  723. `-dLETTERS'
  724.      Says to make debugging dumps during compilation at times specified
  725.      by LETTERS.  This is used for debugging the compiler.  The file
  726.      names for most of the dumps are made by appending a word to the
  727.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  728.      possible letters for use in LETTERS, and their meanings:
  729.     `M'
  730.           Dump all macro definitions, at the end of preprocessing, and
  731.           write no output.
  732.     `N'
  733.           Dump all macro names, at the end of preprocessing.
  734.     `D'
  735.           Dump all macro definitions, at the end of preprocessing, in
  736.           addition to normal output.
  737.     `y'
  738.           Dump debugging information during parsing, to standard error.
  739.     `r'
  740.           Dump after RTL generation, to `FILE.rtl'.
  741.     `x'
  742.           Just generate RTL for a function instead of compiling it.
  743.           Usually used with `r'.
  744.     `j'
  745.           Dump after first jump optimization, to `FILE.jump'.
  746.     `s'
  747.           Dump after CSE (including the jump optimization that sometimes
  748.           follows CSE), to `FILE.cse'.
  749.     `L'
  750.           Dump after loop optimization, to `FILE.loop'.
  751.     `t'
  752.           Dump after the second CSE pass (including the jump
  753.           optimization that sometimes follows CSE), to `FILE.cse2'.
  754.     `f'
  755.           Dump after flow analysis, to `FILE.flow'.
  756.     `c'
  757.           Dump after instruction combination, to the file
  758.           `FILE.combine'.
  759.     `S'
  760.           Dump after the first instruction scheduling pass, to
  761.           `FILE.sched'.
  762.     `l'
  763.           Dump after local register allocation, to `FILE.lreg'.
  764.     `g'
  765.           Dump after global register allocation, to `FILE.greg'.
  766.     `R'
  767.           Dump after the second instruction scheduling pass, to
  768.           `FILE.sched2'.
  769.     `J'
  770.           Dump after last jump optimization, to `FILE.jump2'.
  771.     `d'
  772.           Dump after delayed branch scheduling, to `FILE.dbr'.
  773.     `k'
  774.           Dump after conversion from registers to stack, to
  775.           `FILE.stack'.
  776.     `a'
  777.           Produce all the dumps listed above.
  778.     `m'
  779.           Print statistics on memory usage, at the end of the run, to
  780.           standard error.
  781.     `p'
  782.           Annotate the assembler output with a comment indicating which
  783.           pattern and alternative was used.
  784. `-fpretend-float'
  785.      When running a cross-compiler, pretend that the target machine
  786.      uses the same floating point format as the host machine.  This
  787.      causes incorrect output of the actual floating constants, but the
  788.      actual instruction sequence will probably be the same as GNU CC
  789.      would make when running on the target machine.
  790. `-save-temps'
  791.      Store the usual "temporary" intermediate files permanently; place
  792.      them in the current directory and name them based on the source
  793.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  794.      files `foo.i' and `foo.s', as well as `foo.o'.
  795. `-print-libgcc-file-name'
  796.      Print the full absolute name of the library file `libgcc.a' that
  797.      would be used when linking--and don't do anything else.  With this
  798.      option, GNU CC does not compile or link anything; it just prints
  799.      the file name.
  800.      This is useful when you use `-nostdlib' but you do want to link
  801.      with `libgcc.a'.  You can do
  802.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  803.