home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 7 / FreshFishVol7.bin / bbs / gnu / gcc-2.5.8-bin.lha / GNU / info / cpp.info-3 (.txt) < prev    next >
GNU Info File  |  1994-09-02  |  20KB  |  373 lines

  1. This is Info file cpp.info, produced by Makeinfo-1.54 from the input
  2. file cpp.texi.
  3.    This file documents the GNU C Preprocessor.
  4.    Copyright 1987, 1989, 1991, 1992, 1993 Free Software Foundation, Inc.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the entire resulting derived work is distributed under the terms
  11. of a permission notice identical to this one.
  12.    Permission is granted to copy and distribute translations of this
  13. manual into another language, under the above conditions for modified
  14. versions.
  15. File: cpp.info,  Node: Invocation,  Next: Concept Index,  Prev: Output,  Up: Top
  16. Invoking the C Preprocessor
  17. ===========================
  18.    Most often when you use the C preprocessor you will not have to
  19. invoke it explicitly: the C compiler will do so automatically.
  20. However, the preprocessor is sometimes useful on its own.
  21.    The C preprocessor expects two file names as arguments, INFILE and
  22. OUTFILE.  The preprocessor reads INFILE together with any other files
  23. it specifies with `#include'.  All the output generated by the combined
  24. input files is written in OUTFILE.
  25.    Either INFILE or OUTFILE may be `-', which as INFILE means to read
  26. from standard input and as OUTFILE means to write to standard output.
  27. Also, if OUTFILE or both file names are omitted, the standard output
  28. and standard input are used for the omitted file names.
  29.    Here is a table of command options accepted by the C preprocessor.
  30. These options can also be given when compiling a C program; they are
  31. passed along automatically to the preprocessor when it is invoked by the
  32. compiler.
  33.      Inhibit generation of `#'-lines with line-number information in
  34.      the output from the preprocessor (*note Output::.).  This might be
  35.      useful when running the preprocessor on something that is not C
  36.      code and will be sent to a program which might be confused by the
  37.      `#'-lines.
  38.      Do not discard comments: pass them through to the output file.
  39.      Comments appearing in arguments of a macro call will be copied to
  40.      the output before the expansion of the macro call.
  41. `-traditional'
  42.      Try to imitate the behavior of old-fashioned C, as opposed to ANSI
  43.      C.
  44.         * Traditional macro expansion pays no attention to singlequote
  45.           or doublequote characters; macro argument symbols are
  46.           replaced by the argument values even when they appear within
  47.           apparent string or character constants.
  48.         * Traditionally, it is permissible for a macro expansion to end
  49.           in the middle of a string or character constant.  The
  50.           constant continues into the text surrounding the macro call.
  51.         * However, traditionally the end of the line terminates a
  52.           string or character constant, with no error.
  53.         * In traditional C, a comment is equivalent to no text at all.
  54.           (In ANSI C, a comment counts as whitespace.)
  55.         * Traditional C does not have the concept of a "preprocessing
  56.           number".  It considers `1.0e+4' to be three tokens: `1.0e',
  57.           `+', and `4'.
  58.         * A macro is not suppressed within its own definition, in
  59.           traditional C.  Thus, any macro that is used recursively
  60.           inevitably causes an error.
  61.         * The character `#' has no special meaning within a macro
  62.           definition in traditional C.
  63.         * In traditional C, the text at the end of a macro expansion
  64.           can run together with the text after the macro call, to
  65.           produce a single token.  (This is impossible in ANSI C.)
  66.         * Traditionally, `\' inside a macro argument suppresses the
  67.           syntactic significance of the following character.
  68. `-trigraphs'
  69.      Process ANSI standard trigraph sequences.  These are
  70.      three-character sequences, all starting with `??', that are
  71.      defined by ANSI C to stand for single characters.  For example,
  72.      `??/' stands for `\', so `'??/n'' is a character constant for a
  73.      newline.  Strictly speaking, the GNU C preprocessor does not
  74.      support all programs in ANSI Standard C unless `-trigraphs' is
  75.      used, but if you ever notice the difference it will be with relief.
  76.      You don't want to know any more about trigraphs.
  77. `-pedantic'
  78.      Issue warnings required by the ANSI C standard in certain cases
  79.      such as when text other than a comment follows `#else' or `#endif'.
  80. `-pedantic-errors'
  81.      Like `-pedantic', except that errors are produced rather than
  82.      warnings.
  83. `-Wtrigraphs'
  84.      Warn if any trigraphs are encountered (assuming they are enabled).
  85. `-Wcomment'
  86.      Warn whenever a comment-start sequence `/*' appears in a comment.
  87. `-Wall'
  88.      Requests both `-Wtrigraphs' and `-Wcomment' (but not
  89.      `-Wtraditional').
  90. `-Wtraditional'
  91.      Warn about certain constructs that behave differently in
  92.      traditional and ANSI C.
  93. `-I DIRECTORY'
  94.      Add the directory DIRECTORY to the end of the list of directories
  95.      to be searched for header files (*note Include Syntax::.).  This
  96.      can be used to override a system header file, substituting your
  97.      own version, since these directories are searched before the system
  98.      header file directories.  If you use more than one `-I' option,
  99.      the directories are scanned in left-to-right order; the standard
  100.      system directories come after.
  101. `-I-'
  102.      Any directories specified with `-I' options before the `-I-'
  103.      option are searched only for the case of `#include "FILE"'; they
  104.      are not searched for `#include <FILE>'.
  105.      If additional directories are specified with `-I' options after
  106.      the `-I-', these directories are searched for all `#include'
  107.      commands.
  108.      In addition, the `-I-' option inhibits the use of the current
  109.      directory as the first search directory for `#include "FILE"'.
  110.      Therefore, the current directory is searched only if it is
  111.      requested explicitly with `-I.'.  Specifying both `-I-' and `-I.'
  112.      allows you to control precisely which directories are searched
  113.      before the current one and which are searched after.
  114. `-nostdinc'
  115.      Do not search the standard system directories for header files.
  116.      Only the directories you have specified with `-I' options (and the
  117.      current directory, if appropriate) are searched.
  118. `-nostdinc++'
  119.      Do not search for header files in the C++-specific standard
  120.      directories, but do still search the other standard directories.
  121.      (This option is used when building libg++.)
  122. `-D NAME'
  123.      Predefine NAME as a macro, with definition `1'.
  124. `-D NAME=DEFINITION'
  125.      Predefine NAME as a macro, with definition DEFINITION.  There are
  126.      no restrictions on the contents of DEFINITION, but if you are
  127.      invoking the preprocessor from a shell or shell-like program you
  128.      may need to use the shell's quoting syntax to protect characters
  129.      such as spaces that have a meaning in the shell syntax.  If you
  130.      use more than one `-D' for the same NAME, the rightmost definition
  131.      takes effect.
  132. `-U NAME'
  133.      Do not predefine NAME.  If both `-U' and `-D' are specified for
  134.      one name, the `-U' beats the `-D' and the name is not predefined.
  135. `-undef'
  136.      Do not predefine any nonstandard macros.
  137. `-A PREDICATE(ANSWER)'
  138.      Make an assertion with the predicate PREDICATE and answer ANSWER.
  139.      *Note Assertions::.
  140.      You can use `-A-' to disable all predefined assertions; it also
  141.      undefines all predefined macros that identify the type of target
  142.      system.
  143. `-dM'
  144.      Instead of outputting the result of preprocessing, output a list of
  145.      `#define' commands for all the macros defined during the execution
  146.      of the preprocessor, including predefined macros.  This gives you
  147.      a way of finding out what is predefined in your version of the
  148.      preprocessor; assuming you have no file `foo.h', the command
  149.           touch foo.h; cpp -dM foo.h
  150.      will show the values of any predefined macros.
  151. `-dD'
  152.      Like `-dM' except in two respects: it does *not* include the
  153.      predefi