]> gcc.gnu.org Git - gcc.git/commitdiff
cpptrad.c (skip_macro_block_comment): New.
authorNeil Booth <neil@daikokuya.co.uk>
Sat, 28 Jun 2003 15:16:10 +0000 (15:16 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Sat, 28 Jun 2003 15:16:10 +0000 (15:16 +0000)
* cpptrad.c (skip_macro_block_comment): New.
(copy_comment): Use it if appropriate.

From-SVN: r68641

gcc/ChangeLog
gcc/cpptrad.c

index 5d0ffcfae33436661ce04286dc24d7c8fbb76ec8..d2c9163617a942e9aed4529af4ac2fa687234b88 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-28  Neil Booth  <neil@daikokuya.co.uk>
+
+       * cpptrad.c (skip_macro_block_comment): New.
+       (copy_comment): Use it if appropriate.
+
 2003-06-28  Kazu Hirata  <kazu@cs.umass.edu>
 
        * gcse.c (compute_ld_motion_mems): Use INSN_P instead of its
index 0e4b2314bb4077001e46aa9a223d7aa846877ae5..9b08e31138fff1488a951556853b6ae0b684d0a2 100644 (file)
@@ -116,6 +116,25 @@ check_output_buffer (cpp_reader *pfile, size_t n)
     }
 }
 
+/* Skip a C-style block comment in a macro as a result of -CC.
+   Buffer->cur points to the initial asterisk of the comment.  */
+static void
+skip_macro_block_comment (cpp_reader *pfile)
+{
+  const uchar *cur = pfile->buffer->cur;
+
+  cur++;
+  if (*cur == '/')
+    cur++;
+
+  /* People like decorating comments with '*', so check for '/'
+     instead for efficiency.  */
+  while(! (*cur++ == '/' && cur[-2] == '*') )
+    ;
+
+  pfile->buffer->cur = cur;
+}
+
 /* CUR points to the asterisk introducing a comment in the current
    context.  IN_DEFINE is true if we are in the replacement text of a
    macro.
@@ -136,7 +155,11 @@ copy_comment (cpp_reader *pfile, const uchar *cur, int in_define)
   cpp_buffer *buffer = pfile->buffer;
 
   buffer->cur = cur;
-  unterminated = _cpp_skip_block_comment (pfile);
+  if (pfile->context->prev)
+    unterminated = false, skip_macro_block_comment (pfile);
+  else
+    unterminated = _cpp_skip_block_comment (pfile);
+    
   if (unterminated)
     cpp_error_with_line (pfile, DL_ERROR, from_line, 0,
                         "unterminated comment");
This page took 0.093475 seconds and 5 git commands to generate.