OSDN Git Service

Index: ChangeLog
[pf3gnuchains/gcc-fork.git] / gcc / line-map.c
index a0f3ee5..8bbe863 100644 (file)
@@ -22,17 +22,17 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "line-map.h"
 #include "intl.h"
 
-static void trace_include
-  PARAMS ((const struct line_maps *, const struct line_map *));
+static void trace_include (const struct line_maps *, const struct line_map *);
 
 /* Initialize a line map set.  */
 
 void
-init_line_maps (set)
-     struct line_maps *set;
+init_line_maps (struct line_maps *set)
 {
   set->maps = 0;
   set->allocated = 0;
@@ -45,8 +45,7 @@ init_line_maps (set)
 /* Free a line map set.  */
 
 void
-free_line_maps (set)
-     struct line_maps *set;
+free_line_maps (struct line_maps *set)
 {
   if (set->maps)
     {
@@ -64,20 +63,16 @@ free_line_maps (set)
 }
 
 /* Add a mapping of logical source line to physical source file and
-   line number.  Ther text pointed to by TO_FILE must have a lifetime
+   line number.  The text pointed to by TO_FILE must have a lifetime
    at least as long as the final call to lookup_line ().
 
    FROM_LINE should be monotonic increasing across calls to this
    function.  */
 
 const struct line_map *
-add_line_map (set, reason, sysp, from_line, to_file, to_line)
-     struct line_maps *set;
-     enum lc_reason reason;
-     unsigned int sysp;
-     unsigned int from_line;
-     const char *to_file;
-     unsigned int to_line;
+add_line_map (struct line_maps *set, enum lc_reason reason,
+             unsigned int sysp, unsigned int from_line,
+             const char *to_file, unsigned int to_line)
 {
   struct line_map *map;
 
@@ -104,9 +99,9 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
 
       if (MAIN_FILE_P (map - 1))
        {
-         error = true;
-         reason = LC_RENAME;
-         from = map - 1;
+         set->depth--;
+         set->used--;
+         return NULL;
        }
       else
        {
@@ -137,8 +132,8 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
 
   if (reason == LC_ENTER)
     {
+      map->included_from = set->depth == 0 ? -1 : (int) (set->used - 2);
       set->depth++;
-      map->included_from = set->used - 2;
       if (set->trace_includes)
        trace_include (set, map);
     }
@@ -159,9 +154,7 @@ add_line_map (set, reason, sysp, from_line, to_file, to_line)
    the list is sorted and we can use a binary search.  */
 
 const struct line_map *
-lookup_line (set, line)
-     struct line_maps *set;
-     unsigned int line;
+lookup_line (struct line_maps *set, unsigned int line)
 {
   unsigned int md, mn = 0, mx = set->used;
 
@@ -185,9 +178,7 @@ lookup_line (set, line)
    the most recently listed stack is the same as the current one.  */
 
 void
-print_containing_files (set, map)
-     struct line_maps *set;
-     const struct line_map *map;
+print_containing_files (struct line_maps *set, const struct line_map *map)
 {
   if (MAIN_FILE_P (map) || set->last_listed == map->included_from)
     return;
@@ -223,9 +214,7 @@ print_containing_files (set, map)
 /* Print an include trace, for e.g. the -H option of the preprocessor.  */
 
 static void
-trace_include (set, map)
-     const struct line_maps *set;
-     const struct line_map *map;
+trace_include (const struct line_maps *set, const struct line_map *map)
 {
   unsigned int i = set->depth;