home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / info / cpp.info-3 (.txt) < prev    next >
GNU Info File  |  1994-12-22  |  20KB  |  374 lines

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