diff options
author | Neil Booth <neil@daikokuya.demon.co.uk> | 2000-12-12 18:54:26 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2000-12-12 18:54:26 +0000 |
commit | e793c60979f7a1570e33810541b301b861fb64a6 (patch) | |
tree | fb12373fbefeb3e65e2fa9894ead7673ca3fd5c1 /gcc/tradcpp.c | |
parent | d033a98935109d31a0a2987c99da6944d8fd8afe (diff) | |
download | gcc-e793c60979f7a1570e33810541b301b861fb64a6.zip gcc-e793c60979f7a1570e33810541b301b861fb64a6.tar.gz gcc-e793c60979f7a1570e33810541b301b861fb64a6.tar.bz2 |
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
Diffstat (limited to 'gcc/tradcpp.c')
-rw-r--r-- | gcc/tradcpp.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tradcpp.c b/gcc/tradcpp.c index afff423..27bd3a23 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) |