diff options
-rw-r--r-- | gcc/ChangeLog | 36 | ||||
-rw-r--r-- | gcc/c-family/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c-family/c-ada-spec.c | 3 | ||||
-rw-r--r-- | gcc/collect2.c | 15 | ||||
-rw-r--r-- | gcc/coverage.c | 3 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/lex.c | 12 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/scanner.c | 6 | ||||
-rw-r--r-- | gcc/gcc.c | 29 | ||||
-rw-r--r-- | gcc/gcov.c | 37 | ||||
-rw-r--r-- | gcc/gengtype.c | 16 | ||||
-rw-r--r-- | gcc/incpath.c | 6 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/jcf-parse.c | 8 | ||||
-rw-r--r-- | gcc/java/win32-host.c | 2 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto/lto.c | 4 | ||||
-rw-r--r-- | gcc/mips-tfile.c | 4 | ||||
-rw-r--r-- | gcc/prefix.c | 2 | ||||
-rw-r--r-- | gcc/profile.c | 2 | ||||
-rw-r--r-- | gcc/read-md.c | 10 | ||||
-rw-r--r-- | gcc/tlink.c | 8 | ||||
-rw-r--r-- | gcc/tree-cfg.c | 2 | ||||
-rw-r--r-- | gcc/tree-dump.c | 8 | ||||
-rw-r--r-- | gcc/tree.c | 8 |
26 files changed, 161 insertions, 90 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64c4b5a0cbc..e7983a2fe44 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index e8a14fe27f5..a1cd34663cb 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -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. diff --git a/gcc/c-family/c-ada-spec.c b/gcc/c-family/c-ada-spec.c index 8b9e93a2097..edfc43b23fc 100644 --- a/gcc/c-family/c-ada-spec.c +++ b/gcc/c-family/c-ada-spec.c @@ -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); diff --git a/gcc/collect2.c b/gcc/collect2.c index 42e35b607ff..5b31f608754 100644 --- a/gcc/collect2.c +++ b/gcc/collect2.c @@ -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++) { diff --git a/gcc/coverage.c b/gcc/coverage.c index 5da5464ad5d..79d20ab5cee 100644 --- a/gcc/coverage.c +++ b/gcc/coverage.c @@ -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; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7a99acd883f..597093e0374 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 852c3a2867a..691a2ec1311 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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; } diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 34c7c03cab3..f18a01da546 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index ac26a8042ca..8478b1013df 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -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, diff --git a/gcc/gcc.c b/gcc/gcc.c index e6ddf41afd2..c399d14eedb 100644 --- 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; diff --git a/gcc/gcov.c b/gcc/gcov.c index 2fbeaf55e53..56fff3a75fa 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -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++; } diff --git a/gcc/gengtype.c b/gcc/gengtype.c index 7127a2a9e95..d875683349c 100644 --- a/gcc/gengtype.c +++ b/gcc/gengtype.c @@ -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)); } diff --git a/gcc/incpath.c b/gcc/incpath.c index baf904fb326..7d95ce218b5 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -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, diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index e384294bf46..61b24187337 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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 diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index d10791fe631..ac0f0d3be52 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -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; diff --git a/gcc/java/win32-host.c b/gcc/java/win32-host.c index 0e9613b427c..1d6b8fadc15 100644 --- a/gcc/java/win32-host.c +++ b/gcc/java/win32-host.c @@ -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); */ diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 1921eaf8b77..c07fa061743 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -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. diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 71c8cdb9658..099243bfda4 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -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); diff --git a/gcc/mips-tfile.c b/gcc/mips-tfile.c index 28be8d1d783..331ddbaa6dc 100644 --- a/gcc/mips-tfile.c +++ b/gcc/mips-tfile.c @@ -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); diff --git a/gcc/prefix.c b/gcc/prefix.c index c72203c2221..67ebdd99ed6 100644 --- a/gcc/prefix.c +++ b/gcc/prefix.c @@ -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) diff --git a/gcc/profile.c b/gcc/profile.c index 2334101ba8c..c5cada9e604 100644 --- a/gcc/profile.c +++ b/gcc/profile.c @@ -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) diff --git a/gcc/read-md.c b/gcc/read-md.c index 9c622912b3a..4f1933f447a 100644 --- a/gcc/read-md.c +++ b/gcc/read-md.c @@ -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); } diff --git a/gcc/tlink.c b/gcc/tlink.c index 44618ed40df..883aa0f0281 100644 --- a/gcc/tlink.c +++ b/gcc/tlink.c @@ -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); diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index c218825454c..01893ba393e 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -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 diff --git a/gcc/tree-dump.c b/gcc/tree-dump.c index e5fce0e1622..039aca16cc8 100644 --- a/gcc/tree-dump.c +++ b/gcc/tree-dump.c @@ -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, diff --git a/gcc/tree.c b/gcc/tree.c index ef6a812ddf0..69d5ecbb700 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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 { |