aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpptrad.c
diff options
context:
space:
mode:
authorNeil Booth <neil@daikokuya.co.uk>2002-06-22 11:08:20 +0000
committerNeil Booth <neil@gcc.gnu.org>2002-06-22 11:08:20 +0000
commit847c76c86abab21f77c80bf224c35869f6a12736 (patch)
treed5cc8fde896535a17af7b0bd1b7317936cbd2e85 /gcc/cpptrad.c
parent112bae7721708444619bfd87e881226918d9fd1b (diff)
downloadgcc-847c76c86abab21f77c80bf224c35869f6a12736.zip
gcc-847c76c86abab21f77c80bf224c35869f6a12736.tar.gz
gcc-847c76c86abab21f77c80bf224c35869f6a12736.tar.bz2
cpptrad.c (struct fun_macro): Add line number.
* 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. From-SVN: r54907
Diffstat (limited to 'gcc/cpptrad.c')
-rw-r--r--gcc/cpptrad.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/cpptrad.c b/gcc/cpptrad.c
index b3413d0..22320c4 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