home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 6 / FreshFish_September1994.bin / bbs / gnu / gcc-2.6.0-src.lha / GNU / src / amiga / gcc-2.6.0 / gcc.info-2 < prev    next >
Encoding:
GNU Info File  |  1994-07-15  |  47.2 KB  |  1,182 lines

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