


cpp(1)                      GNU Tools                      cpp(1)



NAME
     cccp, cpp - The GNU C-Compatible Compiler Preprocessor.

SYNOPSIS
     cccp [-$] [-C] [-D_n_a_m_e[=_d_e_f_i_n_i_t_i_o_n]] [-dD] [-dM]
          [-I _d_i_r_e_c_t_o_r_y] [-H] [-I-] [-imacros _f_i_l_e]
          [-include _f_i_l_e] [-lang-c] [-lang-c++] [-lang-objc]
          [-lang-objc++] [-lint] [-M] [-MD] [-MM] [-MMD]
          [-nostdinc] [-P] [-pedantic] [-pedantic-errors]
          [-trigraphs] [-U_n_a_m_e] [-undef] [-Wtrigraphs]
          [-Wcomment] [-Wall] [-Wtraditional]
          [_i_n_f_i_l_e|-] [_o_u_t_f_i_l_e|-]

DESCRIPTION
     The C preprocessor is a _m_a_c_r_o _p_r_o_c_e_s_s_o_r  that  is  used  au-
     tomatically  by the C compiler to transform your program be-
     fore actual compilation.  It is called a macro processor be-
     cause it allows you to define _m_a_c_r_o_s, which are brief abbre-
     viations for longer constructs.

     The C preprocessor provides four  separate  facilities  that
     you can use as you see fit:

     o+    Inclusion of header files.  These are files of declara-
          tions that can be substituted into your program.

     o+    Macro expansion.  You can define _m_a_c_r_o_s, which are  ab-
          breviations for arbitrary fragments of C code, and then
          the C preprocessor will replace the macros  with  their
          definitions throughout the program.

     o+    Conditional compilation.   Using  special  preprocessor
          commands,  you can include or exclude parts of the pro-
          gram according to various conditions.

     o+    Line control.  If you use a program to combine or rear-
          range  source  files into an intermediate file which is
          then compiled, you can use line control to  inform  the
          compiler  of  where  each  source  line originally came
          from.

     C preprocessors vary in some details.  For a  full  explana-
     tion   of   the  GNU  C  preprocessor,  see  the  info  file
     `cpp.info', or the manual _T_h_e _C _P_r_e_p_r_o_c_e_s_s_o_r.  Both of these
     are   built   from   the  same  documentation  source  file,
     `cpp.texinfo'.  The GNU C preprocessor provides  a  superset
     of the features of ANSI Standard C.

     ANSI Standard C requires the rejection of many harmless con-
     structs  commonly used by today's C programs.  Such incompa-
     tibility would be inconvenient  for  users,  so  the  GNU  C
     preprocessor is configured to accept these constructs by de-



GNU Tools             Last change: 2Jan1992                     1






cpp(1)                      GNU Tools                      cpp(1)



     fault.  Strictly speaking, to get ANSI Standard C, you  must
     use  the options `-trigraphs', `-undef' and `-pedantic', but
     in practice the consequences of having strict ANSI  Standard
     C make it undesirable to do this.

     Most often when you use the C preprocessor you will not have
     to invoke it explicitly: the C compiler will do so automati-
     cally.  However, the preprocessor is sometimes useful  indi-
     vidually.

     When you call the  preprocessor  individually,  either  name
     (cpp or cccp) will do-they are completely synonymous.

     The C preprocessor expects two file names as arguments,  _i_n_-
     _f_i_l_e  and  _o_u_t_f_i_l_e.   The preprocessor reads _i_n_f_i_l_e together
     with any other files it specifies with `#include'.  All  the
     output  generated  by the combined input files is written in
     _o_u_t_f_i_l_e.

     Either _i_n_f_i_l_e or _o_u_t_f_i_l_e may be `-', which as  _i_n_f_i_l_e  means
     to read from standard input and as _o_u_t_f_i_l_e means to write to
     standard output.  Also, if _o_u_t_f_i_l_e or both  file  names  are
     omitted, the standard output and standard input are used for
     the omitted file names.

OPTIONS
     Here is a table of command options accepted by the C prepro-
     cessor.  These  options can also be given when compiling a C
     program; they are passed along automatically to the  prepro-
     cessor when it is invoked by the compiler.

     -P   Inhibit generation of `#'-lines with line-number infor-
          mation in the output from the preprocessor.  This might
          be useful when running the  preprocessor  on  something
          that  is not C code and will be sent to a program which
          might be confused by the `#'-lines.

     -C   Do not discard comments: pass them through to the  out-
          put  file.   Comments appearing in arguments of a macro
          call will be copied to the output before the  expansion
          of the macro call.

     -trigraphs
          Process ANSI standard trigraph  sequences.   These  are
          three-character sequences, all starting with `??', that
          are defined by ANSI C to stand for  single  characters.
          For  example,  `??/'  stands  for `\', so `'??/n'' is a
          character constant for a newline.   Strictly  speaking,
          the GNU C preprocessor does not support all programs in
          ANSI Standard C unless `-trigraphs' is used, but if you
          ever notice the difference it will be with relief.




GNU Tools             Last change: 2Jan1992                     2






cpp(1)                      GNU Tools                      cpp(1)



          You don't want to know any more about trigraphs.

     -pedantic
          Issue warnings required by the ANSI C standard in  cer-
          tain  cases such as when text other than a comment fol-
          lows `#else' or `#endif'.

     -pedantic-errors
          Like `-pedantic', except that errors are produced rath-
          er than warnings.

     -Wtrigraphs
          Warn if any trigraphs are  encountered  (assuming  they
          are enabled).

     -Wcomment

     -Wcomments
          Warn whenever a comment-start sequence `/*' appears  in
          a comment.  (Both forms have the same effect).

     -Wall
          Requests both `-Wtrigraphs' and  `-Wcomment'  (but  not
          `-Wtraditional').

     -Wtraditional
          Warn about certain constructs that  behave  differently
          in traditional and ANSI C.

     -I _d_i_r_e_c_t_o_r_y
           Add the directory _d_i_r_e_c_t_o_r_y to the end of the list  of
          directories  to be searched for header files.  This can
          be used to override a system header file,  substituting
          your  own version, since these directories are searched
          before the system header file directories.  If you  use
          more  than one `-I' option, the directories are scanned
          in left-to-right order; the standard system directories
          come after.

     -I-  Any directories specified with `-I' options before  the
          `-I-'  option  are  searched only for the case of `#in-
          clude _f_i_l_e"';  they  are  not  searched  for  `#include
          <_f_i_l_e>'.

          If additional directories are specified with  `-I'  op-
          tions  after  the `-I-', these directories are searched
          for all `#include' directives.

          In addition, the `-I-' option inhibits the use  of  the
          current  directory  as  the  first search directory for
          `#include _f_i_l_e"'.  Therefore, the current directory  is
          searched only if it is requested explicitly with `-I.'.



GNU Tools             Last change: 2Jan1992                     3






cpp(1)                      GNU Tools                      cpp(1)



          Specifying both `-I-' and `-I.' allows you  to  control
          precisely  which  directories  are  searched before the
          current one and which are searched after.

     -nostdinc
          Do not  search  the  standard  system  directories  for
          header  files.  Only the directories you have specified
          with `-I' options (and the current  directory,  if  ap-
          propriate) are searched.

     -D _n_a_m_e
           Predefine _n_a_m_e as a macro, with definition `1'.

     -D _n_a_m_e=_d_e_f_i_n_i_t_i_o_n
           Predefine _n_a_m_e as a macro, with definition _d_e_f_i_n_i_t_i_o_n.
          There  are  no  restrictions on the contents of _d_e_f_i_n_i_-
          _t_i_o_n, but if you are invoking the preprocessor  from  a
          shell  or  shell-like  program  you may need to use the
          shell's quoting syntax to protect  characters  such  as
          spaces that have a meaning in the shell syntax.  If you
          use more than one `-D' for the same _n_a_m_e, the rightmost
          definition takes effect.

     -U _n_a_m_e
           Do not predefine _n_a_m_e.  If  both  `-U'  and  `-D'  are
          specified for one name, the `-U' beats the `-D' and the
          name is not predefined.

     -undef
          Do not predefine any nonstandard macros.

     -dM  Instead of outputting the result of preprocessing, out-
          put a list of `#define' commands for all the macros de-
          fined during the execution of the preprocessor, includ-
          ing predefined macros.  This gives you a way of finding
          out what is predefined in your version of  the  prepro-
          cessor; assuming you have no file `foo.h', the command

          touch foo.h; cpp -dM foo.h

          will show the values of any predefined macros.

     -dD  Like `-dM' except in two respects: it does _n_o_t  include
          the  predefined  macros,  and it outputs _b_o_t_h the `#de-
          fine' commands and the result of  preprocessing.   Both
          kinds of output go to the standard output file.

     -M   Instead of outputting the result of preprocessing, out-
          put  a  rule suitable for make describing the dependen-
          cies of the main source file.  The preprocessor outputs
          one  make rule containing the object file name for that
          source file, a colon, and the names of all the included



GNU Tools             Last change: 2Jan1992                     4






cpp(1)                      GNU Tools                      cpp(1)



          files.   If there are many included files then the rule
          is split into several lines using `'-newline.

          This  feature  is  used  in   automatic   updating   of
          makefiles.

     -MM  Like `-M' but mention  only  the  files  included  with
          `#include  "_f_i_l_e"'.   System header files included with
          `#include <_f_i_l_e>' are omitted.

     -MD  Like `-M' but the dependency information is written  to
          files  with  names  made by replacing `.c' with `.d' at
          the end of the input file names.  This is  in  addition
          to compiling the file as specified-`-MD' does not inhi-
          bit ordinary compilation the way `-M' does.

          In Mach, you can use the utility md to merge  the  `.d'
          files  into a single dependency file suitable for using
          with the `make' command.

     -MMD Like `-MD' except mention only user header  files,  not
          system header files.

     -H   Print the name of each header file used, in addition to
          other normal activities.

     -imacros _f_i_l_e
           Process _f_i_l_e as input, discarding the  resulting  out-
          put, before processing the regular input file.  Because
          the output generated from _f_i_l_e is discarded,  the  only
          effect of `-imacros _f_i_l_e' is to make the macros defined
          in _f_i_l_e available for  use  in  the  main  input.   The
          preprocessor evaluates any `-D' and `-U' options on the
          command line before processing `-imacros _f_i_l_e' .

     -include _f_i_l_e
          Process _f_i_l_e as input, and include  all  the  resulting
          output, before processing the regular input file.

     -lang-c

     -lang-c++

     -lang-objc

     -lang-objc++
          Specify the source  language.   `-lang-c++'  makes  the
          preprocessor  handle  C++  comment syntax, and includes
          extra default include directories for C++, and  `-lang-
          objc'  enables  the  Objective  C  `#import' directive.
          `-lang-c' explicitly turns off  both  of  these  exten-
          sions, and `-lang-objc++' enables both.



GNU Tools             Last change: 2Jan1992                     5






cpp(1)                      GNU Tools                      cpp(1)



          These options are generated by the compiler driver gcc,
          but not passed from the `gcc' command line.

     -lint
          Look for commands to the program checker lint  embedded
          in  comments, and emit them preceded by `#pragma lint'.
          For example, the comment  `/*  NOTREACHED  */'  becomes
          `#pragma lint NOTREACHED'.

          This option is available only when you call cpp direct-
          ly; gcc will not pass it from its command line.

     -$   Forbid the use of `$' in identifiers.  This is required
          for  ANSI conformance.  gcc automatically supplies this
          option to the preprocessor if you specify `-ansi',  but
          gcc  doesn't recognize the `-$' option itself-to use it
          without the other effects of `-ansi', you must call the
          preprocessor directly.

SEE ALSO
     `Cpp' entry in info; _T_h_e _C _P_r_e_p_r_o_c_e_s_s_o_r, Richard  M.  Stall-
     man.
     gcc(1); `Gcc' entry in info; _U_s_i_n_g _a_n_d _P_o_r_t_i_n_g _G_N_U  _C_C  (_f_o_r
     _v_e_r_s_i_o_n _2._0), Richard M. Stallman.

COPYING
     Copyright (c) 1991, 1992 Free Software Foundation, Inc.

     Permission is granted to make and distribute verbatim copies
     of  this  manual provided the copyright notice and this per-
     mission notice are preserved on all copies.

     Permission is granted to copy and distribute  modified  ver-
     sions of this manual under the conditions for verbatim copy-
     ing, provided that the entire resulting derived work is dis-
     tributed under the terms of a permission notice identical to
     this one.

     Permission is granted to copy and distribute translations of
     this  manual  into  another language, under the above condi-
     tions for modified versions, except that this permission no-
     tice  may  be  included in translations approved by the Free
     Software Foundation instead of in the original English.












GNU Tools             Last change: 2Jan1992                     6



