]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Changelog c-family/
authorktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Mar 2011 19:20:52 +0000 (19:20 +0000)
committerktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 25 Mar 2011 19:20:52 +0000 (19:20 +0000)
2011-03-25  Kai Tietz  <ktietz@redhat.com>

* c-ada-spec.c (compare_comment): Use filename_cmp
instead of strcmp for filename.

Changelog fortran/

2011-03-25  Kai Tietz  <ktietz@redhat.com>

* scanner.c (preprocessor_line): Use filename_cmp
instead of strcmp.

Changelog gcc/

2011-03-25  Kai Tietz  <ktietz@redhat.com>

* collect2.c (write_c_file_stat): Handle backslash
as right-hand directory separator.
(resolve_lib_name): Use IS_DIR_SEPARATOR instead of
checking just for slash.
* coverage.c (coverage_init): Use IS_ABSOLUTE_PATH
instead of checking for trailing slash.
* gcc.c (record_temp_file): Use filename_cmp instead
of strcmp.
(do_spec_1): Likewise.
(replace_outfile_spec_function): Likewise.
(is_directory): Use filename_ncmp instead of strncmp.
(print_multilib_info): Likewise.
* gcov.c (find_source): Use filename_cmp instead
instead of strcmp.
(make_gcov_file_name): Fix order of slash/backslash
checks.
* incpath.c (DIRS_EQ): Use filename_cmp instead of strcmp.
(add_standard_paths): Likewise.
* mips-tfile.c (saber_stop): Handle backslash.
* prefix.c (update_path): Use filename_ncmp instead of
strncmp.
* profile.c (output_location): Use filename_cmp instead
of strcmp.
* read-md.c (handle_toplevel_file): Handle backslash.
* tlink.c (frob_extension):  Likewise.
* tree-cfg.c (same_line_p): Use filename_cmp instead of
strcmp.
* tree-dump.c (dequeue_and_dump): Handle backslash.
* tree.c (get_file_function_name): Likewise.
* gengtype.c (read_input_list): Likewise.
(get_file_realbasename): Likewise.
(get_output_file_with_visibility): Use filename_cmp
instead of strcmp.

ChangeLog java/

2011-03-25  Kai Tietz  <ktietz@redhat.com>

* jcf-parse.c (java_read_sourcefilenames): Use filename_cmp
instead of strcmp.
(set_source_filename): Likewise.
* win32-host.c (jcf_open_exact_case): Likewise.

ChangeLog lto/

2011-03-25  Kai Tietz  <ktietz@redhat.com>

* lto.c (lto_resolution_read): Use filename_cmp instead
of strcmp.
(lto_read_section_data): Likewise.

ChangeLog cp/

2011-03-25  Kai Tietz  <ktietz@redhat.com>

* lex.c (interface_strcmp): Handle dos-paths.
(handle_pragma_implementation): Use filename_cmp instead of
strcmp.
(in_main_input_context): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171522 138bc75d-0d04-0410-961f-82ee72b054a4

26 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-ada-spec.c
gcc/collect2.c
gcc/coverage.c
gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/fortran/ChangeLog
gcc/fortran/scanner.c
gcc/gcc.c
gcc/gcov.c
gcc/gengtype.c
gcc/incpath.c
gcc/java/ChangeLog
gcc/java/jcf-parse.c
gcc/java/win32-host.c
gcc/lto/ChangeLog
gcc/lto/lto.c
gcc/mips-tfile.c
gcc/prefix.c
gcc/profile.c
gcc/read-md.c
gcc/tlink.c
gcc/tree-cfg.c
gcc/tree-dump.c
gcc/tree.c

index 64c4b5a0cbc95a32471d5aa2fbdf90fe4c8cfd79..e7983a2fe44e060d81c2d864d63557051b4eb7ed 100644 (file)
@@ -1,3 +1,39 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * collect2.c (write_c_file_stat): Handle backslash
+       as right-hand directory separator.
+       (resolve_lib_name): Use IS_DIR_SEPARATOR instead of
+       checking just for slash.
+       * coverage.c (coverage_init): Use IS_ABSOLUTE_PATH
+       instead of checking for trailing slash.
+       * gcc.c (record_temp_file): Use filename_cmp instead
+       of strcmp.
+       (do_spec_1): Likewise.
+       (replace_outfile_spec_function): Likewise.
+       (is_directory): Use filename_ncmp instead of strncmp.
+       (print_multilib_info): Likewise.
+       * gcov.c (find_source): Use filename_cmp instead
+       instead of strcmp.
+       (make_gcov_file_name): Fix order of slash/backslash
+       checks.
+       * incpath.c (DIRS_EQ): Use filename_cmp instead of strcmp.
+       (add_standard_paths): Likewise.
+       * mips-tfile.c (saber_stop): Handle backslash.
+       * prefix.c (update_path): Use filename_ncmp instead of
+       strncmp.
+       * profile.c (output_location): Use filename_cmp instead
+       of strcmp.
+       * read-md.c (handle_toplevel_file): Handle backslash.
+       * tlink.c (frob_extension):  Likewise.
+       * tree-cfg.c (same_line_p): Use filename_cmp instead of
+       strcmp.
+       * tree-dump.c (dequeue_and_dump): Handle backslash.
+       * tree.c (get_file_function_name): Likewise.
+       * gengtype.c (read_input_list): Likewise.
+       (get_file_realbasename): Likewise.
+       (get_output_file_with_visibility): Use filename_cmp
+       instead of strcmp.
+
 2011-03-25  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * config/arm/arm.h (CANNOT_CHANGE_MODE_CLASS): Restrict FPA_REGS
index e8a14fe27f56a5f90bbd8adca648c5ba7e685af7..a1cd34663cb677f5e89b182166a65afcf2294be7 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * c-ada-spec.c (compare_comment): Use filename_cmp
+       instead of strcmp for filename.
+
 2011-03-25  Jeff Law  <law@redhat.com>
 
        * c-family/c-common.c (def_fn_type): Add missing va_end.
index 8b9e93a20974342517a6928f87eceb0c1a35508a..edfc43b23fcb9741e021533f45d62ed63fc11653 100644 (file)
@@ -559,7 +559,8 @@ compare_comment (const void *lp, const void *rp)
   const cpp_comment *rhs = (const cpp_comment *) rp;
 
   if (LOCATION_FILE (lhs->sloc) != LOCATION_FILE (rhs->sloc))
-    return strcmp (LOCATION_FILE (lhs->sloc), LOCATION_FILE (rhs->sloc));
+    return filename_cmp (LOCATION_FILE (lhs->sloc),
+                        LOCATION_FILE (rhs->sloc));
 
   if (LOCATION_LINE (lhs->sloc) != LOCATION_LINE (rhs->sloc))
     return LOCATION_LINE (lhs->sloc) - LOCATION_LINE (rhs->sloc);
index 42e35b607ff883563927c50dcba53ea280905b39..5b31f608754e675de98bebb291d7a71b8725f613 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
+#include "filenames.h"
 
 /* TARGET_64BIT may be defined to use driver specific functionality. */
 #undef TARGET_64BIT
@@ -2314,12 +2315,8 @@ write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
   int frames = (frame_tables.number > 0);
 
   /* Figure out name of output_file, stripping off .so version.  */
-  p = strrchr (output_file, '/');
-  if (p == 0)
-    p = output_file;
-  else
-    p++;
-  q = p;
+  q = p = lbasename (output_file);
+
   while (q)
     {
       q = strchr (q,'.');
@@ -2330,7 +2327,7 @@ write_c_file_stat (FILE *stream, const char *name ATTRIBUTE_UNUSED)
        }
       else
        {
-         if (strncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0)
+         if (filename_ncmp (q, SHLIB_SUFFIX, strlen (SHLIB_SUFFIX)) == 0)
            {
              q += strlen (SHLIB_SUFFIX);
              break;
@@ -3192,10 +3189,10 @@ resolve_lib_name (const char *name)
       for (; list; list = list->next)
        {
          /* The following lines are needed because path_prefix list
-            may contain directories both with trailing '/' and
+            may contain directories both with trailing DIR_SEPARATOR and
             without it.  */
          const char *p = "";
-         if (list->prefix[strlen(list->prefix)-1] != '/')
+         if (!IS_DIR_SEPARATOR (list->prefix[strlen(list->prefix)-1]))
            p = "/";
          for (j = 0; j < 2; j++)
            {
index 5da5464ad5da8e46f633a96f9d52fb5547527e86..79d20ab5cee330c35d2319bc7f5a2673205b0539 100644 (file)
@@ -49,6 +49,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-pass.h"
 #include "diagnostic-core.h"
 #include "intl.h"
+#include "filenames.h"
 
 #include "gcov-io.c"
 
@@ -982,7 +983,7 @@ coverage_init (const char *filename)
   /* + 1 for extra '/', in case prefix doesn't end with /.  */
   int prefix_len;
 
-  if (profile_data_prefix == 0 && filename[0] != '/')
+  if (profile_data_prefix == 0 && !IS_ABSOLUTE_PATH(&filename[0]))
     profile_data_prefix = getpwd ();
 
   prefix_len = (profile_data_prefix) ? strlen (profile_data_prefix) + 1 : 0;
index 7a99acd883f99e9f8c9e3720b8fb48a086694df1..597093e03744dc785c6b2c284cc04d01e2b58816 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * lex.c (interface_strcmp): Handle dos-paths.
+       (handle_pragma_implementation): Use filename_cmp instead of
+       strcmp.
+       (in_main_input_context): Likewise.
+
 2011-03-25  Jason Merrill  <jason@redhat.com>
 
        Core 1135
index 852c3a2867acbcfc53c843f342b7000685d2542f..691a2ec1311b854912abbe4be90d0046cf65588c 100644 (file)
@@ -280,10 +280,10 @@ interface_strcmp (const char* s)
       const char *t1 = ifiles->filename;
       s1 = s;
 
-      if (*s1 != *t1 || *s1 == 0)
+      if (*s1 == 0 || filename_ncmp (s1, t1, 1) != 0)
        continue;
 
-      while (*s1 == *t1 && *s1 != 0)
+      while (*s1 != 0 && filename_ncmp (s1, t1, 1) == 0)
        s1++, t1++;
 
       /* A match.  */
@@ -412,7 +412,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
 
   for (; ifiles; ifiles = ifiles->next)
     {
-      if (! strcmp (ifiles->filename, filename))
+      if (! filename_cmp (ifiles->filename, filename))
        break;
     }
   if (ifiles == 0)
@@ -706,8 +706,8 @@ in_main_input_context (void)
   struct tinst_level *tl = outermost_tinst_level();
 
   if (tl)
-    return strcmp (main_input_filename,
-                  LOCATION_FILE (tl->locus)) == 0;
+    return filename_cmp (main_input_filename,
+                        LOCATION_FILE (tl->locus)) == 0;
   else
-    return strcmp (main_input_filename, input_filename) == 0;
+    return filename_cmp (main_input_filename, input_filename) == 0;
 }
index 34c7c03cab33cc035e526cdf5e676de616c76009..f18a01da5465611b7ccf8c92ff062c363c29c401 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * scanner.c (preprocessor_line): Use filename_cmp
+       instead of strcmp.
+
 2011-03-25  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/48174
index ac26a8042cabc702f3f2e25da0d3cb39396fb4ee..8478b1013df9c30d24eec16b2d05cdd3d44ef40c 100644 (file)
@@ -1754,7 +1754,7 @@ preprocessor_line (gfc_char_t *c)
   if (flag[2]) /* Ending current file.  */
     {
       if (!current_file->up
-         || strcmp (current_file->up->filename, filename) != 0)
+         || filename_cmp (current_file->up->filename, filename) != 0)
        {
          gfc_warning_now ("%s:%d: file %s left but not entered",
                           current_file->filename, current_file->line,
@@ -1774,7 +1774,7 @@ preprocessor_line (gfc_char_t *c)
   /* The name of the file can be a temporary file produced by
      cpp. Replace the name if it is different.  */
 
-  if (strcmp (current_file->filename, filename) != 0)
+  if (filename_cmp (current_file->filename, filename) != 0)
     {
        /* FIXME: we leak the old filename because a pointer to it may be stored
           in the linemap.  Alternative could be using GC or updating linemap to
@@ -1891,7 +1891,7 @@ load_file (const char *realfilename, const char *displayedname, bool initial)
   filename = displayedname ? displayedname : realfilename;
 
   for (f = current_file; f; f = f->up)
-    if (strcmp (filename, f->filename) == 0)
+    if (filename_cmp (filename, f->filename) == 0)
       {
        fprintf (stderr, "%s:%d: Error: File '%s' is being included "
                 "recursively\n", current_file->filename, current_file->line,
index e6ddf41afd2fa0d68021b5f50dd3ecda8cabebc1..c399d14eedb1ebf7ca1e963315d2a68d7ae7ac62 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -44,6 +44,7 @@ compilation is specified by a string called a "spec".  */
 #include "flags.h"
 #include "opts.h"
 #include "vec.h"
+#include "filenames.h"
 
 /* By default there is no special suffix for target executables.  */
 /* FIXME: when autoconf is fixed, remove the host check - dj */
@@ -1949,7 +1950,7 @@ record_temp_file (const char *filename, int always_delete, int fail_delete)
     {
       struct temp_file *temp;
       for (temp = always_delete_queue; temp; temp = temp->next)
-       if (! strcmp (name, temp->name))
+       if (! filename_cmp (name, temp->name))
          goto already1;
 
       temp = XNEW (struct temp_file);
@@ -1964,7 +1965,7 @@ record_temp_file (const char *filename, int always_delete, int fail_delete)
     {
       struct temp_file *temp;
       for (temp = failure_delete_queue; temp; temp = temp->next)
-       if (! strcmp (name, temp->name))
+       if (! filename_cmp (name, temp->name))
          goto already2;
 
       temp = XNEW (struct temp_file);
@@ -3629,9 +3630,9 @@ process_command (unsigned int decoded_options_count,
        {
          temp = gcc_exec_prefix + len - sizeof ("/lib/gcc/") + 1;
          if (IS_DIR_SEPARATOR (*temp)
-             && strncmp (temp + 1, "lib", 3) == 0
+             && filename_ncmp (temp + 1, "lib", 3) == 0
              && IS_DIR_SEPARATOR (temp[4])
-             && strncmp (temp + 5, "gcc", 3) == 0)
+             && filename_ncmp (temp + 5, "gcc", 3) == 0)
            len -= sizeof ("/lib/gcc/") - 1;
        }
 
@@ -4729,7 +4730,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
                    tmp[basename_length + suffix_length] = '\0';
                    temp_filename = tmp;
 
-                   if (strcmp (temp_filename, gcc_input_filename) != 0)
+                   if (filename_cmp (temp_filename, gcc_input_filename) != 0)
                      {
 #ifndef HOST_LACKS_INODE_NUMBERS
                        struct stat st_temp;
@@ -4755,7 +4756,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
                        /* Just compare canonical pathnames.  */
                        char* input_realname = lrealpath (gcc_input_filename);
                        char* temp_realname = lrealpath (temp_filename);
-                       bool files_differ = strcmp (input_realname, temp_realname);
+                       bool files_differ = filename_cmp (input_realname, temp_realname);
                        free (input_realname);
                        free (temp_realname);
                        if (files_differ)
@@ -5934,11 +5935,11 @@ is_directory (const char *path1, bool linker)
   if (linker
       && IS_DIR_SEPARATOR (path[0])
       && ((cp - path == 6
-          && strncmp (path + 1, "lib", 3) == 0)
+          && filename_ncmp (path + 1, "lib", 3) == 0)
          || (cp - path == 10
-             && strncmp (path + 1, "usr", 3) == 0
+             && filename_ncmp (path + 1, "usr", 3) == 0
              && IS_DIR_SEPARATOR (path[4])
-             && strncmp (path + 5, "lib", 3) == 0)))
+             && filename_ncmp (path + 5, "lib", 3) == 0)))
     return 0;
 
   return (stat (path, &st) >= 0 && S_ISDIR (st.st_mode));
@@ -6760,8 +6761,8 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
                    }
 
                  gcc_assert (debug_check_temp_file[1]
-                             && strcmp (debug_check_temp_file[0],
-                                        debug_check_temp_file[1]));
+                             && filename_cmp (debug_check_temp_file[0],
+                                              debug_check_temp_file[1]));
 
                  if (verbose_flag)
                    inform (0, "comparing final insns dumps");
@@ -7665,7 +7666,7 @@ print_multilib_info (void)
          /* If this is a duplicate, skip it.  */
          skip = (last_path != 0
                  && (unsigned int) (p - this_path) == last_path_len
-                 && ! strncmp (last_path, this_path, last_path_len));
+                 && ! filename_ncmp (last_path, this_path, last_path_len));
 
          last_path = this_path;
          last_path_len = p - this_path;
@@ -7869,7 +7870,7 @@ replace_outfile_spec_function (int argc, const char **argv)
 
   for (i = 0; i < n_infiles; i++)
     {
-      if (outfiles[i] && !strcmp (outfiles[i], argv[0]))
+      if (outfiles[i] && !filename_cmp (outfiles[i], argv[0]))
        outfiles[i] = xstrdup (argv[1]);
     }
   return NULL;
@@ -7890,7 +7891,7 @@ remove_outfile_spec_function (int argc, const char **argv)
 
   for (i = 0; i < n_infiles; i++)
     {
-      if (outfiles[i] && !strcmp (outfiles[i], argv[0]))
+      if (outfiles[i] && !filename_cmp (outfiles[i], argv[0]))
         outfiles[i] = NULL;
     }
   return NULL;
index 2fbeaf55e53377da5f9c97b0bcfdbf7db28ff99c..56fff3a75fa087de6c5f6939b51fc370f11fc3b0 100644 (file)
@@ -728,7 +728,7 @@ find_source (const char *file_name)
     file_name = "<unknown>";
 
   for (src = sources; src; src = src->next)
-    if (!strcmp (file_name, src->name))
+    if (!filename_cmp (file_name, src->name))
       break;
 
   if (!src)
@@ -1527,7 +1527,7 @@ make_gcov_file_name (const char *input_name, const char *src_name)
 
   if (flag_preserve_paths)
     {
-      /* Convert '/' and '\' to '#', remove '/./', convert '/../' to '/^/',
+      /* Convert '/' and '\' to '#', remove '/./', convert '/../' to '#^#',
         convert ':' to '~' on DOS based file system.  */
       char *pnew = name, *pold = name;
 
@@ -1535,33 +1535,42 @@ make_gcov_file_name (const char *input_name, const char *src_name)
 
       while (*pold != '\0')
        {
-         if (*pold == '/' || *pold == '\\')
-           {
-             *pnew++ = '#';
-             pold++;
-           }
 #if defined (HAVE_DOS_BASED_FILE_SYSTEM)
-         else if (*pold == ':')
+         if (*pold == ':')
            {
              *pnew++ = '~';
              pold++;
            }
+         else
 #endif
-         else if ((*pold == '/' && strstr (pold, "/./") == pold)
-                  || (*pold == '\\' && strstr (pold, "\\.\\") == pold))
+         if ((*pold == '/'
+                   && (strstr (pold, "/./") == pold
+                       || strstr (pold, "/.\\") == pold))
+                  || (*pold == '\\'
+                      && (strstr (pold, "\\.\\") == pold
+                          || strstr (pold, "\\./") == pold)))
              pold += 3;
-         else if (*pold == '/' && strstr (pold, "/../") == pold)
+         else if (*pold == '/'
+                  && (strstr (pold, "/../") == pold
+                      || strstr (pold, "/..\\") == pold))
            {
-             strcpy (pnew, "/^/");
+             strcpy (pnew, "#^#");
              pnew += 3;
              pold += 4;
            }
-         else if (*pold == '\\' && strstr (pold, "\\..\\") == pold)
+         else if (*pold == '\\'
+                  && (strstr (pold, "\\..\\") == pold
+                      || strstr (pold, "\\../") == pold))
            {
-             strcpy (pnew, "\\^\\");
+             strcpy (pnew, "#^#");
              pnew += 3;
              pold += 4;
            }
+         else if (*pold == '/' || *pold == '\\')
+           {
+             *pnew++ = '#';
+             pold++;
+           }
          else
            *pnew++ = *pold++;
        }
index 7127a2a9e95e8f4d42fae32a2ecd3fdabb66593e..d875683349c49aedb09238a65a1b763b1f954e76 100644 (file)
@@ -28,6 +28,7 @@
 #include "xregex.h"
 #include "obstack.h"
 #include "gengtype.h"
+#include "filenames.h"
 
 /* Data types, macros, etc. used only in this file.  */
 
@@ -429,6 +430,12 @@ read_input_list (const char *listname)
        lang_bitmap bitmap = get_lang_bitmap (gt_files[f]);
        const char *basename = get_file_basename (gt_files[f]);
        const char *slashpos = strchr (basename, '/');
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+       const char *slashpos2 = strchr (basename, '\\');
+
+       if (!slashpos || (slashpos2 && slashpos2 < slashpos))
+         slashpos = slashpos2;
+#endif
 
        if (slashpos)
          {
@@ -1573,10 +1580,7 @@ open_base_files (void)
 static const char *
 get_file_realbasename (const input_file *inpf)
 {
-  const char *f = get_input_file_name (inpf);
-  const char *lastslash = strrchr (f, '/');
-
-  return (lastslash != NULL) ? lastslash + 1 : f;
+  return lbasename (get_input_file_name (inpf));
 }
 
 /* For INPF a filename, return the relative path to INPF from
@@ -2081,7 +2085,7 @@ get_output_file_with_visibility (input_file *inpf)
   /* Look through to see if we've ever seen this output filename
      before.  If found, cache the result in inpf.  */
   for (r = output_files; r; r = r->next)
-    if (strcmp (r->name, output_name) == 0)
+    if (filename_cmp (r->name, output_name) == 0)
       {
        inpf->inpoutf = r;
        DBGPRINTF ("found r @ %p for output_name %s for_name %s", (void*)r,
@@ -4831,7 +4835,7 @@ htab_eq_inputfile (const void *x, const void *y)
   const input_file *inpfx = (const input_file *) x;
   const input_file *inpfy = (const input_file *) y;
   gcc_assert (inpfx != NULL && inpfy != NULL);
-  return !strcmp (get_input_file_name (inpfx), get_input_file_name (inpfy));
+  return !filename_cmp (get_input_file_name (inpfx), get_input_file_name (inpfy));
 }
 
 
index baf904fb32606f9cad2d7f80d0a702b8ac2d76da..7d95ce218b5cbfa5b9160ddcfafa273d53fc7ff6 100644 (file)
@@ -45,7 +45,7 @@
 #define DIRS_EQ(A, B) ((A)->dev == (B)->dev \
        && INO_T_EQ((A)->ino, (B)->ino))
 #else
-#define DIRS_EQ(A, B) (!strcmp ((A)->canonical_name, (B)->canonical_name))
+#define DIRS_EQ(A, B) (!filename_cmp ((A)->canonical_name, (B)->canonical_name))
 #endif
 
 static const char dir_separator_str[] = { DIR_SEPARATOR, 0 };
@@ -147,7 +147,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
                 now.  */
              if (sysroot && p->add_sysroot)
                continue;
-             if (!strncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
+             if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
                {
                  char *str = concat (iprefix, p->fname + len, NULL);
                  if (p->multilib && imultilib)
@@ -168,7 +168,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
          if (sysroot && p->add_sysroot)
            str = concat (sysroot, p->fname, NULL);
          else if (!p->add_sysroot && relocated
-                  && strncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len) == 0)
+                  && !filename_ncmp (p->fname, cpp_PREFIX, cpp_PREFIX_len))
            {
              static const char *relocated_prefix;
              /* If this path starts with the configure-time prefix,
index e384294bf4630e032fa2c6e69791704cc3b24ada..61b24187337fbc5d91e17e742c887083e3240caf 100644 (file)
@@ -1,3 +1,10 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * jcf-parse.c (java_read_sourcefilenames): Use filename_cmp
+       instead of strcmp.
+       (set_source_filename): Likewise.
+       * win32-host.c (jcf_open_exact_case): Likewise.
+
 2011-03-21  Kai Tietz  <ktietz@redhat.com>
 
        PR target/12171
index d10791fe631d942095bf23208d53878fe6d33d6d..ac0f0d3be520620974c5d833e411cfd259dedf0d 100644 (file)
@@ -176,9 +176,9 @@ java_read_sourcefilenames (const char *fsource_filename)
   if (fsource_filename 
       && filenames == 0
       && strlen (fsource_filename) > strlen (".java")
-      && strcmp ((fsource_filename 
-                 + strlen (fsource_filename)
-                 - strlen (".java")),
+      && filename_cmp ((fsource_filename
+                      + strlen (fsource_filename)
+                      - strlen (".java")),
                 ".java") != 0)
     {
 /*       fsource_filename isn't a .java file but a list of filenames
@@ -322,7 +322,7 @@ set_source_filename (JCF *jcf, int index)
       /* Use the current input_filename (derived from the class name)
         if it has a directory prefix, but otherwise matches sfname. */
       if (old_len > new_len
-         && strcmp (sfname, old_filename + old_len - new_len) == 0
+         && filename_cmp (sfname, old_filename + old_len - new_len) == 0
          && (old_filename[old_len - new_len - 1] == '/'
              || old_filename[old_len - new_len - 1] == '\\'))
        return;
index 0e9613b427c4d5658dc75d61cebf05ae009091d5..1d6b8fadc15617e89dac5d30fa39b82a39257df5 100644 (file)
@@ -72,7 +72,7 @@ jcf_open_exact_case (const char *filename, int oflag)
      all directory components would be tedious and time-consuming
      and it's a pretty safe assumption that mixed-case package
      names are a fringe case.... */
-  if (strcmp (filename + filename_len - found_file_len, fd.cFileName))
+  if (filename_cmp (filename + filename_len - found_file_len, fd.cFileName))
     {
       /* Reject this because it is not a perfect-case match. */
       /* printf("************\nRejected:\n%s\n%s\n************\n\n", filename, fd.cFileName); */
index 1921eaf8b778b350afb6d5b42536e387958c01a5..c07fa06174312d40cff52caebdc0eb2d4d91c126 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-25  Kai Tietz  <ktietz@redhat.com>
+
+       * lto.c (lto_resolution_read): Use filename_cmp instead
+       of strcmp.
+       (lto_read_section_data): Likewise.
+
 2011-03-25  Jeff Law  <law@redhat.com>
 
        * lto/lto-lang.c (def_fn_type): Add missing va_end.
index 71c8cdb96588ab20ecd3a26d200f939518776dfd..099243bfda438b9c1565bcfb8e9afdb3d20dad5e 100644 (file)
@@ -345,7 +345,7 @@ lto_resolution_read (splay_tree file_ids, FILE *resolution, lto_file *file)
 
   fread (obj_name, sizeof (char), name_len, resolution);
   obj_name[name_len] = '\0';
-  if (strcmp (obj_name, file->filename) != 0)
+  if (filename_cmp (obj_name, file->filename) != 0)
     internal_error ("unexpected file name %s in linker resolution file. "
                    "Expected %s", obj_name, file->filename);
   if (file->offset != 0)
@@ -582,7 +582,7 @@ lto_read_section_data (struct lto_file_decl_data *file_data,
      or rather fix function body streaming to not stream them in
      practically random order.  */
   if (fd != -1
-      && strcmp (fd_name, file_data->file_name) != 0)
+      && filename_cmp (fd_name, file_data->file_name) != 0)
     {
       free (fd_name);
       close (fd);
index 28be8d1d783aeca0310301ec53e554fe3a7907cf..331ddbaa6dc8074a656fa5f2c05877361d0e3921 100644 (file)
@@ -606,6 +606,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "version.h"
 #include "intl.h"
+#include "filenames.h"
 
 #ifndef __SABER__
 #define saber_stop()
@@ -4693,12 +4694,11 @@ int
 main (int argc, char **argv)
 {
   int iflag = 0;
-  char *p = strrchr (argv[0], '/');
   char *num_end;
   int option;
   int i;
 
-  progname = (p != 0) ? p+1 : argv[0];
+  progname = lbasename (argv[0]);
 
   (void) signal (SIGSEGV, catch_signal);
   (void) signal (SIGBUS,  catch_signal);
index c72203c22219082a5ee993143f73ac42e66cf1aa..67ebdd99ed6a0dd633e7426cfccb06db6465fd71 100644 (file)
@@ -251,7 +251,7 @@ update_path (const char *path, const char *key)
   char *result, *p;
   const int len = strlen (std_prefix);
 
-  if (! strncmp (path, std_prefix, len)
+  if (! filename_ncmp (path, std_prefix, len)
       && (IS_DIR_SEPARATOR(path[len])
           || path[len] == '\0')
       && key != 0)
index 2334101ba8c030b177eba5e9d8bbe055ff8db0fd..c5cada9e6043082b6d4df6ff5290f086c5297ddd 100644 (file)
@@ -853,7 +853,7 @@ output_location (char const *file_name, int line,
       return;
     }
 
-  name_differs = !prev_file_name || strcmp (file_name, prev_file_name);
+  name_differs = !prev_file_name || filename_cmp (file_name, prev_file_name);
   line_differs = prev_line != line;
 
   if (name_differs || line_differs)
index 9c622912b3a6fe265d0fd1146c8bc51b3a169517..4f1933f447a189a7d48ad9d12ce760546b8655a7 100644 (file)
@@ -985,14 +985,14 @@ handle_file (directive_handler_t handle_directive)
 static void
 handle_toplevel_file (directive_handler_t handle_directive)
 {
-  char *lastsl;
+  const char *base;
 
   in_fname = read_md_filename;
-  lastsl = strrchr (in_fname, '/');
-  if (lastsl != NULL)
-    base_dir = xstrndup (in_fname, lastsl - in_fname + 1);
-  else
+  base = lbasename (in_fname);
+  if (base == in_fname)
     base_dir = NULL;
+  else
+    base_dir = xstrndup (in_fname, base - in_fname);
 
   handle_file (handle_directive);
 }
index 44618ed40df2081e77939dca75d081cef43aa401..883aa0f0281aaada2504d172eb09b17875a8d891 100644 (file)
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "hashtab.h"
 #include "demangle.h"
 #include "collect2.h"
+#include "filenames.h"
 
 /* TARGET_64BIT may be defined to use driver specific functionality. */
 #undef TARGET_64BIT
@@ -293,10 +294,9 @@ tlink_execute (const char *prog, char **argv, const char *outname,
 static char *
 frob_extension (const char *s, const char *ext)
 {
-  const char *p = strrchr (s, '/');
-  if (! p)
-    p = s;
-  p = strrchr (p, '.');
+  const char *p;
+
+  p = strrchr (lbasename (s), '.');
   if (! p)
     p = s + strlen (s);
 
index c218825454c4ccc77d7f462d579b042d599cabed..01893ba393e9dad0bab3ca2419c7464c5163fe0f 100644 (file)
@@ -757,7 +757,7 @@ same_line_p (location_t locus1, location_t locus2)
     return true;
   return (from.file != NULL
           && to.file != NULL
-          && strcmp (from.file, to.file) == 0);
+          && filename_cmp (from.file, to.file) == 0);
 }
 
 /* Assign a unique discriminator value to block BB if it begins at the same
index e5fce0e1622f1009e9a34ca854c997b1abdbfb8d..039aca16cc8ec7962f18f44eb4bcad1e936daf23 100644 (file)
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "tree.h"
 #include "splay-tree.h"
+#include "filenames.h"
 #include "diagnostic-core.h"
 #include "toplev.h"
 #include "tree-dump.h"
@@ -359,12 +360,7 @@ dequeue_and_dump (dump_info_p di)
       xloc = expand_location (DECL_SOURCE_LOCATION (t));
       if (xloc.file)
        {
-         const char *filename = strrchr (xloc.file, '/');
-         if (!filename)
-           filename = xloc.file;
-         else
-           /* Skip the slash.  */
-           ++filename;
+         const char *filename = lbasename (xloc.file);
 
          dump_maybe_newline (di);
          fprintf (di->stream, "srcp: %s:%-6d ", filename,
index ef6a812ddf01db7ef808d21eb431e384c4da18ac..69d5ecbb700c58a0d6a96dd9098562ef20d1fd3f 100644 (file)
@@ -41,6 +41,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "toplev.h"
 #include "ggc.h"
 #include "hashtab.h"
+#include "filenames.h"
 #include "output.h"
 #include "target.h"
 #include "langhooks.h"
@@ -8612,12 +8613,7 @@ get_file_function_name (const char *type)
        file = input_filename;
       /* Just use the file's basename, because the full pathname
         might be quite long.  */
-      p = strrchr (file, '/');
-      if (p)
-       p++;
-      else
-       p = file;
-      p = q = ASTRDUP (p);
+      p = q = ASTRDUP (lbasename (file));
     }
   else
     {