summaryrefslogtreecommitdiff
path: root/gcc/cpplex.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-20 21:36:18 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-08-20 21:36:18 +0000
commitbad6bf53a0651af433617614f4967c4d0284dee2 (patch)
treed81b589e39b9cc29d2ac00a4c083ae74ae5241d1 /gcc/cpplex.c
parent49ebeab8b14af11693e4da237367c500e87d9f9e (diff)
downloadgcc-bad6bf53a0651af433617614f4967c4d0284dee2.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@35825 138bc75d-0d04-0410-961f-82ee72b054a4
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 7ab850bfa22..7b07944c03b 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)