summaryrefslogtreecommitdiff
path: root/gcc/cppmain.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/cppmain.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/cppmain.c')
-rw-r--r--gcc/cppmain.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index 9dc431e12d5..3e570be3584 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -142,6 +142,7 @@ cb_ident (pfile, str, len)
unsigned int len;
{
cpp_printf (pfile, &parse_out, "#ident \"%.*s\"\n", (int) len, str);
+ parse_out.lineno++;
}
static void
@@ -156,6 +157,7 @@ cb_define (pfile, hash)
|| CPP_OPTION (pfile, dump_macros) == dump_definitions)
cpp_dump_definition (pfile, parse_out.outf, hash);
putc ('\n', parse_out.outf);
+ parse_out.lineno++;
}
}
@@ -165,7 +167,10 @@ cb_undef (pfile, hash)
cpp_hashnode *hash;
{
if (pfile->done_initializing)
- cpp_printf (pfile, &parse_out, "#undef %s\n", hash->name);
+ {
+ cpp_printf (pfile, &parse_out, "#undef %s\n", hash->name);
+ parse_out.lineno++;
+ }
}
static void
@@ -183,6 +188,7 @@ cb_include (pfile, dir, str, len, ab)
l = '"', r = '"';
cpp_printf (pfile, &parse_out, "#%s %c%.*s%c\n", dir, l, (int) len, str, r);
+ parse_out.lineno++;
}
static void
@@ -233,6 +239,7 @@ cb_def_pragma (pfile)
cpp_output_list (pfile, parse_out.outf, &pfile->token_list,
pfile->first_directive_token + 2);
putc ('\n', parse_out.outf);
+ parse_out.lineno++;
}
static void
@@ -278,6 +285,7 @@ dump_macros_helper (pfile, hp)
cpp_printf (pfile, &parse_out, "#define %s", hp->name);
cpp_dump_definition (pfile, parse_out.outf, hp);
putc ('\n', parse_out.outf);
+ parse_out.lineno++;
}
return 1;