aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-08-20 21:36:18 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-08-20 21:36:18 +0000
commit3cb553b4684a17ca436be66895be0aeaee83644f (patch)
treed81b589e39b9cc29d2ac00a4c083ae74ae5241d1 /gcc/cpplex.c
parent53e687fabb8208f715fd30172c48430eef4e2255 (diff)
downloadgcc-3cb553b4684a17ca436be66895be0aeaee83644f.zip
gcc-3cb553b4684a17ca436be66895be0aeaee83644f.tar.gz
gcc-3cb553b4684a17ca436be66895be0aeaee83644f.tar.bz2
[multiple changes]
2000-08-20 Zack Weinberg <zack@wolery.cumb.org> * cppinit.c (cpp_init): Set global flag when called. (cpp_reader_init): Bomb out if cpp_init hasn't been called. Sun Aug 20 01:41:35 MSD 2000 Dennis Chernoivanov <cdi@sparc.spb.su> * cpplex.c (cpp_scan_buffer): Move `output_line_command' just before `process_directive' so that newlines won't be missed for directives. (cpp_printf): Increment `print->lineno' when newline is emitted. * cppmain.c (cb_ident): Likewise. (cb_define): Likewise. (cb_undef): Likewise. (cb_include): Likewise. (cb_def_pragma): Likewise. (dump_macros_helper): Likewise. * gcc.dg/cpp/pragma-1.c: New test. * gcc.dg/cpp/pragma-2.c: New test. From-SVN: r35825
Diffstat (limited to 'gcc/cpplex.c')
-rw-r--r--gcc/cpplex.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/cpplex.c b/gcc/cpplex.c
index 7ab850b..7b07944 100644
--- a/gcc/cpplex.c
+++ b/gcc/cpplex.c
@@ -299,7 +299,10 @@ cpp_printf VPARAMS ((cpp_reader *pfile, cpp_printer *print,
/* End the previous line of text. */
if (pfile->need_newline)
- putc ('\n', print->outf);
+ {
+ putc ('\n', print->outf);
+ print->lineno++;
+ }
pfile->need_newline = 0;
vfprintf (print->outf, fmt, ap);
@@ -363,14 +366,14 @@ cpp_scan_buffer (pfile, print)
if (token->flags & BOL)
{
+ output_line_command (pfile, print, pfile->token_list.line);
+ prev = 0;
+
if (token->type == CPP_HASH && pfile->token_list.directive)
{
process_directive (pfile, token);
continue;
}
-
- output_line_command (pfile, print, pfile->token_list.line);
- prev = 0;
}
if (token->type != CPP_PLACEMARKER)