]> gcc.gnu.org Git - gcc.git/commitdiff
tradcpp.c: T_WARNING: New.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Sat, 16 Dec 2000 10:41:56 +0000 (10:41 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Sat, 16 Dec 2000 10:41:56 +0000 (10:41 +0000)
        * tradcpp.c: T_WARNING: New.
        (do_warning): New function.
        (finclude): Skip past the newline and increase the line number
        before calling output_line_command.
        (do_line): Skip the new line after output_line_command.  Don't
        pre-decrement the line number.

From-SVN: r38305

gcc/ChangeLog
gcc/tradcpp.c

index 9db5b42677418fcc6e3db45c4345eff5f5de0330..5d5829766f360ebc6c72f63a6804dcdb1bc320d9 100644 (file)
@@ -1,3 +1,12 @@
+2000-12-16  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+        * tradcpp.c: T_WARNING: New.
+        (do_warning): New function.
+        (finclude): Skip past the newline and increase the line number
+        before calling output_line_command.
+        (do_line): Skip the new line after output_line_command.  Don't  
+        pre-decrement the line number.   
+
 2000-12-15  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.c (cpp_options): Pass -fno-operator-names.
index a0a55b8167d501c228ce12b02dbb09049ae5c715..bb9724915d96c2167bc5bc972043a9c04e773635 100644 (file)
@@ -221,9 +221,10 @@ enum node_type {
  T_ELSE,       /* `#else' */
  T_ELIF,       /* `#elif' */
  T_UNDEF,      /* `#undef' */
- T_ERROR,      /* `#error' */
  T_LINE,       /* `#line' */
  T_ENDIF,      /* `#endif' */
+ T_ERROR,      /* `#error' */
+ T_WARNING,    /* `#warning' */
  T_ASSERT,     /* `#assert' */
  T_UNASSERT,   /* `#unassert' */
  T_SPECLINE,   /* special symbol `__LINE__' */
@@ -329,6 +330,7 @@ struct arglist {
 
 static void do_define  PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
 static void do_error   PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
+static void do_warning PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
 static void do_line    PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
 static void do_include PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
 static void do_undef   PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
@@ -418,9 +420,10 @@ struct directive directive_table[] = {
   {  4, do_else,    "else",    T_ELSE    },
   {  6, do_ifndef,  "ifndef",  T_IFNDEF  },
   {  5, do_undef,   "undef",   T_UNDEF   },
-  {  5, do_error,   "error",   T_ERROR   },
   {  4, do_line,    "line",    T_LINE    },
   {  4, do_elif,    "elif",    T_ELIF    },
+  {  5, do_error,   "error",   T_ERROR   },
+  {  7, do_warning, "warning", T_WARNING },
   {  6, do_assert,  "assert",  T_ASSERT  },
   {  8, do_unassert,"unassert",T_UNASSERT},
   {  -1, 0, "", T_UNUSED},
@@ -2473,6 +2476,8 @@ finclude (f, fname, op)
   output_line_command (fp, op, 0, enter_file);
   rescan (op, 0);
   indepth--;
+  instack[indepth].lineno++;
+  instack[indepth].bufp++;     /* Skip the new line.  */
   output_line_command (&instack[indepth], op, 0, leave_file);
   free (fp->buf);
   return;
@@ -2931,19 +2936,12 @@ do_line (buf, limit, op)
   /* The Newline at the end of this line remains to be processed.
      To put the next line at the specified line number,
      we must store a line number now that is one less.  */
-  new_lineno = atoi ((const char *)bp) - 1;
+  new_lineno = atoi ((const char *)bp);
 
   /* skip over the line number.  */
   while (ISDIGIT (*bp))
     bp++;
 
-#if 0 /* #line 10"foo.c" is supposed to be allowed.  */
-  if (*bp && !is_space (*bp)) {
-    error ("invalid format #line command");
-    return;
-  }
-#endif
-
   SKIP_WHITE_SPACE (bp);
 
   if (*bp == '\"') {
@@ -3009,6 +3007,7 @@ do_line (buf, limit, op)
 
   ip->lineno = new_lineno;
   output_line_command (ip, op, 0, file_change);
+  ip->bufp++;                  /* Skip the new line.  */
   check_expand (op, ip->length - (ip->bufp - ip->buf));
 }
 
@@ -3198,6 +3197,16 @@ do_error (buf, limit, op)
   error ("#error%.*s", (int) (limit - buf), buf);
 }
 
+/* Handle a #warning directive.  */
+static void
+do_warning (buf, limit, op)
+     U_CHAR *buf;
+     U_CHAR *limit;
+     FILE_BUF *op ATTRIBUTE_UNUSED;
+{
+  warning ("#warning%.*s", (int) (limit - buf), buf);
+}
+
 /* Handle a #assert directive.  */
 static void
 do_assert (buf, limit, op)
This page took 0.076618 seconds and 5 git commands to generate.