aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc
diff options
context:
space:
mode:
authorNeil Booth <neil@gcc.gnu.org>2003-05-04 20:03:55 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-05-04 20:03:55 +0000
commita8eb6044a9468a56cab63890820e17101ce8fd64 (patch)
treedb0e598a611fbe90ebcaf267b9665fd02c67a70f /gcc/doc
parent09780dfb652960d422da1c5a9d81dc536cdf09f4 (diff)
downloadgcc-a8eb6044a9468a56cab63890820e17101ce8fd64.zip
gcc-a8eb6044a9468a56cab63890820e17101ce8fd64.tar.gz
gcc-a8eb6044a9468a56cab63890820e17101ce8fd64.tar.bz2
cppinit.c (cpp_create_reader, [...]): Warn about trigraphs unless explicity set or -trigraphs.
* cppinit.c (cpp_create_reader, post_options): Warn about trigraphs unless explicity set or -trigraphs. * cpplex.c (warn_in_comment): New. (_cpp_process_line_notes): Better handling of -Wtrigraphs. (_cpp_skip_block_comment): Add call to _cpp_process_line_notes. * doc/cppopts.texi, doc/cpp.texi: Update. testsuite: * gcc.dg/cpp/Wtrigraphs.c: Update. * gcc.dg/cpp/Wtrigraphs-2.c: New tests. From-SVN: r66459
Diffstat (limited to 'gcc/doc')
-rw-r--r--gcc/doc/cpp.texi22
-rw-r--r--gcc/doc/cppopts.texi21
2 files changed, 25 insertions, 18 deletions
diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi
index cf962c4..173e341 100644
--- a/gcc/doc/cpp.texi
+++ b/gcc/doc/cpp.texi
@@ -293,16 +293,18 @@ obsolete systems that lack some of C's punctuation to use C@. For
example, @samp{??/} stands for @samp{\}, so @t{'??/n'} is a character
constant for a newline.
-Trigraphs are not popular and many compilers implement them incorrectly.
-Portable code should not rely on trigraphs being either converted or
-ignored. If you use the @option{-Wall} or @option{-Wtrigraphs} options,
-GCC will warn you when a trigraph would change the meaning of your
-program if it were converted.
-
-In a string constant, you can prevent a sequence of question marks from
-being confused with a trigraph by inserting a backslash between the
-question marks. @t{"(??\?)"} is the string @samp{(???)}, not
-@samp{(?]}. Traditional C compilers do not recognize this idiom.
+Trigraphs are not popular and many compilers implement them
+incorrectly. Portable code should not rely on trigraphs being either
+converted or ignored. With @option{-Wtrigraphs} GCC will warn you
+when a trigraph may change the meaning of your program if it were
+converted. @xref{Wtrigraphs}.
+
+In a string constant, you can prevent a sequence of question marks
+from being confused with a trigraph by inserting a backslash between
+the question marks, or by separating the string literal at the
+trigraph and making use of string literal concatenation. @t{"(??\?)"}
+is the string @samp{(???)}, not @samp{(?]}. Traditional C compilers
+do not recognize these idioms.
The nine trigraphs and their replacements are
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index 9212c80..490905a 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -69,10 +69,12 @@ use @option{-o} to specify the output file.
@item -Wall
@opindex Wall
-Turns on all optional warnings which are desirable for normal code. At
-present this is @option{-Wcomment} and @option{-Wtrigraphs}. Note that
-many of the preprocessor's warnings are on by default and have no
-options to control them.
+Turns on all optional warnings which are desirable for normal code.
+At present this is @option{-Wcomment}, @option{-Wtrigraphs},
+@option{-Wmultichar} and a warning about integer promotion causing a
+change of sign in @code{#if} expressions. Note that many of the
+preprocessor's warnings are on by default and have no options to
+control them.
@item -Wcomment
@itemx -Wcomments
@@ -84,10 +86,13 @@ comment, or whenever a backslash-newline appears in a @samp{//} comment.
@item -Wtrigraphs
@opindex Wtrigraphs
-Warn if any trigraphs are encountered. This option used to take effect
-only if @option{-trigraphs} was also specified, but now works
-independently. Warnings are not given for trigraphs within comments, as
-they do not affect the meaning of the program.
+@anchor{Wtrigraphs}
+Warn if any trigraphs that may change the meaning of a program are
+encountered. This option is in effect unless trigraphs are turned on,
+and is implied by @option{-Wall}. With the exception of a trigraph
+that would form an escaped newline, warnings are not given for
+trigraphs within comments as they do not affect the meaning of the
+program.
@item -Wtraditional
@opindex Wtraditional