Commit 3244472d by Neil Booth Committed by Neil Booth

tradcpp.c: T_WARNING: New.

        * 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
parent c978ecd3
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> 2000-12-15 Jakub Jelinek <jakub@redhat.com>
* gcc.c (cpp_options): Pass -fno-operator-names. * gcc.c (cpp_options): Pass -fno-operator-names.
......
...@@ -221,9 +221,10 @@ enum node_type { ...@@ -221,9 +221,10 @@ enum node_type {
T_ELSE, /* `#else' */ T_ELSE, /* `#else' */
T_ELIF, /* `#elif' */ T_ELIF, /* `#elif' */
T_UNDEF, /* `#undef' */ T_UNDEF, /* `#undef' */
T_ERROR, /* `#error' */
T_LINE, /* `#line' */ T_LINE, /* `#line' */
T_ENDIF, /* `#endif' */ T_ENDIF, /* `#endif' */
T_ERROR, /* `#error' */
T_WARNING, /* `#warning' */
T_ASSERT, /* `#assert' */ T_ASSERT, /* `#assert' */
T_UNASSERT, /* `#unassert' */ T_UNASSERT, /* `#unassert' */
T_SPECLINE, /* special symbol `__LINE__' */ T_SPECLINE, /* special symbol `__LINE__' */
...@@ -329,6 +330,7 @@ struct arglist { ...@@ -329,6 +330,7 @@ struct arglist {
static void do_define PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *)); 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_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_line PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
static void do_include 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 *)); static void do_undef PARAMS ((U_CHAR *, U_CHAR *, FILE_BUF *));
...@@ -418,9 +420,10 @@ struct directive directive_table[] = { ...@@ -418,9 +420,10 @@ struct directive directive_table[] = {
{ 4, do_else, "else", T_ELSE }, { 4, do_else, "else", T_ELSE },
{ 6, do_ifndef, "ifndef", T_IFNDEF }, { 6, do_ifndef, "ifndef", T_IFNDEF },
{ 5, do_undef, "undef", T_UNDEF }, { 5, do_undef, "undef", T_UNDEF },
{ 5, do_error, "error", T_ERROR },
{ 4, do_line, "line", T_LINE }, { 4, do_line, "line", T_LINE },
{ 4, do_elif, "elif", T_ELIF }, { 4, do_elif, "elif", T_ELIF },
{ 5, do_error, "error", T_ERROR },
{ 7, do_warning, "warning", T_WARNING },
{ 6, do_assert, "assert", T_ASSERT }, { 6, do_assert, "assert", T_ASSERT },
{ 8, do_unassert,"unassert",T_UNASSERT}, { 8, do_unassert,"unassert",T_UNASSERT},
{ -1, 0, "", T_UNUSED}, { -1, 0, "", T_UNUSED},
...@@ -2473,6 +2476,8 @@ finclude (f, fname, op) ...@@ -2473,6 +2476,8 @@ finclude (f, fname, op)
output_line_command (fp, op, 0, enter_file); output_line_command (fp, op, 0, enter_file);
rescan (op, 0); rescan (op, 0);
indepth--; indepth--;
instack[indepth].lineno++;
instack[indepth].bufp++; /* Skip the new line. */
output_line_command (&instack[indepth], op, 0, leave_file); output_line_command (&instack[indepth], op, 0, leave_file);
free (fp->buf); free (fp->buf);
return; return;
...@@ -2931,19 +2936,12 @@ do_line (buf, limit, op) ...@@ -2931,19 +2936,12 @@ do_line (buf, limit, op)
/* The Newline at the end of this line remains to be processed. /* The Newline at the end of this line remains to be processed.
To put the next line at the specified line number, To put the next line at the specified line number,
we must store a line number now that is one less. */ 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. */ /* skip over the line number. */
while (ISDIGIT (*bp)) while (ISDIGIT (*bp))
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); SKIP_WHITE_SPACE (bp);
if (*bp == '\"') { if (*bp == '\"') {
...@@ -3009,6 +3007,7 @@ do_line (buf, limit, op) ...@@ -3009,6 +3007,7 @@ do_line (buf, limit, op)
ip->lineno = new_lineno; ip->lineno = new_lineno;
output_line_command (ip, op, 0, file_change); output_line_command (ip, op, 0, file_change);
ip->bufp++; /* Skip the new line. */
check_expand (op, ip->length - (ip->bufp - ip->buf)); check_expand (op, ip->length - (ip->bufp - ip->buf));
} }
...@@ -3198,6 +3197,16 @@ do_error (buf, limit, op) ...@@ -3198,6 +3197,16 @@ do_error (buf, limit, op)
error ("#error%.*s", (int) (limit - buf), buf); 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. */ /* Handle a #assert directive. */
static void static void
do_assert (buf, limit, op) do_assert (buf, limit, op)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment