aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpp.texi
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-04-08 04:00:02 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-04-08 04:00:02 +0000
commit64aaf40718c2f7664d6bb6de25575ca2451a59b3 (patch)
tree54f1e456f876159b92452e63265ec5cc24bf17b5 /gcc/cpp.texi
parent62828c0078f54356ccc4d81136bd2ef6c68e9b7b (diff)
downloadgcc-64aaf40718c2f7664d6bb6de25575ca2451a59b3.zip
gcc-64aaf40718c2f7664d6bb6de25575ca2451a59b3.tar.gz
gcc-64aaf40718c2f7664d6bb6de25575ca2451a59b3.tar.bz2
cppexp.c (parse_charconst): Null does not end character constants.
* cppexp.c (parse_charconst): Null does not end character constants. * cppinit.c (ISTABLE): Null character handled as whitespace. * cpplex.c (null_warning): new function. (skip_string): Emit warning if nulls encountered. (_cpp_skip_hspace): Emit warning if nulls encountered. (_cpp_lex_token): Emit warning if nulls encountered. Drop them. * cpp.texi: Update. From-SVN: r33013
Diffstat (limited to 'gcc/cpp.texi')
-rw-r--r--gcc/cpp.texi38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc/cpp.texi b/gcc/cpp.texi
index 0d2b2ee..e0442a1 100644
--- a/gcc/cpp.texi
+++ b/gcc/cpp.texi
@@ -138,6 +138,7 @@ and this may cause problems with other languages.
@node Global Actions, Directives, Top, Top
@section Transformations Made Globally
+@cindex ASCII NUL handling
Most C preprocessor features are inactive unless you give specific directives
to request their use. (Preprocessing directives are lines starting with
@@ -214,6 +215,43 @@ This exception is relevant only if you use the @samp{-trigraphs}
option to enable trigraph processing. @xref{Invocation}.
@end itemize
+The preprocessor handles null characters embedded in the input file
+depending upon the context in which the null appears. Note that here we
+are referring not to the two-character escape sequence "\0", but to the
+single character ASCII NUL.
+
+There are three different contexts in which a null character may
+appear:-
+
+@itemize @bullet
+@item
+Within comments. Here, null characters are silently ignored.
+
+@item
+Within a string or character constant. Here the preprocessor emits a
+warning, but preserves the null character and passes it through to the
+output file.
+
+@item
+In any other context, the preprocessor issues a warning, and discards
+the null character. In all other respects the preprocessor treats it
+like whitespace, combining it with any surrounding whitespace to become
+a single whitespace token. Representing the null character by "^@@",
+this means that code like
+
+@example
+#define X^@@1
+@end example
+
+is equivalent to
+
+@example
+#define X 1
+@end example
+
+and X is defined with replacement text "1".
+@end itemize
+
@node Directives, Header Files, Global Actions, Top
@section Preprocessing Directives