Commit f4b2bde7 by Per Bothner Committed by Per Bothner

c-lex.c (fe_file_change): Handle a NULL new_map.


	* c-lex.c (fe_file_change):  Handle a NULL new_map.
	* fix-header.c (cb_file_change):  Likewise.
	* c-ppoutput.c (pp_file_change):  Likewise.

From-SVN: r72011
parent efef2a5f
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
(get_non_padding_token): We no longer need to compensate for the (get_non_padding_token): We no longer need to compensate for the
"horrible things" the C++ front-end does with the current line number, "horrible things" the C++ front-end does with the current line number,
* c-lex.c (fe_file_change): Handle a NULL new_map.
* fix-header.c (cb_file_change): Likewise.
* c-ppoutput.c (pp_file_change): Likewise.
2003-10-01 Zack Weinberg <zack@codesourcery.com> 2003-10-01 Zack Weinberg <zack@codesourcery.com>
* target.h (init_libfuncs): New hook. * target.h (init_libfuncs): New hook.
......
...@@ -212,6 +212,12 @@ cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir) ...@@ -212,6 +212,12 @@ cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
void void
fe_file_change (const struct line_map *new_map) fe_file_change (const struct line_map *new_map)
{ {
if (new_map == NULL)
{
map = NULL;
return;
}
if (new_map->reason == LC_ENTER) if (new_map->reason == LC_ENTER)
{ {
/* Don't stack the main buffer on the input stack; /* Don't stack the main buffer on the input stack;
......
...@@ -346,24 +346,27 @@ pp_file_change (const struct line_map *map) ...@@ -346,24 +346,27 @@ pp_file_change (const struct line_map *map)
if (flag_no_line_commands || flag_no_output) if (flag_no_line_commands || flag_no_output)
return; return;
/* First time? */ if (map != NULL)
if (print.map == NULL)
{ {
/* Avoid printing foo.i when the main file is foo.c. */ /* First time? */
if (!cpp_get_options (parse_in)->preprocessed) if (print.map == NULL)
print_line (map, map->from_line, flags); {
} /* Avoid printing foo.i when the main file is foo.c. */
else if (!cpp_get_options (parse_in)->preprocessed)
{ print_line (map, map->from_line, flags);
/* Bring current file to correct line when entering a new file. */ }
if (map->reason == LC_ENTER) else
maybe_print_line (map - 1, map->from_line - 1); {
/* Bring current file to correct line when entering a new file. */
if (map->reason == LC_ENTER) if (map->reason == LC_ENTER)
flags = " 1"; maybe_print_line (map - 1, map->from_line - 1);
else if (map->reason == LC_LEAVE)
flags = " 2"; if (map->reason == LC_ENTER)
print_line (map, map->from_line, flags); flags = " 1";
else if (map->reason == LC_LEAVE)
flags = " 2";
print_line (map, map->from_line, flags);
}
} }
print.map = map; print.map = map;
......
...@@ -578,7 +578,7 @@ cb_file_change (cpp_reader *pfile ATTRIBUTE_UNUSED, ...@@ -578,7 +578,7 @@ cb_file_change (cpp_reader *pfile ATTRIBUTE_UNUSED,
const struct line_map *map) const struct line_map *map)
{ {
/* Just keep track of current file name. */ /* Just keep track of current file name. */
cur_file = map->to_file; cur_file = map == NULL ? NULL : map->to_file;
} }
static void static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment