/* Compiler driver program that can handle many languages.
- Copyright (C) 1987, 89, 92-96, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1987, 89, 92-97, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
\f
#include "config.h"
-#include <sys/types.h>
-#include <ctype.h>
-#include <signal.h>
-#include <sys/stat.h>
-#include <errno.h>
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h> /* May get R_OK, etc. on some systems. */
-#endif
-
-#include "obstack.h"
#include "gansidecl.h"
+#include "system.h"
+#include <signal.h>
+#include <sys/stat.h>
#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
#endif
-#include <stdio.h>
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
+#include "obstack.h"
+
/* ??? Need to find a GCC header to put these in. */
extern int pexecute PROTO ((const char *, char * const *, const char *,
#define obstack_chunk_alloc xmalloc
#define obstack_chunk_free free
-extern void free ();
-extern char *getenv ();
-
extern char *choose_temp_base PROTO((void));
-#ifndef errno
-extern int errno;
-#endif
-
#ifndef HAVE_STRERROR
extern int sys_nerr;
extern char *sys_errlist[];
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs} \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}}\
-undef -D__OBJC__ -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.i}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
-undef -D__GNUC__=%v1 -D__GNUC_MINOR__=%v2\
%{ansi:-trigraphs -D__STRICT_ANSI__}\
%{!undef:%{!ansi:%p} %P} %{trigraphs}\
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %W{o*}"},
%{C:%{!E:%eGNU C does not support -C without using -E}}\
%{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG} %{trigraphs}\
-undef -$ %{!undef:%p %P} -D__ASSEMBLER__ \
- %c %{O*:%{!O0:-D__OPTIMIZE__}} %{traditional} %{ftraditional:-traditional}\
+ %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
+ %{traditional} %{ftraditional:-traditional}\
%{traditional-cpp:-traditional}\
%{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\
%i %{!M:%{!MM:%{!E:%{!pipe:%g.s}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n",
}
old_spec = *(sl->ptr_spec);
- *(sl->ptr_spec) = ((spec[0] == '+' && isspace (spec[1]))
+ *(sl->ptr_spec) = ((spec[0] == '+' && ISSPACE (spec[1]))
? concat (old_spec, spec + 1, NULL_PTR)
: save_string (spec, strlen (spec)));
while (*p1 == ' ' || *p1 == '\t')
p1++;
- if (! isalpha (*p1))
+ if (! ISALPHA (*p1))
fatal ("specs %%rename syntax malformed after %d characters",
p1 - buffer);
p2 = p1;
- while (*p2 && !isspace (*p2))
+ while (*p2 && !ISSPACE (*p2))
p2++;
if (*p2 != ' ' && *p2 != '\t')
while (*p2 == ' ' || *p2 == '\t')
p2++;
- if (! isalpha (*p2))
+ if (! ISALPHA (*p2))
fatal ("specs %%rename syntax malformed after %d characters",
p2 - buffer);
/* Get new spec name */
p3 = p2;
- while (*p3 && !isspace (*p3))
+ while (*p3 && !ISSPACE (*p3))
p3++;
if (p3 != p-1)
}
}
-/* Get rid of all prefixes built up so far in *PLISTP. */
-
-static void
-free_path_prefix (pprefix)
- struct path_prefix *pprefix;
-{
- struct prefix_list *pl = pprefix->plist;
- struct prefix_list *temp;
-
- while (pl)
- {
- temp = pl;
- pl = pl->next;
- free (temp->prefix);
- free ((char *) temp);
- }
-
- pprefix->plist = (struct prefix_list *) 0;
-}
\f
/* Execute the command specified by the arguments on the current line of spec.
When using pipes, this includes several piped-together commands
case 'B':
{
- int *temp = (int *) xmalloc (sizeof (int));
char *value;
if (p[1] == 0 && i + 1 == argc)
fatal ("argument to `-B' is missing");
&& (value[len - 8] == '/'
|| value[len - 8] == DIR_SEPARATOR)))
&& strncmp (value + len - 7, "stage", 5) == 0
- && isdigit (value[len - 2])
+ && ISDIGIT (value[len - 2])
&& (value[len - 1] == '/'
|| value[len - 1] == DIR_SEPARATOR))
{
char *string;
int value;
- while (c = *p++)
+ while ((c = *p++))
/* If substituting a switch, treat all chars like letters.
Otherwise, NL, SPC, TAB and % are special. */
switch (inswitch ? 'a' : c)
In 2.4, do something about that. */
struct temp_name *t;
char *suffix = p;
- while (*p == '.' || isalpha (*p)
+ while (*p == '.' || ISALPHA (*p)
|| (p[0] == '%' && p[1] == 'O'))
p++;
*x++ = *y++;
if (*y != '_'
- || (*(y+1) != '_' && ! isupper (*(y+1))))
+ || (*(y+1) != '_' && ! ISUPPER (*(y+1))))
{
/* Stick __ at front of macro name. */
*x++ = '_';
y += 2;
if (*y != '_'
- || (*(y+1) != '_' && ! isupper (*(y+1))))
+ || (*(y+1) != '_' && ! ISUPPER (*(y+1))))
{
/* Stick -D__ at front of macro name. */
*x++ = '-';
([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */
/* Ignore leading non-digits. i.e. "foo-" in "foo-2.7.2". */
- while (! isdigit (*v))
+ while (! ISDIGIT (*v))
v++;
if (v > compiler_version && v[-1] != '-')
abort ();
if (c1 == '2')
{
/* Set V after the first period. */
- while (isdigit (*v))
+ while (ISDIGIT (*v))
v++;
if (*v != '.')
abort ();
/* Set Q at the next period or at the end. */
q = v;
- while (isdigit (*q))
+ while (ISDIGIT (*q))
q++;
if (*q != 0 && *q != ' ' && *q != '.' && *q != '-')
abort ();
first_time = FALSE;
obstack_grow (&collect_obstack, "'-", 2);
q = switches[i].part1;
- while (p = (char *) index (q,'\''))
+ while ((p = (char *) index (q,'\'')))
{
obstack_grow (&collect_obstack, q, p-q);
obstack_grow (&collect_obstack, "'\\''", 4);
{
obstack_grow (&collect_obstack, " '", 2);
q = *args;
- while (p = (char *) index (q,'\''))
+ while ((p = (char *) index (q,'\'')))
{
obstack_grow (&collect_obstack, q, p-q);
obstack_grow (&collect_obstack, "'\\''", 4);
if (error_count == 0)
{
int tmp = execution_count;
- int i;
- int first_time;
/* Rebuild the COMPILER_PATH and LIBRARY_PATH environment variables
for collect. */
for (i = 0; i < sizeof comp->spec / sizeof comp->spec[0] && comp->spec[i]; i++)
{
p = comp->spec[i];
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
for (spec = specs; spec ; spec = spec->next)
{
p = *(spec->ptr_spec);
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
}
p = link_command_spec;
- while (c = *p++)
+ while ((c = *p++))
if (c == '%' && *p == '{')
/* We have a switch spec. */
validate_switches (p + 1);
int len;
{
char *start, *end;
- int i;
for (start = multilib_defaults; *start != '\0'; start = end+1)
{