summaryrefslogtreecommitdiff
path: root/gcc/cppmain.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-21 06:20:18 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-21 06:20:18 +0000
commitfe56063735d5ada48f5157d27ba21c2e1e9496f3 (patch)
treed3294a0e95ec060c7d36c19a66723166c94ce0f9 /gcc/cppmain.c
parent42938542aa5068c3fcabd6cfcebc823a05490be5 (diff)
downloadgcc-fe56063735d5ada48f5157d27ba21c2e1e9496f3.tar.gz
* cpphash.h (_cpp_push_next_buffer): New.
* cppinit.c (do_includes): Remove. (push_include, free_chain, _cpp_push_next_buffer): New. (cpp_start_read): Use them to rework command line option handling. (cpp_handle_option): Combine handling of -include and -imacros. * cpplex.c (_cpp_lex_token): Push a new -include buffer if appropriate. Always insert missing \n at EOF. * cpplib.c (start_directive): Get the directive position right. * cppmain.c (cb_file_change): Always print the first line, unless preprocessed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45070 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cppmain.c')
-rw-r--r--gcc/cppmain.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/cppmain.c b/gcc/cppmain.c
index b1166155908..b710dadc576 100644
--- a/gcc/cppmain.c
+++ b/gcc/cppmain.c
@@ -399,11 +399,17 @@ cb_file_change (pfile, map)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const struct line_map *map;
{
- /* Not first time? */
- if (print.map)
- {
- const char *flags = "";
+ const char *flags = "";
+ /* First time? */
+ if (print.map == NULL)
+ {
+ /* Avoid printing foo.i when the main file is foo.c. */
+ if (!options->preprocessed)
+ print_line (map, map->from_line, flags);
+ }
+ else
+ {
/* Bring current file to correct line when entering a new file. */
if (map->reason == LC_ENTER)
maybe_print_line (map - 1, map->from_line - 1);
@@ -412,7 +418,6 @@ cb_file_change (pfile, map)
flags = " 1";
else if (map->reason == LC_LEAVE)
flags = " 2";
-
print_line (map, map->from_line, flags);
}