Commit ae2eceaa by Neil Booth Committed by Neil Booth

* cpp.texi: Update.

From-SVN: r37094
parent 04e149ab
2000-10-27 Neil Booth <neilb@earthling.net>
* cpp.texi: Update.
2000-10-27 Kelley Cook <kelley.cook@home.com> 2000-10-27 Kelley Cook <kelley.cook@home.com>
* invoke.texi: Document -mintel-syntax * invoke.texi: Document -mintel-syntax
......
...@@ -2379,13 +2379,14 @@ understand @code{sizeof}, or typedef names, or even the type keywords ...@@ -2379,13 +2379,14 @@ understand @code{sizeof}, or typedef names, or even the type keywords
such as @code{int}.) such as @code{int}.)
@findex defined @findex defined
The special operator @samp{defined} is used in @samp{#if} expressions to The special operator @samp{defined} is used in @samp{#if} and
test whether a certain name is defined as a macro. Either @samp{defined @samp{#elif} expressions to test whether a certain name is defined as a
@var{name}} or @samp{defined (@var{name})} is an expression whose value macro. Either @samp{defined @var{name}} or @samp{defined (@var{name})}
is 1 if @var{name} is defined as macro at the current point in the is an expression whose value is 1 if @var{name} is defined as macro at
program, and 0 otherwise. For the @samp{defined} operator it makes no the current point in the program, and 0 otherwise. To the
difference what the definition of the macro is; all that matters is @samp{defined} operator it makes no difference what the definition of
whether there is a definition. Thus, for example,@refill the macro is; all that matters is whether there is a definition. Thus,
for example,@refill
@example @example
#if defined (vax) || defined (ns16000) #if defined (vax) || defined (ns16000)
...@@ -2405,6 +2406,12 @@ use of the @samp{defined} operator returns 0, because the name is no ...@@ -2405,6 +2406,12 @@ use of the @samp{defined} operator returns 0, because the name is no
longer defined. If the macro is defined again with another longer defined. If the macro is defined again with another
@samp{#define}, @samp{defined} will recommence returning 1. @samp{#define}, @samp{defined} will recommence returning 1.
If the @samp{defined} operator appears as a result of a macro expansion,
the C standard says the behavior is undefined. GNU cpp treats it as a
genuine @samp{defined} operator and evaluates it normally. It will warn
wherever your code uses this feature if you use the command-line option
@samp{-pedantic}, since other compilers may handle it differently.
@findex #ifdef @findex #ifdef
@findex #ifndef @findex #ifndef
Conditionals that test whether a single macro is defined are very common, Conditionals that test whether a single macro is defined are very common,
...@@ -2793,29 +2800,31 @@ This indicates that the following text should be treated as C@. ...@@ -2793,29 +2800,31 @@ This indicates that the following text should be treated as C@.
@end table @end table
@node Implementation, Unreliable Features, Output, Top @node Implementation, Unreliable Features, Output, Top
@section Implementation-defined Behavior and Implemenation Limits @section Implementation-defined Behavior and Implementation Limits
@cindex implementation limits @cindex implementation limits
@cindex implementation-defined behavior @cindex implementation-defined behavior
The ISO C standard mandates that implementations document various The ISO C standard mandates that implementations document various
aspects of preprocessor behavior. You should try to avoid undue aspects of preprocessor behavior. You should try to avoid undue
reliance on behaviour described here, as it is probable that it will reliance on behaviour described here, as it is possible that it will
change subtly in future implementations. change subtly in future implementations.
@itemize @bullet @itemize @bullet
@item The mapping of physical source file multibyte characters to the execution @item The mapping of physical source file multi-byte characters to the
character set. execution character set.
Currenty, GNU cpp only supports character sets that are strict supersets Currently, GNU cpp only supports character sets that are strict supersets
of ASCII, and performs no translation of characters. of ASCII, and performs no translation of characters.
@item Non-empty sequences of whitespace characters. @item Non-empty sequences of whitespace characters.
Each whitespace sequence is not preserved, but collapsed to a single Each whitespace sequence is not preserved, but collapsed to a single
space. space. For aesthetic reasons, the first token on each non-directive
line of output is preceded with sufficient spaces that it appears in the
same column as it did in the original source file.
@item The numeric value of characeter constants in preprocessor expressions. @item The numeric value of character constants in preprocessor expressions.
The preprocessor interprets character constants in preprocessing The preprocessor interprets character constants in preprocessing
directives on the host machine. Expressions outside preprocessing directives on the host machine. Expressions outside preprocessing
...@@ -2824,6 +2833,16 @@ normal case of a native compiler, these two environments are the same ...@@ -2824,6 +2833,16 @@ normal case of a native compiler, these two environments are the same
and so character constants will be evaluated identically in both cases. and so character constants will be evaluated identically in both cases.
However, in the case of a cross compiler, the values may be different. However, in the case of a cross compiler, the values may be different.
Multi-character character constants are interpreted a character at a
time, shifting the previous result left by the number of bits per
character on the host, and adding the new character. For example, 'ab'
on an 8-bit host would be interpreted as 'a' * 256 + 'b'. If there are
more characters in the constant than can fit in the widest native
integer type on the host, usually a @samp{long}, the behavior is
undefined.
Evaluation of wide character constants is not properly implemented yet.
@item Source file inclusion. @item Source file inclusion.
For a discussion on how the preprocessor locates header files, For a discussion on how the preprocessor locates header files,
...@@ -2858,17 +2877,17 @@ The following documents internal limits of GNU cpp. ...@@ -2858,17 +2877,17 @@ The following documents internal limits of GNU cpp.
@item Nesting levels of @samp{#include} files. @item Nesting levels of @samp{#include} files.
We impose an arbitrary limit of 200 levels, to avoid runaway recursion. We impose an arbitrary limit of 200 levels, to avoid runaway recursion.
The standard requires at least 15 levels be permitted. The standard requires at least 15 levels.
@item Nesting levels of conditional inclusion. @item Nesting levels of conditional inclusion.
The C standard mandates this be at least 63. The GNU C preprocessor The C standard mandates this be at least 63. The GNU C preprocessor
is limited only by available memory. is limited only by available memory.
@item Levels of paranthesised expressions within a full expression. @item Levels of parenthesised expressions within a full expression.
The C standard requires this to be at least 63. In preprocessor The C standard requires this to be at least 63. In preprocessor
conditional expresssions it is limited only by available memory. conditional expressions it is limited only by available memory.
@item Significant initial characters in an identifier or macro name. @item Significant initial characters in an identifier or macro name.
...@@ -2880,7 +2899,7 @@ requires only that the first 63 be significant. ...@@ -2880,7 +2899,7 @@ requires only that the first 63 be significant.
The standard requires at least 4095 be possible; GNU cpp is limited only The standard requires at least 4095 be possible; GNU cpp is limited only
by available memory. by available memory.
@item Number of paramters in a macro definition and arguments in a macro call. @item Number of parameters in a macro definition and arguments in a macro call.
We allow USHRT_MAX, which is normally 65,535, and above the minimum of We allow USHRT_MAX, which is normally 65,535, and above the minimum of
127 required by the standard. 127 required by the standard.
...@@ -2956,7 +2975,7 @@ Formerly, in a macro expansion, if @samp{##} appeared before a variable ...@@ -2956,7 +2975,7 @@ Formerly, in a macro expansion, if @samp{##} appeared before a variable
arguments parameter, and the set of tokens specified for that argument in arguments parameter, and the set of tokens specified for that argument in
the macro invocation was empty, previous versions of the GNU C the macro invocation was empty, previous versions of the GNU C
preprocessor would back up and remove the preceding sequence of preprocessor would back up and remove the preceding sequence of
nonwhitespace characters (@strong{not} the preceding token). This non-whitespace characters (@strong{not} the preceding token). This
extension is in direct conflict with the 1999 C standard and has been extension is in direct conflict with the 1999 C standard and has been
drastically pared back. drastically pared back.
...@@ -2995,7 +3014,7 @@ used at all. ...@@ -2995,7 +3014,7 @@ used at all.
@item #pragma poison @item #pragma poison
This pragma has been superceded by @samp{#pragma GCC poison}. This pragma has been superseded by @samp{#pragma GCC poison}.
@xref{Poisoning}. @xref{Poisoning}.
@item Multi-line string literals in directives @item Multi-line string literals in directives
...@@ -3531,7 +3550,7 @@ The 1999 C standard plus GNU extensions. ...@@ -3531,7 +3550,7 @@ The 1999 C standard plus GNU extensions.
@item -ftabstop=NUMBER @item -ftabstop=NUMBER
@findex -ftabstop @findex -ftabstop
Set the distance between tabstops. This helps the preprocessor Set the distance between tab stops. This helps the preprocessor
report correct column numbers in warnings or errors, even if tabs appear report correct column numbers in warnings or errors, even if tabs appear
on the line. Values less than 1 or greater than 100 are ignored. The on the line. Values less than 1 or greater than 100 are ignored. The
default is 8. default is 8.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment