mirror of git://gcc.gnu.org/git/gcc.git
* collect2.c (main, write_c_file_stat), gcc.c (translate_options,
process_command, main), gcov.c (open_files, output_data), tlink.c (frob_extension, scan_linker_output), toplev.c (file_name_nondirectory): Use strchr () and strrchr () instead of index () and rindex (). cp: * dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c (build_overload_value), repo.c (open_repo_file), xref.c (open_xref_file): Use strchr () and strrchr () instead of index () and rindex (). f: * com.c (open_include_file, ffecom_open_include_): Use strchr () and strrchr () instead of index () and rindex (). From-SVN: r37206
This commit is contained in:
parent
0304bbad37
commit
9473c5226b
|
|
@ -1,3 +1,11 @@
|
|||
2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* collect2.c (main, write_c_file_stat), gcc.c (translate_options,
|
||||
process_command, main), gcov.c (open_files, output_data), tlink.c
|
||||
(frob_extension, scan_linker_output), toplev.c
|
||||
(file_name_nondirectory): Use strchr () and strrchr () instead of
|
||||
index () and rindex ().
|
||||
|
||||
2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* c-common.c (get_flag_spec, check_format_info_main,
|
||||
|
|
|
|||
|
|
@ -1172,7 +1172,7 @@ main (argc, argv)
|
|||
output_file = *ld1++ = *ld2++ = *++argv;
|
||||
else if (1
|
||||
#ifdef SWITCHES_NEED_SPACES
|
||||
&& ! index (SWITCHES_NEED_SPACES, arg[1])
|
||||
&& ! strchr (SWITCHES_NEED_SPACES, arg[1])
|
||||
#endif
|
||||
)
|
||||
|
||||
|
|
@ -1201,7 +1201,7 @@ main (argc, argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if ((p = rindex (arg, '.')) != (char *) 0
|
||||
else if ((p = strrchr (arg, '.')) != (char *) 0
|
||||
&& (strcmp (p, ".o") == 0 || strcmp (p, ".a") == 0
|
||||
|| strcmp (p, ".so") == 0 || strcmp (p, ".lo") == 0))
|
||||
{
|
||||
|
|
@ -1829,7 +1829,7 @@ write_c_file_stat (stream, name)
|
|||
int frames = (frame_tables.number > 0);
|
||||
|
||||
/* Figure out name of output_file, stripping off .so version. */
|
||||
p = rindex (output_file, '/');
|
||||
p = strrchr (output_file, '/');
|
||||
if (p == 0)
|
||||
p = output_file;
|
||||
else
|
||||
|
|
@ -1837,7 +1837,7 @@ write_c_file_stat (stream, name)
|
|||
q = p;
|
||||
while (q)
|
||||
{
|
||||
q = index (q,'.');
|
||||
q = strchr (q,'.');
|
||||
if (q == 0)
|
||||
{
|
||||
q = p + strlen (p);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* dump.c (dequeue_and_dump), lex.c (interface_strcmp), method.c
|
||||
(build_overload_value), repo.c (open_repo_file), xref.c
|
||||
(open_xref_file): Use strchr () and strrchr () instead of index ()
|
||||
and rindex ().
|
||||
|
||||
2000-11-01 Bernd Schmidt <bernds@redhat.co.uk>
|
||||
|
||||
* call.c (build_over_call): Call fold on the CALL_EXPR.
|
||||
|
|
|
|||
|
|
@ -378,7 +378,7 @@ dequeue_and_dump (di)
|
|||
/* And a source position. */
|
||||
if (DECL_SOURCE_FILE (t))
|
||||
{
|
||||
const char *filename = rindex (DECL_SOURCE_FILE (t), '/');
|
||||
const char *filename = strrchr (DECL_SOURCE_FILE (t), '/');
|
||||
if (!filename)
|
||||
filename = DECL_SOURCE_FILE (t);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1022,7 +1022,7 @@ interface_strcmp (s)
|
|||
return 0;
|
||||
|
||||
/* Don't get faked out by xxx.yyy.cc vs xxx.zzz.cc. */
|
||||
if (index (s1, '.') || index (t1, '.'))
|
||||
if (strchr (s1, '.') || strchr (t1, '.'))
|
||||
continue;
|
||||
|
||||
if (*s1 == '\0' || s1[-1] != '.' || t1[-1] != '.')
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ build_overload_value (type, value, flags)
|
|||
else
|
||||
{
|
||||
REAL_VALUE_TO_DECIMAL (val, "%.20e", bufp);
|
||||
bufp = (char *) index (bufp, 'e');
|
||||
bufp = (char *) strchr (bufp, 'e');
|
||||
if (!bufp)
|
||||
strcat (digit_buffer, "e0");
|
||||
else
|
||||
|
|
@ -799,7 +799,7 @@ build_overload_value (type, value, flags)
|
|||
}
|
||||
}
|
||||
#ifdef NO_DOT_IN_LABEL
|
||||
bufp = (char *) index (bufp, '.');
|
||||
bufp = (char *) strchr (bufp, '.');
|
||||
if (bufp)
|
||||
*bufp = '_';
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ open_repo_file (filename)
|
|||
return;
|
||||
|
||||
p = file_name_nondirectory (s);
|
||||
p = rindex (p, '.');
|
||||
p = strrchr (p, '.');
|
||||
if (! p)
|
||||
p = s + strlen (s);
|
||||
|
||||
|
|
|
|||
|
|
@ -811,14 +811,14 @@ open_xref_file(file)
|
|||
#ifdef XREF_FILE_NAME
|
||||
XREF_FILE_NAME (xref_name, file);
|
||||
#else
|
||||
s = rindex (file, '/');
|
||||
s = strrchr (file, '/');
|
||||
if (s == NULL)
|
||||
sprintf (xref_name, ".%s.gxref", file);
|
||||
else
|
||||
{
|
||||
++s;
|
||||
strcpy (xref_name, file);
|
||||
t = rindex (xref_name, '/');
|
||||
t = strrchr (xref_name, '/');
|
||||
++t;
|
||||
*t++ = '.';
|
||||
strcpy (t, s);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,8 @@
|
|||
2000-11-02 Joseph S. Myers <jsm28@cam.ac.uk>
|
||||
|
||||
* com.c (open_include_file, ffecom_open_include_): Use strchr ()
|
||||
and strrchr () instead of index () and rindex ().
|
||||
|
||||
2000-10-27 Zack Weinberg <zack@wolery.stanford.edu>
|
||||
|
||||
* Make-lang.in: Move all build rules here from Makefile.in,
|
||||
|
|
|
|||
20
gcc/f/com.c
20
gcc/f/com.c
|
|
@ -15794,11 +15794,11 @@ open_include_file (filename, searchptr)
|
|||
looking in. Thus #include <sys/types.h> will look up sys/types.h
|
||||
in /usr/include/header.gcc and look up types.h in
|
||||
/usr/include/sys/header.gcc. */
|
||||
p = rindex (filename, '/');
|
||||
p = strrchr (filename, '/');
|
||||
#ifdef DIR_SEPARATOR
|
||||
if (! p) p = rindex (filename, DIR_SEPARATOR);
|
||||
if (! p) p = strrchr (filename, DIR_SEPARATOR);
|
||||
else {
|
||||
char *tmp = rindex (filename, DIR_SEPARATOR);
|
||||
char *tmp = strrchr (filename, DIR_SEPARATOR);
|
||||
if (tmp != NULL && tmp > p) p = tmp;
|
||||
}
|
||||
#endif
|
||||
|
|
@ -16139,18 +16139,18 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c)
|
|||
dsp[0].next = search_start;
|
||||
search_start = dsp;
|
||||
#ifndef VMS
|
||||
ep = rindex (nam, '/');
|
||||
ep = strrchr (nam, '/');
|
||||
#ifdef DIR_SEPARATOR
|
||||
if (ep == NULL) ep = rindex (nam, DIR_SEPARATOR);
|
||||
if (ep == NULL) ep = strrchr (nam, DIR_SEPARATOR);
|
||||
else {
|
||||
char *tmp = rindex (nam, DIR_SEPARATOR);
|
||||
char *tmp = strrchr (nam, DIR_SEPARATOR);
|
||||
if (tmp != NULL && tmp > ep) ep = tmp;
|
||||
}
|
||||
#endif
|
||||
#else /* VMS */
|
||||
ep = rindex (nam, ']');
|
||||
if (ep == NULL) ep = rindex (nam, '>');
|
||||
if (ep == NULL) ep = rindex (nam, ':');
|
||||
ep = strrchr (nam, ']');
|
||||
if (ep == NULL) ep = strrchr (nam, '>');
|
||||
if (ep == NULL) ep = strrchr (nam, ':');
|
||||
if (ep != NULL) ep++;
|
||||
#endif /* VMS */
|
||||
if (ep != NULL)
|
||||
|
|
@ -16229,7 +16229,7 @@ ffecom_open_include_ (char *name, ffewhereLine l, ffewhereColumn c)
|
|||
fname[flen] = 0;
|
||||
#if 0 /* Not for g77. */
|
||||
/* if it's '#include filename', add the missing .h */
|
||||
if (index (fname, '.') == NULL)
|
||||
if (strchr (fname, '.') == NULL)
|
||||
strcat (fname, ".h");
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
18
gcc/gcc.c
18
gcc/gcc.c
|
|
@ -946,7 +946,7 @@ translate_options (argcp, argvp)
|
|||
|
||||
/* If this mapping requires extra text at end of name,
|
||||
accept that as "argument". */
|
||||
else if (index (arginfo, '*') != 0)
|
||||
else if (strchr (arginfo, '*') != 0)
|
||||
arg = argv[i] + optlen;
|
||||
|
||||
/* Otherwise, extra text at end means mismatch.
|
||||
|
|
@ -955,14 +955,14 @@ translate_options (argcp, argvp)
|
|||
continue;
|
||||
}
|
||||
|
||||
else if (index (arginfo, '*') != 0)
|
||||
else if (strchr (arginfo, '*') != 0)
|
||||
{
|
||||
error ("Incomplete `%s' option", option_map[j].name);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Handle arguments. */
|
||||
if (index (arginfo, 'a') != 0)
|
||||
if (strchr (arginfo, 'a') != 0)
|
||||
{
|
||||
if (arg == 0)
|
||||
{
|
||||
|
|
@ -976,9 +976,9 @@ translate_options (argcp, argvp)
|
|||
arg = argv[++i];
|
||||
}
|
||||
}
|
||||
else if (index (arginfo, '*') != 0)
|
||||
else if (strchr (arginfo, '*') != 0)
|
||||
;
|
||||
else if (index (arginfo, 'o') == 0)
|
||||
else if (strchr (arginfo, 'o') == 0)
|
||||
{
|
||||
if (arg != 0)
|
||||
error ("Extraneous argument to `%s' option",
|
||||
|
|
@ -987,7 +987,7 @@ translate_options (argcp, argvp)
|
|||
}
|
||||
|
||||
/* Store the translation as one argv elt or as two. */
|
||||
if (arg != 0 && index (arginfo, 'j') != 0)
|
||||
if (arg != 0 && strchr (arginfo, 'j') != 0)
|
||||
newv[newindex++] = concat (option_map[j].equivalent, arg,
|
||||
NULL_PTR);
|
||||
else if (arg != 0)
|
||||
|
|
@ -3646,7 +3646,7 @@ process_command (argc, argv)
|
|||
/* Null-terminate the vector. */
|
||||
switches[n_switches].args[j] = 0;
|
||||
}
|
||||
else if (index (switches_need_spaces, c))
|
||||
else if (strchr (switches_need_spaces, c))
|
||||
{
|
||||
/* On some systems, ld cannot handle some options without
|
||||
a space. So split the option from its argument. */
|
||||
|
|
@ -5288,7 +5288,7 @@ main (argc, argv)
|
|||
first_time = FALSE;
|
||||
obstack_grow (&collect_obstack, "'-", 2);
|
||||
q = switches[i].part1;
|
||||
while ((p = index (q, '\'')))
|
||||
while ((p = strchr (q, '\'')))
|
||||
{
|
||||
obstack_grow (&collect_obstack, q, p - q);
|
||||
obstack_grow (&collect_obstack, "'\\''", 4);
|
||||
|
|
@ -5301,7 +5301,7 @@ main (argc, argv)
|
|||
{
|
||||
obstack_grow (&collect_obstack, " '", 2);
|
||||
q = *args;
|
||||
while ((p = index (q, '\'')))
|
||||
while ((p = strchr (q, '\'')))
|
||||
{
|
||||
obstack_grow (&collect_obstack, q, p - q);
|
||||
obstack_grow (&collect_obstack, "'\\''", 4);
|
||||
|
|
|
|||
16
gcc/gcov.c
16
gcc/gcov.c
|
|
@ -376,7 +376,7 @@ open_files ()
|
|||
strcat (bbg_file_name, "/");
|
||||
}
|
||||
|
||||
cptr = rindex (input_file_name, '/');
|
||||
cptr = strrchr (input_file_name, '/');
|
||||
if (cptr)
|
||||
{
|
||||
strcat (da_file_name, cptr + 1);
|
||||
|
|
@ -397,19 +397,19 @@ open_files ()
|
|||
strcpy (bbg_file_name, input_file_name);
|
||||
}
|
||||
|
||||
cptr = rindex (bb_file_name, '.');
|
||||
cptr = strrchr (bb_file_name, '.');
|
||||
if (cptr)
|
||||
strcpy (cptr, ".bb");
|
||||
else
|
||||
strcat (bb_file_name, ".bb");
|
||||
|
||||
cptr = rindex (da_file_name, '.');
|
||||
cptr = strrchr (da_file_name, '.');
|
||||
if (cptr)
|
||||
strcpy (cptr, ".da");
|
||||
else
|
||||
strcat (da_file_name, ".da");
|
||||
|
||||
cptr = rindex (bbg_file_name, '.');
|
||||
cptr = strrchr (bbg_file_name, '.');
|
||||
if (cptr)
|
||||
strcpy (cptr, ".bbg");
|
||||
else
|
||||
|
|
@ -1249,7 +1249,7 @@ output_data ()
|
|||
}
|
||||
|
||||
count = strlen (source_file_name);
|
||||
cptr = rindex (s_ptr->name, '/');
|
||||
cptr = strrchr (s_ptr->name, '/');
|
||||
if (cptr)
|
||||
cptr = cptr + 1;
|
||||
else
|
||||
|
|
@ -1258,7 +1258,7 @@ output_data ()
|
|||
{
|
||||
gcov_file_name = xmalloc (count + 7 + strlen (input_file_name));
|
||||
|
||||
cptr = rindex (input_file_name, '/');
|
||||
cptr = strrchr (input_file_name, '/');
|
||||
if (cptr)
|
||||
strcpy (gcov_file_name, cptr + 1);
|
||||
else
|
||||
|
|
@ -1266,7 +1266,7 @@ output_data ()
|
|||
|
||||
strcat (gcov_file_name, ".");
|
||||
|
||||
cptr = rindex (source_file_name, '/');
|
||||
cptr = strrchr (source_file_name, '/');
|
||||
if (cptr)
|
||||
strcat (gcov_file_name, cptr + 1);
|
||||
else
|
||||
|
|
@ -1275,7 +1275,7 @@ output_data ()
|
|||
else
|
||||
{
|
||||
gcov_file_name = xmalloc (count + 6);
|
||||
cptr = rindex (source_file_name, '/');
|
||||
cptr = strrchr (source_file_name, '/');
|
||||
if (cptr)
|
||||
strcpy (gcov_file_name, cptr + 1);
|
||||
else
|
||||
|
|
|
|||
12
gcc/tlink.c
12
gcc/tlink.c
|
|
@ -327,10 +327,10 @@ frob_extension (s, ext)
|
|||
const char *s;
|
||||
const char *ext;
|
||||
{
|
||||
const char *p = rindex (s, '/');
|
||||
const char *p = strrchr (s, '/');
|
||||
if (! p)
|
||||
p = s;
|
||||
p = rindex (p, '.');
|
||||
p = strrchr (p, '.');
|
||||
if (! p)
|
||||
p = s + strlen (s);
|
||||
|
||||
|
|
@ -652,12 +652,12 @@ scan_linker_output (fname)
|
|||
q = 0;
|
||||
|
||||
/* First try `GNU style'. */
|
||||
p = index (oldq, '`');
|
||||
p = strchr (oldq, '`');
|
||||
if (p)
|
||||
p++, q = index (p, '\'');
|
||||
p++, q = strchr (p, '\'');
|
||||
/* Then try "double quotes". */
|
||||
else if (p = index (oldq, '"'), p)
|
||||
p++, q = index (p, '"');
|
||||
else if (p = strchr (oldq, '"'), p)
|
||||
p++, q = strchr (p, '"');
|
||||
|
||||
/* Don't let the strstr's below see the demangled name; we
|
||||
might get spurious matches. */
|
||||
|
|
|
|||
|
|
@ -1717,9 +1717,9 @@ char *
|
|||
file_name_nondirectory (x)
|
||||
const char *x;
|
||||
{
|
||||
char *tmp = (char *) rindex (x, '/');
|
||||
char *tmp = (char *) strrchr (x, '/');
|
||||
if (DIR_SEPARATOR != '/' && ! tmp)
|
||||
tmp = (char *) rindex (x, DIR_SEPARATOR);
|
||||
tmp = (char *) strrchr (x, DIR_SEPARATOR);
|
||||
if (tmp)
|
||||
return (char *) (tmp + 1);
|
||||
else
|
||||
|
|
|
|||
Loading…
Reference in New Issue