tradcpp.c (enum node_type): Add T_ERROR.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Tue, 12 Dec 2000 18:54:26 +0000 (18:54 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Tue, 12 Dec 2000 18:54:26 +0000 (18:54 +0000)
        * tradcpp.c (enum node_type): Add T_ERROR.
        (do_error): New function.
        (directive_table): Add #error handler.

From-SVN: r38205

gcc/ChangeLog
gcc/tradcpp.c

index dd931aab321d2b516ba73d6dc4ea0e1c3b0299c2..b42d16b89abf3fa626376226ad5d1f515ccbeb37 100644 (file)
@@ -1,3 +1,9 @@
+2000-12-12  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+        * tradcpp.c (enum node_type): Add T_ERROR.
+        (do_error): New function.
+        (directive_table): Add #error handler.
+
 2000-12-12  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
 
        * configure.in (HAVE_AS_DWARF2_DEBUG_LINE): Enable .file/.loc check
index afff42307d9dd1bc1067c966178aa9fc8475e78c..27bd3a23702fa3c0e6d30abe43bc4e6ef23e077e 100644 (file)
@@ -221,6 +221,7 @@ enum node_type {
  T_ELSE,       /* `#else' */
  T_ELIF,       /* `#elif' */
  T_UNDEF,      /* `#undef' */
+ T_ERROR,      /* `#error' */
  T_LINE,       /* `#line' */
  T_ENDIF,      /* `#endif' */
  T_ASSERT,     /* `#assert' */
@@ -327,6 +328,7 @@ struct arglist {
 /* Function prototypes.  */
 
 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_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 *));
@@ -416,6 +418,7 @@ 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    },
   {  6, do_assert,  "assert",  T_ASSERT  },
@@ -3174,6 +3177,16 @@ test_assertion (pbuf)
   return result;
 }
 
+/* Handle a #error directive.  */
+static void
+do_error (buf, limit, op)
+     U_CHAR *buf;
+     U_CHAR *limit;
+     FILE_BUF *op ATTRIBUTE_UNUSED;
+{
+  error ("#error%.*s", limit - buf, buf);
+}
+
 /* Handle a #assert directive.  */
 static void
 do_assert (buf, limit, op)