home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / cpp.info-3 (.txt) < prev    next >
GNU Info File  |  1995-10-09  |  21KB  |  383 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, 1995 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 head 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.      directives.
  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' directives for all the macros defined during the
  147.      execution of the preprocessor, including predefined macros.  This
  148.      gives you a way of finding out what is predefined in your version
  149.      of the 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.      predefined macros, and it outputs *both* the `#define' directives
  155.      and the result of preprocessing.  Both kinds of output go to the
  156.      standard output file.
  157. `-M [-MG]'
  158.      Instead of outputting the result of preprocessing, output a rule
  159.      suitable for `make' describing the dependencies of the main source
  160.      file.  The preprocessor outputs one `make' rule containing the
  161.      object file name for that source file, a colon, and the names of
  162.      all the included files.  If there are many included files then the
  163.      rule is split into several lines using `\'-newline.
  164.      `-MG' says to treat missing header files as generated files and
  165.      assume they live in the same directory as the source file.  It
  166.      must be specified in addition to `-M'.
  167.      This feature is used in automatic updating of makefiles.
  168. `-MM [-MG]'
  169.      Like `-M' but mention only the files included with `#include
  170.      "FILE"'.  System header files included with `#include <FILE>' are
  171.      omitted.
  172. `-MD FILE'
  173.      Like `-M' but the dependency information is written to FILE.  This
  174.      is in addition to compiling the file as specified--`-MD' does not
  175.      inhibit ordinary compilation the way `-M' does.
  176.      When invoking gcc, do not specify the FILE argument.  Gcc will
  177.      create file names made by replacing ".c" with ".d" at the end of
  178.      the input file names.
  179.      In Mach, you can use the utility `md' to merge multiple dependency
  180.      files into a single dependency file suitable for using with the
  181.      `make' command.
  182. `-MMD FILE'
  183.      Like `-MD' except mention only user header files, not system
  184.      header files.
  185.      Print the name of each header file used, in addition to other
  186.      normal activities.
  187. `-imacros FILE'
  188.      Process FILE as input, discarding the resulting output, before
  189.      processing the regular input file.  Because the output generated
  190.      from FILE is discarded, the only effect of `-imacros FILE' is to
  191.      make the macros defined in FILE available for use in the main
  192.      input.
  193. `-include FILE'
  194.      Process FILE as input, and include all the resulting output,
  195.      before processing the regular input file.
  196. `-idirafter DIR'
  197.      Add the directory DIR to the second include path.  The directories
  198.      on the second include path are searched when a header file is not
  199.      found in any of the directories in the main include path (the one
  200.      that `-I' adds to).
  201. `-iprefix PREFIX'
  202.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  203. `-iwithprefix DIR'
  204.      Add a directory to the second include path.  The directory's name
  205.      is made by concatenating PREFIX and DIR, where PREFIX was
  206.      specified previously with `-iprefix'.
  207. `-isystem DIR'
  208.      Add a directory to the beginning of the second include path,
  209.      marking it as a system directory, so that it gets the same special
  210.      treatment as is applied to the standard system directories.
  211. `-lang-c'
  212. `-lang-c89'
  213. `-lang-c++'
  214. `-lang-objc'
  215. `-lang-objc++'
  216.      Specify the source language.  `-lang-c' is the default; it allows
  217.      recognition of C++ comments (comments that begin with `//' and end
  218.      at end of line), since this is a common feature and it will most
  219.      likely be in the next C standard.  `-lang-c89' disables
  220.      recognition of C++ comments.  `-lang-c++' handles C++ comment
  221.      syntax and includes extra default include directories for C++.
  222.      `-lang-objc' enables the Objective C `#import' directive.
  223.      `-lang-objc++' enables both C++ and Objective C extensions.
  224.      These options are generated by the compiler driver `gcc', but not
  225.      passed from the `gcc' command line unless you use the driver's
  226.      `-Wp' option.
  227. `-lint'
  228.      Look for commands to the program checker `lint' embedded in
  229.      comments, and emit them preceded by `#pragma lint'.  For example,
  230.      the comment `/* NOTREACHED */' becomes `#pragma lint NOTREACHED'.
  231.      This option is available only when you call `cpp' directly; `gcc'
  232.      will not pass it from its command line.
  233.      Forbid the use of `$' in identifiers.  This is required for ANSI
  234.      conformance.  `gcc' automatically supplies this option to the
  235.      preprocessor if you specify `-ansi', but `gcc' doesn't recognize
  236.      the `-$' option itself--to use it without the other effects of
  237.      `-ansi', you must call the preprocessor directly.
  238. File: cpp.info,  Node: Concept Index,  Next: Index,  Prev: Invocation,  Up: Top
  239. Concept Index
  240. *************
  241. * Menu:
  242. * ##:                                   Concatenation.
  243. * arguments in macro definitions:       Argument Macros.
  244. * assertions:                           Assertions.
  245. * assertions, undoing:                  Assertions.
  246. * blank macro arguments:                Argument Macros.
  247. * cascaded macros:                      Cascaded Macros.
  248. * commenting out code:                  Deleted Code.
  249. * computed #include:                    Include Syntax.
  250. * concatenation:                        Concatenation.
  251. * conditionals:                         Conditionals.
  252. * directives:                           Directives.
  253. * expansion of arguments:               Argument Prescan.
  254. * function-like macro:                  Argument Macros.
  255. * header file:                          Header Files.
  256. * including just once:                  Once-Only.
  257. * inheritance:                          Inheritance.
  258. * invocation of the preprocessor:       Invocation.
  259. * line control:                         Combining Sources.
  260. * macro argument expansion:             Argument Prescan.
  261. * macro body uses macro:                Cascaded Macros.
  262. * macros with argument:                 Argument Macros.
  263. * manifest constant:                    Simple Macros.
  264. * newlines in macro arguments:          Newlines in Args.
  265. * null directive:                       Other Directives.
  266. * options:                              Invocation.
  267. * output format:                        Output.
  268. * overriding a header file:             Inheritance.
  269. * parentheses in macro bodies:          Macro Parentheses.
  270. * pitfalls of macros:                   Macro Pitfalls.
  271. * predefined macros:                    Predefined.
  272. * predicates:                           Assertions.
  273. * preprocessing directives:             Directives.
  274. * prescan of macro arguments:           Argument Prescan.
  275. * problems with macros:                 Macro Pitfalls.
  276. * redefining macros:                    Redefining.
  277. * repeated inclusion:                   Once-Only.
  278. * retracting assertions:                Assertions.
  279. * second include path:                  Invocation.
  280. * self-reference:                       Self-Reference.
  281. * semicolons (after macro calls):       Swallow Semicolon.
  282. * side effects (in macro arguments):    Side Effects.
  283. * simple macro:                         Simple Macros.
  284. * space as macro argument:              Argument Macros.
  285. * standard predefined macros:           Standard Predefined.
  286. * stringification:                      Stringification.
  287. * testing predicates:                   Assertions.
  288. * unassert:                             Assertions.
  289. * undefining macros:                    Undefining.
  290. * unsafe macros:                        Side Effects.
  291. File: cpp.info,  Node: Index,  Prev: Concept Index,  Up: Top
  292. Index of Directives, Macros and Options
  293. ***************************************
  294. * Menu:
  295. * #assert:                              Assertions.
  296. * #cpu:                                 Assertions.
  297. * #define:                              Argument Macros.
  298. * #elif:                                #elif Directive.
  299. * #else:                                #else Directive.
  300. * #error:                               #error Directive.
  301. * #ident:                               Other Directives.
  302. * #if:                                  Conditional Syntax.
  303. * #ifdef:                               Conditionals-Macros.
  304. * #ifndef:                              Conditionals-Macros.
  305. * #import:                              Once-Only.
  306. * #include:                             Include Syntax.
  307. * #include_next:                        Inheritance.
  308. * #line:                                Combining Sources.
  309. * #machine:                             Assertions.
  310. * #pragma:                              Other Directives.
  311. * #pragma once:                         Once-Only.
  312. * #system:                              Assertions.
  313. * #unassert:                            Assertions.
  314. * #warning:                             #error Directive.
  315. * -$:                                   Invocation.
  316. * -A:                                   Invocation.
  317. * -C:                                   Invocation.
  318. * -D:                                   Invocation.
  319. * -dD:                                  Invocation.
  320. * -dM:                                  Invocation.
  321. * -H:                                   Invocation.
  322. * -I:                                   Invocation.
  323. * -idirafter:                           Invocation.
  324. * -imacros:                             Invocation.
  325. * -include:                             Invocation.
  326. * -iprefix:                             Invocation.
  327. * -isystem:                             Invocation.
  328. * -iwithprefix:                         Invocation.
  329. * -lang-c:                              Invocation.
  330. * -lang-c++:                            Invocation.
  331. * -lang-c89:                            Invocation.
  332. * -lang-objc:                           Invocation.
  333. * -lang-objc++:                         Invocation.
  334. * -M:                                   Invocation.
  335. * -MD:                                  Invocation.
  336. * -MM:                                  Invocation.
  337. * -MMD:                                 Invocation.
  338. * -nostdinc:                            Invocation.
  339. * -nostdinc++:                          Invocation.
  340. * -P:                                   Invocation.
  341. * -pedantic:                            Invocation.
  342. * -pedantic-errors:                     Invocation.
  343. * -traditional:                         Invocation.
  344. * -trigraphs:                           Invocation.
  345. * -U:                                   Invocation.
  346. * -undef:                               Invocation.
  347. * -Wall:                                Invocation.
  348. * -Wcomment:                            Invocation.
  349. * -Wtraditional:                        Invocation.
  350. * -Wtrigraphs:                          Invocation.
  351. * BSD:                                  Nonstandard Predefined.
  352. * defined:                              Conditionals-Macros.
  353. * M68020:                               Nonstandard Predefined.
  354. * m68k:                                 Nonstandard Predefined.
  355. * mc68000:                              Nonstandard Predefined.
  356. * ns32000:                              Nonstandard Predefined.
  357. * pyr:                                  Nonstandard Predefined.
  358. * sequent:                              Nonstandard Predefined.
  359. * sun:                                  Nonstandard Predefined.
  360. * system header files:                  Header Uses.
  361. * unix:                                 Nonstandard Predefined.
  362. * vax:                                  Nonstandard Predefined.
  363. * _AM29000:                             Nonstandard Predefined.
  364. * _AM29K:                               Nonstandard Predefined.
  365. * __BASE_FILE__:                        Standard Predefined.
  366. * __CHAR_UNSIGNED__:                    Standard Predefined.
  367. * __cplusplus:                          Standard Predefined.
  368. * __DATE__:                             Standard Predefined.
  369. * __FILE__:                             Standard Predefined.
  370. * __GNUC_MINOR__:                       Standard Predefined.
  371. * __GNUC__:                             Standard Predefined.
  372. * __GNUG__:                             Standard Predefined.
  373. * __INCLUDE_LEVEL_:                     Standard Predefined.
  374. * __LINE__:                             Standard Predefined.
  375. * __OPTIMIZE__:                         Standard Predefined.
  376. * __REGISTER_PREFIX__:                  Standard Predefined.
  377. * __STDC_VERSION__:                     Standard Predefined.
  378. * __STDC__:                             Standard Predefined.
  379. * __STRICT_ANSI__:                      Standard Predefined.
  380. * __TIME__:                             Standard Predefined.
  381. * __USER_LABEL_PREFIX__:                Standard Predefined.
  382. * __VERSION__:                          Standard Predefined.
  383.