Changelog c-family/

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.

From-SVN: r171522
This commit is contained in:
Kai Tietz 2011-03-25 20:20:52 +01:00 committed by Kai Tietz
parent 4489800d00
commit ba78087b6c
26 changed files with 161 additions and 90 deletions

View 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

View 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.

View 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);

View 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++)
{

View 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;

View 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

View 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;
}

View 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

View 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,

View File

@ -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;

View 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++;
}

View 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));
}

View 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,

View 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

View 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;

View 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); */

View 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.

View 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);

View 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);

View 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)

View 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)

View 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);
}

View 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);

View 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

View 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,

View 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
{