tradcpp.c (enum node_type): Add T_ERROR.

* tradcpp.c (enum node_type): Add T_ERROR.
        (do_error): New function.
        (directive_table): Add #error handler.

From-SVN: r38205
This commit is contained in:
Neil Booth 2000-12-12 18:54:26 +00:00 committed by Neil Booth
parent d033a98935
commit e793c60979
2 changed files with 19 additions and 0 deletions

View 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

View 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)