Commit b633b6c0 by Mumit Khan Committed by Jeff Law

gcc.c (load_specs): New static function.

        * gcc.c (load_specs): New static function.
        (read_specs): Use it.

From-SVN: r33395
parent 03bf1c28
Mon Apr 24 17:34:18 2000 Mumit Khan <khan@xraylith.wisc.edu>
* gcc.c (load_specs): New static function.
(read_specs): Use it.
* gcc.c (lookup_compiler): Make multiple passes for case
insensitive filesystems.
......
......@@ -1451,27 +1451,21 @@ store_arg (arg, delete_always, delete_failure)
record_temp_file (arg, delete_always, delete_failure);
}
/* Read compilation specs from a file named FILENAME,
replacing the default ones.
/* Load specs from a file name named FILENAME, replacing occurances of
various different types of line-endings, \r\n, \n\r and just \r, with
a single \n. */
A suffix which starts with `*' is a definition for
one of the machine-specific sub-specs. The "suffix" should be
*asm, *cc1, *cpp, *link, *startfile, *signed_char, etc.
The corresponding spec is stored in asm_spec, etc.,
rather than in the `compilers' vector.
Anything invalid in the file is a fatal error. */
static void
read_specs (filename, main_p)
static char*
load_specs (filename)
const char *filename;
int main_p;
{
int desc;
int readlen;
struct stat statbuf;
char *buffer;
register char *p;
char *buffer_p;
char *specs;
char *specs_p;
if (verbose_flag)
notice ("Reading specs from %s\n", filename);
......@@ -1491,6 +1485,51 @@ read_specs (filename, main_p)
buffer[readlen] = 0;
close (desc);
specs = xmalloc (readlen + 1);
specs_p = specs;
for (buffer_p = buffer; buffer_p && *buffer_p; buffer_p++)
{
int skip = 0;
char c = *buffer_p;
if (c == '\r')
{
if (buffer_p > buffer && *(buffer_p-1) == '\n') /* \n\r */
skip = 1;
else if (*(buffer_p+1) == '\n') /* \r\n */
skip = 1;
else /* \r */
c = '\n';
}
if (! skip)
*specs_p++ = c;
}
*specs_p = '\0';
free (buffer);
return (specs);
}
/* Read compilation specs from a file named FILENAME,
replacing the default ones.
A suffix which starts with `*' is a definition for
one of the machine-specific sub-specs. The "suffix" should be
*asm, *cc1, *cpp, *link, *startfile, *signed_char, etc.
The corresponding spec is stored in asm_spec, etc.,
rather than in the `compilers' vector.
Anything invalid in the file is a fatal error. */
static void
read_specs (filename, main_p)
const char *filename;
int main_p;
{
char *buffer;
register char *p;
buffer = load_specs (filename);
/* Scan BUFFER for specs, putting them in the vector. */
p = buffer;
while (1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment