diff options
Diffstat (limited to 'contrib/gcc/cpp.texi')
-rw-r--r-- | contrib/gcc/cpp.texi | 164 |
1 files changed, 120 insertions, 44 deletions
diff --git a/contrib/gcc/cpp.texi b/contrib/gcc/cpp.texi index e71b6e9..ca50137 100644 --- a/contrib/gcc/cpp.texi +++ b/contrib/gcc/cpp.texi @@ -16,7 +16,7 @@ @ifinfo This file documents the GNU C Preprocessor. -Copyright 1987, 1989, 1991, 1992, 1993, 1994, 1995 Free Software +Copyright 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1997, 1998 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of @@ -42,7 +42,7 @@ into another language, under the above conditions for modified versions. @titlepage @c @finalout @title The C Preprocessor -@subtitle Last revised March 1997 +@subtitle Last revised September 1998 @subtitle for GCC version 2 @author Richard M. Stallman @page @@ -51,8 +51,8 @@ This booklet is eventually intended to form the first chapter of a GNU C Language manual. @vskip 0pt plus 1filll -Copyright @copyright{} 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997 Free -Software Foundation, Inc. +Copyright @copyright{} 1987, 1989, 1991-1998 +Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -1482,7 +1482,7 @@ pointer (the argument @samp{p} says where to find it) across whitespace characters: @example -#define SKIP_SPACES (p, limit) \ +#define SKIP_SPACES(p, limit) \ @{ register char *lim = (limit); \ while (p != lim) @{ \ if (*p++ != ' ') @{ \ @@ -1518,7 +1518,7 @@ The definition of the macro @samp{SKIP_SPACES} can be altered to solve this problem, using a @samp{do @dots{} while} statement. Here is how: @example -#define SKIP_SPACES (p, limit) \ +#define SKIP_SPACES(p, limit) \ do @{ register char *lim = (limit); \ while (p != lim) @{ \ if (*p++ != ' ') @{ \ @@ -2594,6 +2594,46 @@ Traditionally, @samp{\} inside a macro argument suppresses the syntactic significance of the following character. @end itemize +@cindex Fortran +@cindex unterminated +Use the @samp{-traditional} option when preprocessing Fortran code, +so that singlequotes and doublequotes +within Fortran comment lines +(which are generally not recognized as such by the preprocessor) +do not cause diagnostics +about unterminated character or string constants. + +However, this option does not prevent diagnostics +about unterminated comments +when a C-style comment appears to start, but not end, +within Fortran-style commentary. + +So, the following Fortran comment lines are accepted with +@samp{-traditional}: + +@smallexample +C This isn't an unterminated character constant +C Neither is "20000000000, an octal constant +C in some dialects of Fortran +@end smallexample + +However, this type of comment line will likely produce a diagnostic, +or at least unexpected output from the preprocessor, +due to the unterminated comment: + +@smallexample +C Some Fortran compilers accept /* as starting +C an inline comment. +@end smallexample + +@cindex g77 +Note that @code{g77} automatically supplies +the @samp{-traditional} option +when it invokes the preprocessor. +However, a future version of @code{g77} +might use a different, more-Fortran-aware preprocessor +in place of @code{cpp}. + @item -trigraphs @findex -trigraphs Process ANSI standard trigraph sequences. These are three-character @@ -2618,7 +2658,9 @@ warnings. @item -Wtrigraphs @findex -Wtrigraphs -Warn if any trigraphs are encountered (assuming they are enabled). +Warn if any trigraphs are encountered. Currently this only works if you +have turned trigraphs on with @samp{-trigraphs} or @samp{-ansi}; in the +future this restriction will be removed. @item -Wcomment @findex -Wcomment @@ -2716,6 +2758,12 @@ is not predefined. @findex -undef Do not predefine any nonstandard macros. +@item -gcc +@findex -gcc +Define the macros @var{__GNUC__} and @var{__GNUC_MINOR__}. These are +defined automatically when you use @samp{gcc -E}; you can turn them off +in that case with @samp{-no-gcc}. + @item -A @var{predicate}(@var{answer}) @findex -A Make an assertion with the predicate @var{predicate} and answer @@ -2723,7 +2771,8 @@ Make an assertion with the predicate @var{predicate} and answer @noindent You can use @samp{-A-} to disable all predefined assertions; it also -undefines all predefined macros that identify the type of target system. +undefines all predefined macros and all macros that preceded it on the +command line. @item -dM @findex -dM @@ -2778,8 +2827,8 @@ Like @samp{-M} but the dependency information is written to @var{file}. This is in addition to compiling the file as specified---@samp{-MD} does not inhibit ordinary compilation the way @samp{-M} does. -When invoking gcc, do not specify the @var{file} argument. -Gcc will create file names made by replacing ".c" with ".d" at +When invoking @code{gcc}, do not specify the @var{file} argument. +@code{gcc} will create file names made by replacing ".c" with ".d" at the end of the input file names. In Mach, you can use the utility @code{md} to merge multiple dependency @@ -2834,48 +2883,75 @@ Add a directory to the beginning of the second include path, marking it as a system directory, so that it gets the same special treatment as is applied to the standard system directories. -@item -lang-c -@itemx -lang-c89 -@itemx -lang-c++ -@itemx -lang-objc -@itemx -lang-objc++ -@findex -lang-c -@findex -lang-c89 -@findex -lang-c++ -@findex -lang-objc -@findex -lang-objc++ -Specify the source language. @samp{-lang-c} is the default; it -allows recognition of C++ comments (comments that begin with -@samp{//} and end at end of line) and hexadecimal floating-point constants, -since these features will most likely appear in the next C standard. -@samp{-lang-c89} disables recognition of C++ comments and -hexadecimal floating-point constants. @samp{-lang-c++} -handles C++ comment syntax and includes extra default include -directories for C++. @samp{-lang-objc} enables the Objective C -@samp{#import} directive. @samp{-lang-objc++} enables both C++ and Objective C -extensions. - -These options are generated by the compiler driver @code{gcc}, but not -passed from the @samp{gcc} command line unless you use the driver's -@samp{-Wp} option. - -@item -lint +@item -x c +@itemx -x c++ +@itemx -x objective-c +@itemx -x assembler-with-cpp +@findex -x c +@findex -x objective-c +@findex -x assembler-with-cpp +Specify the source language: C, C++, Objective-C, or assembly. This has +nothing to do with standards conformance or extensions; it merely +selects which base syntax to expect. If you give none of these options, +cpp will deduce the language from the extension of the source file: +@samp{.c}, @samp{.cc}, @samp{.m}, or @samp{.S}. Some other common +extensions for C++ and assembly are also recognized. If cpp does not +recognize the extension, it will treat the file as C; this is the most +generic mode. + +@strong{Note:} Previous versions of cpp accepted a @samp{-lang} option +which selected both the language and the standards conformance level. +This option has been removed, because it conflicts with the @samp{-l} +option. + +@item -std=@var{standard} +@itemx -ansi +@findex -std +@findex -ansi +Specify the standard to which the code should conform. Currently cpp +only knows about the standards for C; other language standards will be +added in the future. + +@var{standard} +may be one of: +@table @code +@item iso9899:1990 +The ISO C standard from 1990. + +@item iso9899:199409 +@itemx c89 +The 1990 C standard, as amended in 1994. @samp{c89} is the customary +shorthand for this version of the standard. + +The @samp{-ansi} option is equivalent to @samp{-std=c89}. + +@item iso9899:199x +@itemx c9x +The revised ISO C standard, which is expected to be promulgated some +time in 1999. It has not been approved yet, hence the @samp{x}. + +@item gnu89 +The 1990 C standard plus GNU extensions. This is the default. + +@item gnu9x +The 199x C standard plus GNU extensions. +@end table + +@item -Wp,-lint +@findex -lint Look for commands to the program checker @code{lint} embedded in comments, and emit them preceded by @samp{#pragma lint}. For example, the comment @samp{/* NOTREACHED */} becomes @samp{#pragma lint NOTREACHED}. -This option is available only when you call @code{cpp} directly; -@code{gcc} will not pass it from its command line. +Because of the clash with @samp{-l}, you must use the awkward syntax +above. In a future release, this option will be replaced by +@samp{-flint} or @samp{-Wlint}; we are not sure which yet. @item -$ @findex -$ -Forbid the use of @samp{$} in identifiers. This was formerly required -for strict conformance to the C Standard before the standard was -corrected. - -This option is available only when you call @code{cpp} directly; -@code{gcc} will not pass it from its command line. +Forbid the use of @samp{$} in identifiers. The C standard does not +permit this, but it is a common extension. @end table |