]> gcc.gnu.org Git - gcc.git/commitdiff
cpplex.c (trigraph_ok): Ensure we don't warn twice.
authorNeil Booth <neilb@earthling.net>
Wed, 22 Nov 2000 20:36:10 +0000 (20:36 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Wed, 22 Nov 2000 20:36:10 +0000 (20:36 +0000)
* cpplex.c (trigraph_ok): Ensure we don't warn twice.
* cpplib.h (struct cpp_buffer): New member last_Wtrigraphs.

From-SVN: r37669

gcc/ChangeLog
gcc/cpplex.c
gcc/cpplib.h

index c8bde8c640caef1b7302bca6fcba667fe5d3db42..0966d8fa23777406e5a6705500ed8137f5b10da3 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-22  Neil Booth  <neilb@earthling.net>
+
+       * cpplex.c (trigraph_ok): Ensure we don't warn twice.
+       * cpplib.h (struct cpp_buffer): New member last_Wtrigraphs.
+       
 2000-11-22  Richard Henderson  <rth@redhat.com>
 
        * haifa-sched.c (sched_analyze_1): Don't special-case calls
index 96e2454316ab8d15ba1811de4c89b7339268c285..bec14e76042edbaf5bc6131452e0e5031ab13dc4 100644 (file)
@@ -159,9 +159,13 @@ trigraph_ok (pfile, from_char)
                               "trigraph ??%c converted to %c",
                               (int) from_char,
                               (int) _cpp_trigraph_map[from_char]);
-      else
-       cpp_warning_with_line (pfile, buffer->lineno, CPP_BUF_COL (buffer) - 2,
-                              "trigraph ??%c ignored", (int) from_char);
+      else if (buffer->cur != buffer->last_Wtrigraphs)
+       {
+         buffer->last_Wtrigraphs = buffer->cur;
+         cpp_warning_with_line (pfile, buffer->lineno,
+                                CPP_BUF_COL (buffer) - 2,
+                                "trigraph ??%c ignored", (int) from_char);
+       }
     }
 
   return accept;
index 5922f94290f1f2f0f8dfe130cceeacea7e641fcb..91cca9007335e056a0dead105a40d8e50e4e797d 100644 (file)
@@ -282,6 +282,10 @@ struct cpp_buffer
   /* Line number at line_base (above). */
   unsigned int lineno;
 
+  /* Because of the way the lexer works, -Wtrigraphs can sometimes
+     warn twice for the same trigraph.  This helps prevent that.  */
+  const unsigned char *last_Wtrigraphs;
+
   /* True if we have already warned about C++ comments in this file.
      The warning happens only for C89 extended mode with -pedantic on,
      or for -Wtraditional, and only once per file (otherwise it would
This page took 0.067652 seconds and 5 git commands to generate.