OSDN Git Service

* include/line-map.h (struct line_maps):
[pf3gnuchains/gcc-fork.git] / libcpp / line-map.c
index 1c82902..dd3f11c 100644 (file)
@@ -4,7 +4,7 @@
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
 later version.
 
 This program is distributed in the hope that it will be useful,
@@ -13,8 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+along with this program; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.
 
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
@@ -34,12 +34,11 @@ linemap_init (struct line_maps *set)
   set->maps = NULL;
   set->allocated = 0;
   set->used = 0;
-  set->last_listed = -1;
   set->trace_includes = false;
   set->depth = 0;
   set->cache = 0;
-  set->highest_location = 0;
-  set->highest_line = 0;
+  set->highest_location = RESERVED_LOCATION_COUNT - 1;
+  set->highest_line = RESERVED_LOCATION_COUNT - 1;
   set->max_column_hint = 0;
   set->reallocator = 0;
 }
@@ -109,9 +108,12 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
 
   map = &set->maps[set->used];
 
-  if (to_file && *to_file == '\0')
+  if (to_file && *to_file == '\0' && reason != LC_RENAME_VERBATIM)
     to_file = "<stdin>";
 
+  if (reason == LC_RENAME_VERBATIM)
+    reason = LC_RENAME;
+
   /* If we don't keep our line maps consistent, we can easily
      segfault.  Don't rely on the client to do it for us.  */
   if (set->depth == 0)
@@ -135,7 +137,7 @@ linemap_add (struct line_maps *set, enum lc_reason reason,
       else
        {
          from = INCLUDED_FROM (set, map - 1);
-         error = to_file && strcmp (from->to_file, to_file);
+         error = to_file && filename_cmp (from->to_file, to_file);
        }
 
       /* Depending upon whether we are handling preprocessed input or