aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2003-05-04 21:45:08 +0000
committerNeil Booth <neil@gcc.gnu.org>2003-05-04 21:45:08 +0000
commit1fecc2668c2982329d6bdf5cee24604043f0a1e0 (patch)
treee48ce1ebe01be6799ef97562b1ff7846da8bf592
parenta8eb6044a9468a56cab63890820e17101ce8fd64 (diff)
downloadgcc-1fecc2668c2982329d6bdf5cee24604043f0a1e0.zip
gcc-1fecc2668c2982329d6bdf5cee24604043f0a1e0.tar.gz
gcc-1fecc2668c2982329d6bdf5cee24604043f0a1e0.tar.bz2
* doc/cppopts.texi: Enhance -Wtrigraphs documentation
From-SVN: r66462
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/doc/cppopts.texi16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c12
4 files changed, 30 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4830bea..bcd20e3 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2003-05-04 Neil Booth <neil@daikokuya.co.uk>
+
+ * 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.
+
2003-05-04 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* Makefile.in (LIBGCOV): Add _gcov_merge_add.
diff --git a/gcc/doc/cppopts.texi b/gcc/doc/cppopts.texi
index 490905a..46f2226 100644
--- a/gcc/doc/cppopts.texi
+++ b/gcc/doc/cppopts.texi
@@ -87,12 +87,16 @@ comment, or whenever a backslash-newline appears in a @samp{//} comment.
@item -Wtrigraphs
@opindex Wtrigraphs
@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.
+Most trigraphs in comments cannot affect the meaning of the program.
+However, a trigraph that would form an escaped newline (@samp{??/} at
+the end of a line) can, by changing where the comment begins or ends.
+Therefore, only trigraphs that would form escaped newlines produce
+warnings inside a comment.
+
+This option is implied by @option{-Wall}. If @option{-Wall} is not
+given, this option is still enabled unless trigraphs are enabled. To
+get trigraph conversion without warnings, but get the other
+@option{-Wall} warnings, use @samp{-trigraphs -Wall -Wno-trigraphs}.
@item -Wtraditional
@opindex Wtraditional
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1b79f24..56fb9fc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-05-04 Neil Booth <neil@daikokuya.co.uk>
+
+ * gcc.dg/cpp/Wtrigraphs.c: Update.
+ * gcc.dg/cpp/Wtrigraphs-2.c: New tests.
+
2003-05-03 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/ppc-fsel-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c
index d1e8226..43bf134 100644
--- a/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c
+++ b/gcc/testsuite/gcc.dg/cpp/Wtrigraphs-2.c
@@ -1,14 +1,14 @@
/* { dg-do preprocess } */
/* { dg-options "-std=c99 -Wtrigraphs -fno-show-column" } */
-/* Test we don't double warn for trigraphs immediately after preceding
- text. Source Neil Booth. 4 May 2003. */
+/* Test warnings for trigraphs in comments, with trigraphs enabled.
+ Neil Booth. 4 May 2003. */
-/* { dg-bogus "ignored" } Test ??< ??= a few ??/ random things in
+/* { dg-bogus "converted" } Test ??< ??= a few ??/ random things in
{ dg-warning "converted" } some ??/
- { dg-bogus "ignored" } ??< comments. */
+ { dg-bogus "converted" } ??< comments. */
-// { dg-bogus "ignored" } More ??/ comment ??> tests.
+// { dg-bogus "converted" } More ??/ comment ??> tests.
// { dg-warning "converted" } Another ??/
Test
@@ -16,5 +16,5 @@
// { dg-warning "converted" } And another with space after ??/
the escape
-// { dg-bogus "ignored" } A tricky one ??/\
+// { dg-bogus "converted" } A tricky one ??/\