diff --git a/gcc/ChangeLog b/gcc/ChangeLog index dd931aab321..b42d16b89ab 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2000-12-12 Neil Booth + + * tradcpp.c (enum node_type): Add T_ERROR. + (do_error): New function. + (directive_table): Add #error handler. + 2000-12-12 Franz Sirl * configure.in (HAVE_AS_DWARF2_DEBUG_LINE): Enable .file/.loc check diff --git a/gcc/tradcpp.c b/gcc/tradcpp.c index afff42307d9..27bd3a23702 100644 --- a/gcc/tradcpp.c +++ b/gcc/tradcpp.c @@ -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)