home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / gcc-2.95.3-3 / info / cpp.info-3 < prev    next >
Encoding:
GNU Info File  |  2001-07-15  |  23.6 KB  |  559 lines

  1. This is Info file cpp.info, produced by Makeinfo version 1.68 from the
  2. input file ./cpp.texi.
  3.  
  4. INFO-DIR-SECTION Programming
  5. START-INFO-DIR-ENTRY
  6. * Cpp: (cpp).               The GNU C preprocessor.
  7. END-INFO-DIR-ENTRY
  8.  
  9.    This file documents the GNU C Preprocessor.
  10.  
  11.    Copyright 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1997, 1998 Free
  12. Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided also
  20. that the entire resulting derived work is distributed under the terms
  21. of a permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions.
  26.  
  27. 
  28. File: cpp.info,  Node: Invocation,  Next: Concept Index,  Prev: Output,  Up: Top
  29.  
  30. Invoking the C Preprocessor
  31. ===========================
  32.  
  33.    Most often when you use the C preprocessor you will not have to
  34. invoke it explicitly: the C compiler will do so automatically.
  35. However, the preprocessor is sometimes useful on its own.
  36.  
  37.    The C preprocessor expects two file names as arguments, INFILE and
  38. OUTFILE.  The preprocessor reads INFILE together with any other files
  39. it specifies with `#include'.  All the output generated by the combined
  40. input files is written in OUTFILE.
  41.  
  42.    Either INFILE or OUTFILE may be `-', which as INFILE means to read
  43. from standard input and as OUTFILE means to write to standard output.
  44. Also, if OUTFILE or both file names are omitted, the standard output
  45. and standard input are used for the omitted file names.
  46.  
  47.    Here is a table of command options accepted by the C preprocessor.
  48. These options can also be given when compiling a C program; they are
  49. passed along automatically to the preprocessor when it is invoked by the
  50. compiler.
  51.  
  52. `-P'
  53.      Inhibit generation of `#'-lines with line-number information in
  54.      the output from the preprocessor (*note Output::.).  This might be
  55.      useful when running the preprocessor on something that is not C
  56.      code and will be sent to a program which might be confused by the
  57.      `#'-lines.
  58.  
  59. `-C'
  60.      Do not discard comments: pass them through to the output file.
  61.      Comments appearing in arguments of a macro call will be copied to
  62.      the output before the expansion of the macro call.
  63.  
  64. `-traditional'
  65.      Try to imitate the behavior of old-fashioned C, as opposed to ANSI
  66.      C.
  67.  
  68.         * Traditional macro expansion pays no attention to singlequote
  69.           or doublequote characters; macro argument symbols are
  70.           replaced by the argument values even when they appear within
  71.           apparent string or character constants.
  72.  
  73.         * Traditionally, it is permissible for a macro expansion to end
  74.           in the middle of a string or character constant.  The
  75.           constant continues into the text surrounding the macro call.
  76.  
  77.         * However, traditionally the end of the line terminates a
  78.           string or character constant, with no error.
  79.  
  80.         * In traditional C, a comment is equivalent to no text at all.
  81.           (In ANSI C, a comment counts as whitespace.)
  82.  
  83.         * Traditional C does not have the concept of a "preprocessing
  84.           number".  It considers `1.0e+4' to be three tokens: `1.0e',
  85.           `+', and `4'.
  86.  
  87.         * A macro is not suppressed within its own definition, in
  88.           traditional C.  Thus, any macro that is used recursively
  89.           inevitably causes an error.
  90.  
  91.         * The character `#' has no special meaning within a macro
  92.           definition in traditional C.
  93.  
  94.         * In traditional C, the text at the end of a macro expansion
  95.           can run together with the text after the macro call, to
  96.           produce a single token.  (This is impossible in ANSI C.)
  97.  
  98.         * Traditionally, `\' inside a macro argument suppresses the
  99.           syntactic significance of the following character.
  100.  
  101.      Use the `-traditional' option when preprocessing Fortran code, so
  102.      that singlequotes and doublequotes within Fortran comment lines
  103.      (which are generally not recognized as such by the preprocessor)
  104.      do not cause diagnostics about unterminated character or string
  105.      constants.
  106.  
  107.      However, this option does not prevent diagnostics about
  108.      unterminated comments when a C-style comment appears to start, but
  109.      not end, within Fortran-style commentary.
  110.  
  111.      So, the following Fortran comment lines are accepted with
  112.      `-traditional':
  113.  
  114.           C This isn't an unterminated character constant
  115.           C Neither is "20000000000, an octal constant
  116.           C in some dialects of Fortran
  117.  
  118.      However, this type of comment line will likely produce a
  119.      diagnostic, or at least unexpected output from the preprocessor,
  120.      due to the unterminated comment:
  121.  
  122.           C Some Fortran compilers accept /* as starting
  123.           C an inline comment.
  124.  
  125.      Note that `g77' automatically supplies the `-traditional' option
  126.      when it invokes the preprocessor.  However, a future version of
  127.      `g77' might use a different, more-Fortran-aware preprocessor in
  128.      place of `cpp'.
  129.  
  130. `-trigraphs'
  131.      Process ANSI standard trigraph sequences.  These are
  132.      three-character sequences, all starting with `??', that are
  133.      defined by ANSI C to stand for single characters.  For example,
  134.      `??/' stands for `\', so `'??/n'' is a character constant for a
  135.      newline.  Strictly speaking, the GNU C preprocessor does not
  136.      support all programs in ANSI Standard C unless `-trigraphs' is
  137.      used, but if you ever notice the difference it will be with relief.
  138.  
  139.      You don't want to know any more about trigraphs.
  140.  
  141. `-pedantic'
  142.      Issue warnings required by the ANSI C standard in certain cases
  143.      such as when text other than a comment follows `#else' or `#endif'.
  144.  
  145. `-pedantic-errors'
  146.      Like `-pedantic', except that errors are produced rather than
  147.      warnings.
  148.  
  149. `-Wtrigraphs'
  150.      Warn if any trigraphs are encountered.  Currently this only works
  151.      if you have turned trigraphs on with `-trigraphs' or `-ansi'; in
  152.      the future this restriction will be removed.
  153.  
  154. `-Wcomment'
  155.      Warn whenever a comment-start sequence `/*' appears in a `/*'
  156.      comment, or whenever a Backslash-Newline appears in a `//' comment.
  157.  
  158. `-Wall'
  159.      Requests both `-Wtrigraphs' and `-Wcomment' (but not
  160.      `-Wtraditional' or `-Wundef').
  161.  
  162. `-Wtraditional'
  163.      Warn about certain constructs that behave differently in
  164.      traditional and ANSI C.
  165.  
  166. `-Wundef'
  167.      Warn if an undefined identifier is evaluated in an `#if' directive.
  168.  
  169. `-I DIRECTORY'
  170.      Add the directory DIRECTORY to the head of the list of directories
  171.      to be searched for header files (*note Include Syntax::.).  This
  172.      can be used to override a system header file, substituting your
  173.      own version, since these directories are searched before the system
  174.      header file directories.  If you use more than one `-I' option,
  175.      the directories are scanned in left-to-right order; the standard
  176.      system directories come after.
  177.  
  178. `-I-'
  179.      Any directories specified with `-I' options before the `-I-'
  180.      option are searched only for the case of `#include "FILE"'; they
  181.      are not searched for `#include <FILE>'.
  182.  
  183.      If additional directories are specified with `-I' options after
  184.      the `-I-', these directories are searched for all `#include'
  185.      directives.
  186.  
  187.      In addition, the `-I-' option inhibits the use of the current
  188.      directory as the first search directory for `#include "FILE"'.
  189.      Therefore, the current directory is searched only if it is
  190.      requested explicitly with `-I.'.  Specifying both `-I-' and `-I.'
  191.      allows you to control precisely which directories are searched
  192.      before the current one and which are searched after.
  193.  
  194. `-nostdinc'
  195.      Do not search the standard system directories for header files.
  196.      Only the directories you have specified with `-I' options (and the
  197.      current directory, if appropriate) are searched.
  198.  
  199. `-nostdinc++'
  200.      Do not search for header files in the C++-specific standard
  201.      directories, but do still search the other standard directories.
  202.      (This option is used when building the C++ library.)
  203.  
  204. `-remap'
  205.      When searching for a header file in a directory, remap file names
  206.      if a file named `header.gcc' exists in that directory.  This can
  207.      be used to work around limitations of file systems with file name
  208.      restrictions.  The `header.gcc' file should contain a series of
  209.      lines with two tokens on each line: the first token is the name to
  210.      map, and the second token is the actual name to use.
  211.  
  212. `-D NAME'
  213.      Predefine NAME as a macro, with definition `1'.
  214.  
  215. `-D NAME=DEFINITION'
  216.      Predefine NAME as a macro, with definition DEFINITION.  There are
  217.      no restrictions on the contents of DEFINITION, but if you are
  218.      invoking the preprocessor from a shell or shell-like program you
  219.      may need to use the shell's quoting syntax to protect characters
  220.      such as spaces that have a meaning in the shell syntax.  If you
  221.      use more than one `-D' for the same NAME, the rightmost definition
  222.      takes effect.
  223.  
  224. `-U NAME'
  225.      Do not predefine NAME.  If both `-U' and `-D' are specified for
  226.      one name, the `-U' beats the `-D' and the name is not predefined.
  227.  
  228. `-undef'
  229.      Do not predefine any nonstandard macros.
  230.  
  231. `-gcc'
  232.      Define the macros __GNUC__ and __GNUC_MINOR__.  These are defined
  233.      automatically when you use `gcc -E'; you can turn them off in that
  234.      case with `-no-gcc'.
  235.  
  236. `-A PREDICATE(ANSWER)'
  237.      Make an assertion with the predicate PREDICATE and answer ANSWER.
  238.      *Note Assertions::.
  239.  
  240.      You can use `-A-' to disable all predefined assertions; it also
  241.      undefines all predefined macros and all macros that preceded it on
  242.      the command line.
  243.  
  244. `-dM'
  245.      Instead of outputting the result of preprocessing, output a list of
  246.      `#define' directives for all the macros defined during the
  247.      execution of the preprocessor, including predefined macros.  This
  248.      gives you a way of finding out what is predefined in your version
  249.      of the preprocessor; assuming you have no file `foo.h', the command
  250.  
  251.           touch foo.h; cpp -dM foo.h
  252.  
  253.      will show the values of any predefined macros.
  254.  
  255. `-dD'
  256.      Like `-dM' except in two respects: it does *not* include the
  257.      predefined macros, and it outputs *both* the `#define' directives
  258.      and the result of preprocessing.  Both kinds of output go to the
  259.      standard output file.
  260.  
  261. `-dI'
  262.      Output `#include' directives in addition to the result of
  263.      preprocessing.
  264.  
  265. `-M [-MG]'
  266.      Instead of outputting the result of preprocessing, output a rule
  267.      suitable for `make' describing the dependencies of the main source
  268.      file.  The preprocessor outputs one `make' rule containing the
  269.      object file name for that source file, a colon, and the names of
  270.      all the included files.  If there are many included files then the
  271.      rule is split into several lines using `\'-newline.
  272.  
  273.      `-MG' says to treat missing header files as generated files and
  274.      assume they live in the same directory as the source file.  It
  275.      must be specified in addition to `-M'.
  276.  
  277.      This feature is used in automatic updating of makefiles.
  278.  
  279. `-MM [-MG]'
  280.      Like `-M' but mention only the files included with `#include
  281.      "FILE"'.  System header files included with `#include <FILE>' are
  282.      omitted.
  283.  
  284. `-MD FILE'
  285.      Like `-M' but the dependency information is written to FILE.  This
  286.      is in addition to compiling the file as specified--`-MD' does not
  287.      inhibit ordinary compilation the way `-M' does.
  288.  
  289.      When invoking `gcc', do not specify the FILE argument.  `gcc' will
  290.      create file names made by replacing ".c" with ".d" at the end of
  291.      the input file names.
  292.  
  293.      In Mach, you can use the utility `md' to merge multiple dependency
  294.      files into a single dependency file suitable for using with the
  295.      `make' command.
  296.  
  297. `-MMD FILE'
  298.      Like `-MD' except mention only user header files, not system
  299.      header files.
  300.  
  301. `-H'
  302.      Print the name of each header file used, in addition to other
  303.      normal activities.
  304.  
  305. `-imacros FILE'
  306.      Process FILE as input, discarding the resulting output, before
  307.      processing the regular input file.  Because the output generated
  308.      from FILE is discarded, the only effect of `-imacros FILE' is to
  309.      make the macros defined in FILE available for use in the main
  310.      input.
  311.  
  312. `-include FILE'
  313.      Process FILE as input, and include all the resulting output,
  314.      before processing the regular input file.
  315.  
  316. `-idirafter DIR'
  317.      Add the directory DIR to the second include path.  The directories
  318.      on the second include path are searched when a header file is not
  319.      found in any of the directories in the main include path (the one
  320.      that `-I' adds to).
  321.  
  322. `-iprefix PREFIX'
  323.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  324.  
  325. `-iwithprefix DIR'
  326.      Add a directory to the second include path.  The directory's name
  327.      is made by concatenating PREFIX and DIR, where PREFIX was
  328.      specified previously with `-iprefix'.
  329.  
  330. `-isystem DIR'
  331.      Add a directory to the beginning of the second include path,
  332.      marking it as a system directory, so that it gets the same special
  333.      treatment as is applied to the standard system directories.
  334.  
  335. `-x c'
  336. `-x c++'
  337. `-x objective-c'
  338. `-x assembler-with-cpp'
  339.      Specify the source language: C, C++, Objective-C, or assembly.
  340.      This has nothing to do with standards conformance or extensions;
  341.      it merely selects which base syntax to expect.  If you give none
  342.      of these options, cpp will deduce the language from the extension
  343.      of the source file: `.c', `.cc', `.m', or `.S'.  Some other common
  344.      extensions for C++ and assembly are also recognized.  If cpp does
  345.      not recognize the extension, it will treat the file as C; this is
  346.      the most generic mode.
  347.  
  348.      *Note:* Previous versions of cpp accepted a `-lang' option which
  349.      selected both the language and the standards conformance level.
  350.      This option has been removed, because it conflicts with the `-l'
  351.      option.
  352.  
  353. `-std=STANDARD'
  354. `-ansi'
  355.      Specify the standard to which the code should conform.  Currently
  356.      cpp only knows about the standards for C; other language standards
  357.      will be added in the future.
  358.  
  359.      STANDARD may be one of:
  360.     `iso9899:1990'
  361.           The ISO C standard from 1990.
  362.  
  363.     `iso9899:199409'
  364.     `c89'
  365.           The 1990 C standard, as amended in 1994.  `c89' is the
  366.           customary shorthand for this version of the standard.
  367.  
  368.           The `-ansi' option is equivalent to `-std=c89'.
  369.  
  370.     `iso9899:199x'
  371.     `c9x'
  372.           The revised ISO C standard, which is expected to be
  373.           promulgated some time in 1999.  It has not been approved yet,
  374.           hence the `x'.
  375.  
  376.     `gnu89'
  377.           The 1990 C standard plus GNU extensions.  This is the default.
  378.  
  379.     `gnu9x'
  380.           The 199x C standard plus GNU extensions.
  381.  
  382. `-Wp,-lint'
  383.      Look for commands to the program checker `lint' embedded in
  384.      comments, and emit them preceded by `#pragma lint'.  For example,
  385.      the comment `/* NOTREACHED */' becomes `#pragma lint NOTREACHED'.
  386.  
  387.      Because of the clash with `-l', you must use the awkward syntax
  388.      above.  In a future release, this option will be replaced by
  389.      `-flint' or `-Wlint'; we are not sure which yet.
  390.  
  391. `-$'
  392.      Forbid the use of `$' in identifiers.  The C standard does not
  393.      permit this, but it is a common extension.
  394.  
  395. 
  396. File: cpp.info,  Node: Concept Index,  Next: Index,  Prev: Invocation,  Up: Top
  397.  
  398. Concept Index
  399. *************
  400.  
  401. * Menu:
  402.  
  403. * ##:                                    Concatenation.
  404. * arguments in macro definitions:        Argument Macros.
  405. * assertions:                            Assertions.
  406. * assertions, undoing:                   Assertions.
  407. * blank macro arguments:                 Argument Macros.
  408. * cascaded macros:                       Cascaded Macros.
  409. * commenting out code:                   Deleted Code.
  410. * computed #include:                     Include Syntax.
  411. * concatenation:                         Concatenation.
  412. * conditionals:                          Conditionals.
  413. * directives:                            Directives.
  414. * expansion of arguments:                Argument Prescan.
  415. * Fortran:                               Invocation.
  416. * function-like macro:                   Argument Macros.
  417. * g77:                                   Invocation.
  418. * header file:                           Header Files.
  419. * including just once:                   Once-Only.
  420. * inheritance:                           Inheritance.
  421. * invocation of the preprocessor:        Invocation.
  422. * line control:                          Combining Sources.
  423. * macro argument expansion:              Argument Prescan.
  424. * macro body uses macro:                 Cascaded Macros.
  425. * macros with argument:                  Argument Macros.
  426. * manifest constant:                     Simple Macros.
  427. * newlines in macro arguments:           Newlines in Args.
  428. * null directive:                        Other Directives.
  429. * options:                               Invocation.
  430. * output format:                         Output.
  431. * overriding a header file:              Inheritance.
  432. * parentheses in macro bodies:           Macro Parentheses.
  433. * pitfalls of macros:                    Macro Pitfalls.
  434. * predefined macros:                     Predefined.
  435. * predicates:                            Assertions.
  436. * preprocessing directives:              Directives.
  437. * prescan of macro arguments:            Argument Prescan.
  438. * problems with macros:                  Macro Pitfalls.
  439. * redefining macros:                     Redefining.
  440. * repeated inclusion:                    Once-Only.
  441. * retracting assertions:                 Assertions.
  442. * second include path:                   Invocation.
  443. * self-reference:                        Self-Reference.
  444. * semicolons (after macro calls):        Swallow Semicolon.
  445. * side effects (in macro arguments):     Side Effects.
  446. * simple macro:                          Simple Macros.
  447. * space as macro argument:               Argument Macros.
  448. * standard predefined macros:            Standard Predefined.
  449. * stringification:                       Stringification.
  450. * testing predicates:                    Assertions.
  451. * unassert:                              Assertions.
  452. * undefining macros:                     Undefining.
  453. * unsafe macros:                         Side Effects.
  454. * unterminated:                          Invocation.
  455.  
  456. 
  457. File: cpp.info,  Node: Index,  Prev: Concept Index,  Up: Top
  458.  
  459. Index of Directives, Macros and Options
  460. ***************************************
  461.  
  462. * Menu:
  463.  
  464. * #assert:                               Assertions.
  465. * #cpu:                                  Assertions.
  466. * #define:                               Argument Macros.
  467. * #elif:                                 #elif Directive.
  468. * #else:                                 #else Directive.
  469. * #error:                                #error Directive.
  470. * #ident:                                Other Directives.
  471. * #if:                                   Conditional Syntax.
  472. * #ifdef:                                Conditionals-Macros.
  473. * #ifndef:                               Conditionals-Macros.
  474. * #import:                               Once-Only.
  475. * #include:                              Include Syntax.
  476. * #include_next:                         Inheritance.
  477. * #line:                                 Combining Sources.
  478. * #machine:                              Assertions.
  479. * #pragma:                               Other Directives.
  480. * #pragma once:                          Once-Only.
  481. * #system:                               Assertions.
  482. * #unassert:                             Assertions.
  483. * #warning:                              #error Directive.
  484. * -$:                                    Invocation.
  485. * -A:                                    Invocation.
  486. * -ansi:                                 Invocation.
  487. * -C:                                    Invocation.
  488. * -D:                                    Invocation.
  489. * -dD:                                   Invocation.
  490. * -dI:                                   Invocation.
  491. * -dM:                                   Invocation.
  492. * -gcc:                                  Invocation.
  493. * -H:                                    Invocation.
  494. * -I:                                    Invocation.
  495. * -idirafter:                            Invocation.
  496. * -imacros:                              Invocation.
  497. * -include:                              Invocation.
  498. * -iprefix:                              Invocation.
  499. * -isystem:                              Invocation.
  500. * -iwithprefix:                          Invocation.
  501. * -lint:                                 Invocation.
  502. * -M:                                    Invocation.
  503. * -MD:                                   Invocation.
  504. * -MM:                                   Invocation.
  505. * -MMD:                                  Invocation.
  506. * -nostdinc:                             Invocation.
  507. * -nostdinc++:                           Invocation.
  508. * -P:                                    Invocation.
  509. * -pedantic:                             Invocation.
  510. * -pedantic-errors:                      Invocation.
  511. * -remap:                                Invocation.
  512. * -std:                                  Invocation.
  513. * -traditional:                          Invocation.
  514. * -trigraphs:                            Invocation.
  515. * -U:                                    Invocation.
  516. * -undef:                                Invocation.
  517. * -Wall:                                 Invocation.
  518. * -Wcomment:                             Invocation.
  519. * -Wtraditional:                         Invocation.
  520. * -Wtrigraphs:                           Invocation.
  521. * -Wundef:                               Invocation.
  522. * -x assembler-with-cpp:                 Invocation.
  523. * -x c:                                  Invocation.
  524. * -x objective-c:                        Invocation.
  525. * __BASE_FILE__:                         Standard Predefined.
  526. * __CHAR_UNSIGNED__:                     Standard Predefined.
  527. * __cplusplus:                           Standard Predefined.
  528. * __DATE__:                              Standard Predefined.
  529. * __FILE__:                              Standard Predefined.
  530. * __GNUC__:                              Standard Predefined.
  531. * __GNUC_MINOR__:                        Standard Predefined.
  532. * __GNUG__:                              Standard Predefined.
  533. * __INCLUDE_LEVEL_:                      Standard Predefined.
  534. * __LINE__:                              Standard Predefined.
  535. * __OPTIMIZE__:                          Standard Predefined.
  536. * __REGISTER_PREFIX__:                   Standard Predefined.
  537. * __STDC__:                              Standard Predefined.
  538. * __STDC_VERSION__:                      Standard Predefined.
  539. * __STRICT_ANSI__:                       Standard Predefined.
  540. * __TIME__:                              Standard Predefined.
  541. * __USER_LABEL_PREFIX__:                 Standard Predefined.
  542. * __VERSION__:                           Standard Predefined.
  543. * _AM29000:                              Nonstandard Predefined.
  544. * _AM29K:                                Nonstandard Predefined.
  545. * BSD:                                   Nonstandard Predefined.
  546. * defined:                               Conditionals-Macros.
  547. * M68020:                                Nonstandard Predefined.
  548. * m68k:                                  Nonstandard Predefined.
  549. * mc68000:                               Nonstandard Predefined.
  550. * ns32000:                               Nonstandard Predefined.
  551. * pyr:                                   Nonstandard Predefined.
  552. * sequent:                               Nonstandard Predefined.
  553. * sun:                                   Nonstandard Predefined.
  554. * system header files:                   Header Uses.
  555. * unix:                                  Nonstandard Predefined.
  556. * vax:                                   Nonstandard Predefined.
  557.  
  558.  
  559.