diff options
author | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-22 11:08:20 +0000 |
---|---|---|
committer | neil <neil@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-22 11:08:20 +0000 |
commit | 48315635253be5939aafca0d1213be86d039dff5 (patch) | |
tree | d5cc8fde896535a17af7b0bd1b7317936cbd2e85 /gcc/cpptrad.c | |
parent | c75cb827a22e2555e02ab4172d37da2f4cee387a (diff) | |
download | gcc-48315635253be5939aafca0d1213be86d039dff5.tar.gz |
* cpptrad.c (struct fun_macro): Add line number.
(scan_out_logical_line): Set it, and use it to report unterminated
macro invocations.
testsuite:
* gcc.dg/cpp/trad/comment-2.c. gcc.dg/cpp/trad/funlike-2.c,
gcc.dg/cpp/trad/funlike.c, gcc.dg/cpp/trad/funlike-3.c,
gcc.dg/cpp/trad/literals-1.c, gcc.dg/cpp/trad/literals-2.c,
gcc.dg/cpp/trad/macroargs.c, gcc.dg/cpp/trad/quote.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54907 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpptrad.c')
-rw-r--r-- | gcc/cpptrad.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c index b3413d031f0..22320c49edc 100644 --- a/gcc/cpptrad.c +++ b/gcc/cpptrad.c @@ -59,6 +59,9 @@ struct fun_macro /* The offset of the macro name in the output buffer. */ size_t offset; + /* The line the macro name appeared on. */ + unsigned int line; + /* Zero-based index of argument being currently lexed. */ unsigned int argc; }; @@ -586,6 +589,7 @@ scan_out_logical_line (pfile, macro) { maybe_start_funlike (pfile, node, out_start, &fmacro); lex_state = ls_fun_open; + fmacro.line = pfile->line; continue; } else @@ -721,9 +725,9 @@ scan_out_logical_line (pfile, macro) _cpp_release_buff (pfile, fmacro.buff); if (lex_state == ls_fun_close) - cpp_error (pfile, DL_ERROR, - "unterminated argument list invoking macro \"%s\"", - NODE_NAME (fmacro.node)); + cpp_error_with_line (pfile, DL_ERROR, fmacro.line, 0, + "unterminated argument list invoking macro \"%s\"", + NODE_NAME (fmacro.node)); } /* Push a context holding the replacement text of the macro NODE on |