OSDN Git Service

PR optimization/12544
[pf3gnuchains/gcc-fork.git] / gcc / c-lex.c
index 2109eff..5546fc9 100644 (file)
@@ -45,9 +45,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 /* The current line map.  */
 static const struct line_map *map;
 
-/* The line used to refresh the lineno global variable after each token.  */
-static unsigned int src_lineno;
-
 /* We may keep statistics about how long which files took to compile.  */
 static int header_time, body_time;
 static splay_tree file_info_tree;
@@ -202,7 +199,7 @@ cb_line_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const cpp_token *token,
   if (token->type == CPP_EOF || parsing_args)
     return;
 
-  src_lineno = SOURCE_LINE (map, token->line);
+  input_line = SOURCE_LINE (map, token->line);
 }
 
 static void
@@ -215,6 +212,12 @@ cb_dir_change (cpp_reader *pfile ATTRIBUTE_UNUSED, const char *dir)
 void
 fe_file_change (const struct line_map *new_map)
 {
+  if (new_map == NULL)
+    {
+      map = NULL;
+      return;
+    }
+
   if (new_map->reason == LC_ENTER)
     {
       /* Don't stack the main buffer on the input stack;
@@ -317,11 +320,6 @@ get_nonpadding_token (void)
   while (tok->type == CPP_PADDING);
   timevar_pop (TV_CPP);
 
-  /* The C++ front end does horrible things with the current line
-     number.  To ensure an accurate line number, we must reset it
-     every time we advance a token.  */
-  input_line = src_lineno;
-
   return tok;
 }