Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (HP-UX-11.11)
Apropos / Subsearch:
optional field

 cpp(1)								      cpp(1)

      cpp - the C language preprocessor

      /usr/ccs/lbin/cpp [option ...] [ifile [ofile]]

      cpp is the C language preprocessor which is invoked as the first pass
      of any C compilation using the cc command (see cc(1)).  Its purpose is
      to process #include and conditional compilation instructions and
      macros.  Thus the output of cpp is designed to be in a form acceptable
      as input to the next pass of the C compiler.  As the C language
      evolves, cpp and the rest of the C compilation package will be
      modified to follow these changes.	 Therefore, the use of cpp in other
      than this framework is not suggested.  The preferred way to invoke cpp
      is through the cc command, since the functionality of cpp may someday
      be moved elsewhere.  See m4(1) for a general macro processor.

      cpp optionally accepts two file names as arguments.  ifile and ofile
      are respectively the input and output for the preprocessor.  They
      default to standard input and standard output if not specified.

      The following options are recognized by cpp:

      -A	     Remove all predefined symbols that begin with a letter
		     and _HPUX_SOURCE.	The user is expected to define
		     _POSIX_SOURCE or _XOPEN_SOURCE when using this option.

      -C	     By default, cpp strips C-style comments.  If the -C
		     option is specified, all comments (except those found
		     on cpp directive lines) are passed along.

      -Dname=def     Define name as if by a #define directive.	If no =def
		     is given, name is defined as 1.  The -D option has
		     lower precedence than the -U option.  Thus, if the same
		     name is used in both a -U option and a -D option, the
		     name is undefined regardless of the order of the

      -Hnnn	     Change the internal macro definition table to be nnn
		     bytes in size.  The default buffer size is at least
		     8188 bytes.  This option serves to eliminate ``Macro
		     param too large'', ``Macro invocation too large'',
		     ``Macro param too large after substitution'', ``Quoted
		     macro param too large'', ``Macro buffer too small'',
		     ``Input line too long'', and ``Catenated input line too
		     long'' errors.

 Hewlett-Packard Company	    - 1 -   HP-UX Release 11i: November 2000

 cpp(1)								      cpp(1)

      -h[inclfile]   Generates included files and sents the results to the
		     file inclfile.  If the argument inclfile is omitted,
		     the result is sent to the standard error.

      -Idir	     Change the algorithm for searching for #include files
		     whose names do not begin with / to look in dir before
		     looking in the directories on the standard list.  Thus,
		     #include files whose names are enclosed in double
		     quotes ("") are searched for first in the directory of
		     the file containing the #include line, then in
		     directories named in -I options in left-to-right order,
		     and last in directories on a standard list.  For
		     #include files whose names are enclosed in angle
		     brackets (<&lt&lt&lt;>&gt&gt&gt;), the directory of the file containing the
		     #include line is not searched.  However, directory dir
		     is still searched.

      -M[makefile]   Generates makefile dependencies and sends the results
		     to the file makefile.  If the argument makefile is
		     omitted, the result is sent to the standard error.

      -P	     Preprocess the input without producing the line-control
		     information used by the next pass of the C compiler.

      -T	     HP-UX no longer restricts preprocessor symbols to eight
		     characters.  The -T option forces cpp to use only the
		     first eight characters for distinguishing different
		     preprocessor names.  This behavior is the same as
		     preprocessors on some other systems with respect to the
		     length of names, and is included for backward

      -Uname	     Remove any initial definition of name, where name is a
		     reserved symbol that is predefined by the particular
		     preprocessor.  The current list of these symbols

		     Operating system:	    unix	   __unix

		     Hardware:	hp9000s200     hp9000s300     __hp9000s300
				hp9000s500     hp9000s800     __hp9000s800
				hp9000ipc      hppa	      __hppa
				_PA_RISC1_0    _PA_RISC1_1    _SIO     _WSIO

		     UNIX systems variant:  hpux	   __hpux
					    _HPUX_SOURCE   PWB

		     lint(1):	lint	       __lint

 Hewlett-Packard Company	    - 2 -   HP-UX Release 11i: November 2000

 cpp(1)								      cpp(1)

		     In addition, all symbols that begin with an underscore
		     and either an upper-case letter or another underscore
		     are reserved.  Other symbols may be defined by the
		     CCOPTS variable or other command-line options to the C
		     compiler at compile time (see cc(1)).  All HP-UX
		     systems have the symbols PWB, hpux, unix, _PWB, __hpux,
		     and __unix defined.  Each system defines at least one
		     hardware variant, as appropriate.	The lint symbols are
		     defined when lint(1) is running.  See DEPENDENCIES.

      Two special names are understood by cpp.	__LINE__ is defined as the
      current line number (as a decimal integer) as counted by cpp.
      __FILE__ is defined as the current file name (as a C string) as known
      by cpp.  They can be used anywhere (including in macros) just as any
      other defined names.

      All cpp directives start with lines begun by #.  Any number of blanks
      and tabs are allowed between the # and the directive.  The directives

      #define name token-string

		     Replace subsequent instances of name with token-string.
		     token-string can be null.

      #define name(arg, ... , arg) token-string

		     Replace subsequent instances of name followed by a (, a
		     list of comma-separated set of arguments, and a ) by
		     token-string, where each occurrence of an arg in the
		     token-string is replaced by the corresponding set of
		     tokens in the comma-separated list.  When a macro with
		     arguments is expanded, the arguments are placed into
		     the expanded token-string unchanged.  After the entire
		     token-string has been expanded, cpp restarts its scan
		     for names to expand at the beginning of the newly
		     created token-string.

		     Notice that there can be no space between name and the

      #endif [text]

		     Ends a section of lines begun by a test directive (#if,
		     #ifdef, or #ifndef).  Each test directive must have a
		     matching #endif.  Any text occurring on the same line
		     as the #endif is ignored and thus may be used to mark
		     matching #if-#endif pairs.	 This makes it easier, when
		     reading the source, to match #if, #ifdef, and #ifndef
		     directives with their associated #endif directive.

 Hewlett-Packard Company	    - 3 -   HP-UX Release 11i: November 2000

 cpp(1)								      cpp(1)

      #elif constant-expression

		     Equivalent to:

			  #if constant-expression


		     Reverses the notion of the test directive that matches
		     this directive.  Thus, if lines previous to this
		     directive are ignored, the following lines appear in
		     the output, and vice versa.

      #if constant-expression

		     The lines following appear in the output if and only if
		     the constant-expression evaluates to nonzero.  All
		     binary nonassignment C operators, the ?: operator, the
		     unary -, !, and ~ operators are all legal in constant-
		     expression.  The precedence of the operators is the
		     same as defined by the C language.

		     There is also a unary operator, defined, which can be
		     used in constant-expression in these two forms:
		     defined(name) or defined name.  This allows the use of
		     #ifdef and #ifndef in an #if directive.

		     Only these operators, integer constants, and names that
		     are known by cpp should be used in constant-expression.
		     In particular, the sizeof operator is not available.

      #ifdef name

		     The lines following appear in the output if and only if
		     name has been the subject of a previous #define without
		     being the subject of an intervening #undef.

      #ifndef name

		     The lines following do not appear in the output if and
		     only if name has been the subject of a previous #define
		     without being the subject of an intervening #undef.

      #include "filename"
      #include <filename>

		     Include at this point the contents of filename (which
		     are then run through cpp).	 See the -I option above for
		     more detail.

 Hewlett-Packard Company	    - 4 -   HP-UX Release 11i: November 2000

 cpp(1)								      cpp(1)

      #line integer-constant "filename"

		     Causes cpp to generate line-control information for the
		     next pass of the C compiler.  integer-constant is the
		     line number of the next line and filename is the file
		     where it comes from.  If filename and the quotation
		     marks are omitted, the current file name is unchanged.

      #undef name

		     Cause the definition of name (if any) to be forgotten
		     from now on.

      The test directives and the possible #else directives can be nested.
      cpp supports names up to 255 characters in length.

    Environment Variables
      LC_CTYPE determines the interpretation of comments and string literals
      as single- or multibyte characters.

      LANG determines the language in which messages are displayed.

      If LC_CTYPE is not specified in the environment or is set to the empty
      string, the value of LANG is used as a default for each unspecified or
      empty variable.  If LANG is not specified or is set to the empty
      string, it defaults to "C" (see lang(5)).	 If any internationalization
      variable contains an invalid setting, cpp behaves as if all
      internationalization variables are set to "C".  See environ(5).

    International Code Set Support
      Single- and multibyte character code sets are supported.

      Error messages produced by cpp are intended to be self-explanatory.
      The line number and filename where the error occurred are printed
      along with the diagnostic.

      When newline characters were found in argument lists for macros to be
      expanded, previous versions of cpp put out the newlines as they were
      found and expanded.  The current version of cpp replaces these
      newlines with blanks to alleviate problems that the previous versions
      had when this occurred.

    Series 700
      The symbols hp9000s700 and __hp9000s700 are not reserved symbols
      recognized by the -U option.  They are supplied to cpp either
      automatically by the compiler, or by the use of a compiler option.
      For example, on a Series 700 system, the command:

 Hewlett-Packard Company	    - 5 -   HP-UX Release 11i: November 2000

 cpp(1)								      cpp(1)

	   cc -v t.c


	   /usr/ccs/lbin/cpp t.c /var/tmp/ctmAAAa29220 -D__hp9000s700
	   -D__hp9000s800 ...

      (Also see the -D option of the cc command.)

      /usr/include	  Standard directory for #include files


      The macro substitution scheme has been changed. Previous versions of
      cpp saved macros in a macro definition table whose table size is
      128000 bytes by default.	The current version of cpp replaces this
      macro definition table with several small buffers.  The default size
      of the small buffers is 8188 bytes.

      cpp: SVID2, SVID3, XPG2

 Hewlett-Packard Company	    - 6 -   HP-UX Release 11i: November 2000