Article View: gnu.gcc.bug
Article #727(none)
From: Cindy Miller
Date: Wed, 18 Oct 1989 21:09
Date: Wed, 18 Oct 1989 21:09
6391 lines
52513 bytes
52513 bytes
Hi rms,
I just got your mail (boy, that was fast, thanks).
I have sent you more info, but will include the output
of cpp with gcc.c. Below the '+'s, it starts.
Thank you,
Cindy Miller @ Matrix
email: mcnc!matrx!cindy
phone: 919-833-2000
+++++++++++++++++++++++++++++++++++++++++++++
# 1 "gcc.c"
# 1 "/usr/include/stdio.h"
# 1 "/usr/include/_int_stddef.h"
typedef unsigned int size_t;
typedef int wchar_t;
# 15 "/usr/include/stdio.h"
# 1 "/usr/include/_int_varargs.h"
typedef struct {
int __va_arg;
int *__va_stk;
int *__va_reg;
} va_list;
# 16 "/usr/include/stdio.h"
typedef struct {
int _cnt;
unsigned char *_ptr;
unsigned char *_base;
int _flag;
int _file;
int _reserve[27];
} FILE;
int getc (FILE *__stream) ;
int putc ( int __c, FILE * __stream) ;
int getchar (void) ;
int putchar (int __c) ;
void clearerr (FILE *__stream) ;
int feof (FILE *__stream) ;
int ferror (FILE *__stream) ;
extern int _filbuf();
extern FILE _iob[64 ];
extern unsigned char *_bufendtab[];
typedef long int fpos_t;
extern FILE *fdopen();
extern FILE *popen();
extern char *ctermid(), *cuserid(), *tempnam();
extern int pclose(), system();
extern int rename (const char *__old, const char *__new) ;
extern int fclose (FILE *__stream) ;
extern int fflush (FILE *__stream) ;
extern FILE *fopen (const char *__filename, const char *__mode) ;
extern FILE *freopen (const char *__filename, const char *__mode,
FILE *__stream) ;
extern void setbuf (FILE *__stream, char *__buf) ;
extern int setvbuf (FILE *__stream, char *__buf, int __mode, size_t __size) ;
extern int fprintf (FILE *__stream, const char *__format, ...) ;
extern int fscanf (FILE *__stream, const char *__format, ...) ;
extern int printf (const char *__format, ...) ;
extern int scanf (const char *__format, ...) ;
extern int sprintf (char *__s, const char *__format, ...) ;
extern int sscanf (const char *__s, const char *__format, ...) ;
extern int vscanf ( const char *__fmt, va_list ) ;
extern int vfprintf ( FILE *__stream, const char *__fmt, va_list ) ;
extern int vfscanf ( FILE *__stream, const char *__fmt, va_list ) ;
extern int vsscanf (const char *__buf, const char *__fmt, va_list) ;
extern vprintf (const char *__format, va_list __arg) ;
extern int vsprintf (char *__s, const char *__format, va_list __arg) ;
extern int fgetc (FILE *__stream) ;
extern int ungetc ( int __ch, FILE *__stream ) ;
extern int putw ( int __n, FILE *__stream ) ;
extern int getw ( FILE *__stream ) ;
extern int fputc (int __c, FILE *__stream) ;
extern int fputs (const char *__s, FILE *__stream) ;
extern char *gets (char *__s) ;
extern char *fgets ( char *__line, int __n, FILE *__stream ) ;
extern int puts (const char *__s) ;
extern size_t fread (void * __ptr, size_t __size, size_t __nmemb, FILE *__stream) ;
extern size_t fwrite (const void * __ptr, size_t __size, size_t __nmemb, FILE *__stream) ;
extern int fgetpos (FILE *__stream, fpos_t *__pos) ;
extern int fseek (FILE *__stream, long int __offset, int __whence) ;
extern int fsetpos (FILE *__stream, const fpos_t *__pos) ;
extern long int ftell (FILE *__stream) ;
extern void rewind (FILE *__stream) ;
extern int remove (const char *__filename) ;
extern void perror (const char *__s) ;
extern FILE *tmpfile (void) ;
extern char *tmpnam (char *__s) ;
# 134 "gcc.c"
# 1 "/usr/include/sys/types.h"
# 1 "/usr/include/sys/_int_features.h"
# 71 "/usr/include/sys/types.h"
typedef long time_t ;
typedef long dev_t ;
typedef long off_t ;
typedef unsigned long ino_t ;
typedef unsigned long uid_t ;
typedef unsigned long gid_t ;
typedef unsigned long mode_t ;
typedef long nlink_t ;
typedef int pid_t ;
# 243 "/usr/include/sys/types.h"
typedef unsigned short ushort ;
typedef int label_t [10];
typedef char * caddr_t ;
typedef long daddr_t ;
# 461 "/usr/include/sys/types.h"
typedef unsigned char u_char ;
typedef unsigned short u_short ;
typedef unsigned long u_long ;
typedef long fd_mask ;
typedef struct fd_set
{
fd_mask fds_bits [(((256 )+(( (sizeof(fd_mask) * 8 ) )-1))/( (sizeof(fd_mask) * 8 ) )) ];
} fd_set;
# 1 "/usr/include/sys/sysmacros.h"
# 723 "/usr/include/sys/types.h"
# 135 "gcc.c"
# 1 "/usr/include/signal.h"
# 1 "/usr/include/sys/signal.h"
# 257 "/usr/include/sys/signal.h"
struct sigvec
{
void (* sv_handler )();
long sv_mask;
long sv_pad1;
int sv_flags;
};
struct sigstack
{
char * ss_sp;
int ss_onstack;
};
# 486 "/usr/include/sys/signal.h"
# 528 "/usr/include/sys/signal.h"
int kill (pid_t __pid, int __sig) ;
# 921 "/usr/include/sys/signal.h"
# 25 "/usr/include/signal.h"
# 1 "/usr/include/_int_stddef.h"
# 45 "/usr/include/_int_stddef.h"
# 26 "/usr/include/signal.h"
typedef int sig_atomic_t;
extern void (*signal (int __sig, void (*__func)(int)) ) (int) ;
extern void (*sigset())();
extern int raise (int __sig) ;
# 136 "gcc.c"
# 1 "/usr/include/sys/file.h"
# 1 "/usr/include/sys/fcntl.h"
# 92 "/usr/include/sys/fcntl.h"
# 176 "/usr/include/sys/fcntl.h"
# 192 "/usr/include/sys/fcntl.h"
# 249 "/usr/include/sys/fcntl.h"
# 360 "/usr/include/sys/fcntl.h"
# 376 "/usr/include/sys/fcntl.h"
int fcntl (int __fildes, int __cmd, ...) ;
int open (char * __path, int __oflag, ...) ;
int creat (char * __path, mode_t __mode) ;
# 62 "/usr/include/sys/file.h"
# 164 "/usr/include/sys/file.h"
# 137 "gcc.c"
# 1 "/usr/include/setjmp.h"
typedef int jmp_buf[24 ];
extern int setjmp();
extern void longjmp();
# 138 "gcc.c"
# 1 "/usr/include/varargs.h"
# 98 "/usr/include/varargs.h"
# 139 "gcc.c"
# 1 "config.h"
# 1 "tm.h"
# 1 "tm-m68k.h"
extern int target_flags;
# 85 "tm-m68k.h"
# 181 "tm-m68k.h"
# 197 "tm-m68k.h"
# 223 "tm-m68k.h"
enum reg_class { NO_REGS, LO_FPA_REGS, FPA_REGS, FP_REGS,
FP_OR_FPA_REGS, DATA_REGS, DATA_OR_FPA_REGS, DATA_OR_FP_REGS,
DATA_OR_FP_OR_FPA_REGS, ADDR_REGS, GENERAL_REGS,
GENERAL_OR_FPA_REGS, GENERAL_OR_FP_REGS, ALL_REGS,
LIM_REG_CLASSES };
# 358 "tm-m68k.h"
extern enum reg_class regno_reg_class[];
# 389 "tm-m68k.h"
# 623 "tm-m68k.h"
# 738 "tm-m68k.h"
# 786 "tm-m68k.h"
# 896 "tm-m68k.h"
# 928 "tm-m68k.h"
# 996 "tm-m68k.h"
# 1076 "tm-m68k.h"
# 1176 "tm-m68k.h"
# 1448 "tm-m68k.h"
# 1598 "tm-m68k.h"
# 22 "tm.h"
# 58 "tm.h"
# 33 "config.h"
# 141 "gcc.c"
# 1 "obstack.h"
struct _obstack_chunk
{
char *limit;
struct _obstack_chunk *prev;
char contents[4];
};
struct obstack
{
long chunk_size;
struct _obstack_chunk* chunk;
char *object_base;
char *next_free;
char *chunk_limit;
int temp;
int alignment_mask;
struct _obstack_chunk *(*chunkfun) ();
void (*freefun) ();
};
void obstack_init (struct obstack *obstack);
void * obstack_alloc (struct obstack *obstack, int size);
void * obstack_copy (struct obstack *obstack, void *address, int size);
void * obstack_copy0 (struct obstack *obstack, void *address, int size);
void obstack_free (struct obstack *obstack, void *block);
void obstack_blank (struct obstack *obstack, int size);
void obstack_grow (struct obstack *obstack, void *data, int size);
void obstack_grow0 (struct obstack *obstack, void *data, int size);
void obstack_1grow (struct obstack *obstack, int data_char);
void * obstack_finish (struct obstack *obstack);
int obstack_object_size (struct obstack *obstack);
int obstack_room (struct obstack *obstack);
void obstack_1grow_fast (struct obstack *obstack, int data_char);
void obstack_blank_fast (struct obstack *obstack, int size);
void * obstack_base (struct obstack *obstack);
void * obstack_next_free (struct obstack *obstack);
int obstack_alignment_mask (struct obstack *obstack);
int obstack_chunk_size (struct obstack *obstack);
# 244 "obstack.h"
# 286 "obstack.h"
# 369 "obstack.h"
# 142 "gcc.c"
extern int xmalloc ();
extern void free ();
struct obstack obstack;
char *handle_braces ();
char *save_string ();
char *concat ();
int do_spec ();
int do_spec_1 ();
char *find_file ();
static char *find_exec_file ();
void validate_switches ();
void validate_all_switches ();
struct compiler
{
char *suffix;
char *spec;
};
struct compiler compilers[] =
{
{".c",
"cpp %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} %{M*} %{trigraphs} -undef -D__GNUC__ %{ansi:-trigraphs -$ -D__STRICT_ANSI__} %{!ansi:%p} %P %c %{O:-D__OPTIMIZE__} %{traditional} %{pedantic} %{H} %{C:%{!E:%eGNU CC does not support -C without using -E\n}} %{Wcomment*} %{Wtrigraphs} %{Wall} %C %{V:%{!v:-v}} %i %{!M*:%{!E:%{!pipe:%g.cpp}}}%{E:%{o*}}%{M*:%{o*}} |\n %{!M*:%{!E:cc1 %{!pipe:%g.cpp} %1 %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*} %{a} %{g} %{O} %{W*} %{w} %{
pedantic} %{ansi} %{traditional} %{v:-version} %{V:%{!v:-version}} %{gg:-symout %g.sym} %{pg:-p} %{p} %{traditional:%{!fwritable-strings:%{!fno-writable-strings:-fwritable-strings}}} %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %2 %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n %{!S:a68 %{R} %{j} %{J} %{h} %{d2} %a %{gg:-G %g.sym} %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %A %{!p!
ipe:%g.s}\n }}}"},
# 256 "gcc.c"
{".cc",
"cpp -+ %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} %{M*} -undef -D__GNUC__ %p %P %c %{O:-D__OPTIMIZE__} %{traditional} %{pedantic} %{H} %{Wcomment*} %{Wtrigraphs} %{Wall} %C %{V:%{!v:-v}} %{C:%{!E:%eGNU C++ does not support -C without using -E\n}} %i %{!M*:%{!E:%{!pipe:%g.cpp}}}%{E:%{o*}}%{M*:%{o*}} |\n %{!M*:%{!E:cc1plus %{!pipe:%g.cpp} %1 %{!Q:-quiet} -dumpbase %i %{Y*} %{d*} %{m*} %{f*} %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{traditional} %{traditional:%{!fwritable
-strings:%{!fno-writable-strings:-fwritable-strings}}} %{v:-version} %{V:%{!v:-version}} %{gg:-symout %g.sym} %{pg:-p} %{p} %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} %2 %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n %{!S:a68 %{R} %{j} %{J} %{h} %{d2} %a %{gg:-G %g.sym} %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %A %{!pipe:%g.s}\n }}}"},
# 273 "gcc.c"
{".i",
"cc1 %i %1 %{!Q:-quiet} %{Y*} %{d*} %{m*} %{f*} %{a} %{g} %{O} %{W*} %{w} %{pedantic} %{ansi} %{traditional} %{traditional:%{!fwritable-strings:%{!fno-writable-strings:-fwritable-strings}}} %{v:-version} %{V:%{!v:-version}} %{gg:-symout %g.sym} %{pg:-p} %{p} %2 %{S:%{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n %{!S:a68 %{R} %{j} %{J} %{h} %{d2} %a %{gg:-G %g.sym} %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %A %{!pipe:%g.s}\n }"},
{".s",
"%{!S:a68 %{R} %{j} %{J} %{h} %{d2} %a %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %i\n }"},
{".S",
"cpp %{nostdinc} %{C} %{v} %{D*} %{U*} %{I*} %{M*} %{trigraphs} -undef -D__GNUC__ -$ %p %P %{V:%{!v:-v}} %c %{O:-D__OPTIMIZE__} %{traditional} %{pedantic} %{H} %{Wcomment*} %{Wtrigraphs} %{Wall} %C %i %{!M*:%{!E:%{!pipe:%g.cpp}}}%{E:%{o*}}%{M*:%{o*}} |\n %{!M*:%{!E:%{!S:a68 %{R} %{j} %{J} %{h} %{d2} %a %{c:%{o*}%{!o*:-o %w%b.o}}%{!c:-o %d%w%b.o} %A %{!pipe:%g.s}\n }}}"},
{0, 0}
};
char *link_spec = "%{!c:%{!M*:%{!E:%{!S:ld %{o*} %l %{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z} %{y*} %{!nostdlib:%S} %{L*} %o %{!nostdlib:gnulib%s %{g:-lg} %L}\n }}}}";
char *temp_filename;
int temp_filename_length;
struct temp_file
{
char *name;
struct temp_file *next;
};
struct temp_file *always_delete_queue;
struct temp_file *failure_delete_queue;
void
record_temp_file (filename, always_delete, fail_delete)
char *filename;
int always_delete;
int fail_delete;
{
register char *name;
name = (char *) xmalloc (strlen (filename) + 1);
strcpy (name, filename);
if (always_delete)
{
register struct temp_file *temp;
temp = (struct temp_file *) xmalloc (sizeof (struct temp_file));
temp->next = always_delete_queue;
temp->name = name;
always_delete_queue = temp;
}
if (fail_delete)
{
register struct temp_file *temp;
temp = (struct temp_file *) xmalloc (sizeof (struct temp_file));
temp->next = failure_delete_queue;
temp->name = name;
failure_delete_queue = temp;
}
}
void
delete_temp_files (success)
int success;
{
register struct temp_file *temp;
for (temp = always_delete_queue; temp; temp = temp->next)
{
# 389 "gcc.c"
unlink (temp->name);
}
if (! success)
for (temp = failure_delete_queue; temp; temp = temp->next)
{
# 404 "gcc.c"
unlink (temp->name);
}
always_delete_queue = 0;
failure_delete_queue = 0;
}
void
clear_failure_queue ()
{
failure_delete_queue = 0;
}
void
choose_temp_base ()
{
extern char *getenv ();
char *base = getenv ("TMPDIR");
int len;
if (base == (char *)0)
{
if (access ("/usr/tmp/" , 4 | 2 ) == 0)
base = "/usr/tmp/" ;
else if (access ("/usr/tmp", 4 | 2 ) == 0)
base = "/usr/tmp/";
else
base = "/tmp/";
}
len = strlen (base);
temp_filename = (char *) xmalloc (len + sizeof("/ccXXXXXX"));
strcpy (temp_filename, base);
if (len > 0 && temp_filename[len-1] != '/')
temp_filename[len++] = '/';
strcpy (temp_filename + len, "ccXXXXXX");
mktemp (temp_filename);
temp_filename_length = strlen (temp_filename);
}
char **argbuf;
int argbuf_length;
int argbuf_index;
unsigned char vflag;
unsigned char print_version;
char *programname;
char *user_exec_prefix = 0;
char *env_exec_prefix = 0;
char *standard_exec_prefix = "/usr/local/lib/gcc-" ;
char *standard_exec_prefix_1 = "/usr/lib/gcc-";
char *standard_startfile_prefix = "/usr/local/lib/" ;
char *standard_startfile_prefix_1 = "/lib/";
char *standard_startfile_prefix_2 = "/usr/lib/";
void
clear_args ()
{
argbuf_index = 0;
}
void
store_arg (arg, delete_always, delete_failure)
char *arg;
int delete_always, delete_failure;
{
if (argbuf_index + 1 == argbuf_length)
{
argbuf = (char **) realloc (argbuf, (argbuf_length *= 2) * sizeof (char *));
}
argbuf[argbuf_index++] = arg;
argbuf[argbuf_index] = 0;
if (delete_always || delete_failure)
record_temp_file (arg, delete_always, delete_failure);
}
static char *
find_exec_file (prog)
char *prog;
{
int win = 0;
char *temp;
int size;
size = strlen (standard_exec_prefix);
if (user_exec_prefix != 0 && strlen (user_exec_prefix) > size)
size = strlen (user_exec_prefix);
if (env_exec_prefix != 0 && strlen (env_exec_prefix) > size)
size = strlen (env_exec_prefix);
if (strlen (standard_exec_prefix_1) > size)
size = strlen (standard_exec_prefix_1);
size += strlen (prog) + 1;
temp = (char *) xmalloc (size);
if (user_exec_prefix)
{
strcpy (temp, user_exec_prefix);
strcat (temp, prog);
win = (access (temp, 1 ) == 0);
}
if (!win && env_exec_prefix)
{
strcpy (temp, env_exec_prefix);
strcat (temp, prog);
win = (access (temp, 1 ) == 0);
}
if (!win)
{
strcpy (temp, standard_exec_prefix);
strcat (temp, prog);
win = (access (temp, 1 ) == 0);
}
if (!win)
{
strcpy (temp, standard_exec_prefix_1);
strcat (temp, prog);
win = (access (temp, 1 ) == 0);
}
if (win)
return temp;
else
return 0;
}
int last_pipe_input;
static int
pexecute (func, program, argv, not_last)
char *program;
int (*func)();
char *argv[];
int not_last;
{
int pid;
int pdes[2];
int input_desc = last_pipe_input;
int output_desc = 1 ;
if (not_last)
{
if (pipe (pdes) < 0)
pfatal_with_name ("pipe");
output_desc = pdes[1 ];
last_pipe_input = pdes[0 ];
}
else
last_pipe_input = 0 ;
pid = vfork ();
switch (pid)
{
case -1:
pfatal_with_name ("vfork");
break;
case 0:
if (input_desc != 0 )
{
close (0 );
dup (input_desc);
close (input_desc);
}
if (output_desc != 1 )
{
close (1 );
dup (output_desc);
close (output_desc);
}
if (last_pipe_input != 0 )
close (last_pipe_input);
(*func) (program, argv);
perror_exec (program);
exit (-1);
default:
if (input_desc != 0 )
close (input_desc);
if (output_desc != 1 )
close (output_desc);
return pid;
}
}
int
execute ()
{
int i, j;
int n_commands;
char *string;
struct command
{
char *prog;
char **argv;
int pid;
};
struct command *commands;
for (n_commands = 1, i = 0; i < argbuf_index; i++)
if (strcmp (argbuf[i], "|") == 0)
n_commands++;
commands
= (struct command *) __builtin_alloca (n_commands * sizeof (struct command));
commands[0].prog = argbuf[0];
commands[0].argv = &argbuf[0];
string = find_exec_file (commands[0].prog);
if (string)
commands[0].argv[0] = string;
for (n_commands = 1, i = 0; i < argbuf_index; i++)
if (strcmp (argbuf[i], "|") == 0)
{
argbuf[i] = 0;
commands[n_commands].prog = argbuf[i + 1];
commands[n_commands].argv = &argbuf[i + 1];
string = find_exec_file (commands[n_commands].prog);
if (string)
commands[n_commands].argv[0] = string;
n_commands++;
}
argbuf[argbuf_index] = 0;
if (vflag)
{
for (i = 0; i < n_commands ; i++)
{
char **j;
for (j = commands[i].argv; *j; j++)
fprintf ( (&_iob[2]) , " %s", *j);
if (i + 1 != n_commands)
fprintf ( (&_iob[2]) , " |");
fprintf ( (&_iob[2]) , "\n");
}
fflush ( (&_iob[2]) );
# 772 "gcc.c"
}
last_pipe_input = 0 ;
for (i = 0; i < n_commands; i++)
{
extern int execv(), execvp();
char *string = commands[i].argv[0];
commands[i].pid = pexecute ((string != commands[i].prog ? execv : execvp),
string, commands[i].argv,
i + 1 < n_commands);
if (string != commands[i].prog)
free (string);
}
{
int ret_code = 0;
for (i = 0; i < n_commands; i++)
{
int status;
int pid;
char *prog;
pid = wait (&status);
if (pid < 0)
abort ();
if (status != 0)
{
int j;
for (j = 0; j < n_commands; j++)
if (commands[j].pid == pid)
prog = commands[j].prog;
if ((status & 0x7F) != 0)
fatal ("Program %s got fatal signal %d.", prog, (status & 0x7F));
if (((status & 0xFF00) >> 8) >= 1 )
ret_code = -1;
}
}
return ret_code;
}
}
struct switchstr
{
char *part1;
char *part2;
int valid;
};
struct switchstr *switches;
int n_switches;
char **infiles;
int n_infiles;
char **outfiles;
void
process_command (argc, argv)
int argc;
char **argv;
{
extern char *getenv ();
register int i;
n_switches = 0;
n_infiles = 0;
env_exec_prefix = getenv ("GCC_EXEC_PREFIX");
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '-' && argv[i][1] != 'l')
{
register char *p = &argv[i][1];
register int c = *p;
switch (c)
{
case 'B':
user_exec_prefix = p + 1;
break;
case 'v':
vflag++;
n_switches++;
break;
case 'V':
print_version++;
n_switches++;
break;
default:
n_switches++;
if (((c) == 'D' || (c) == 'U' || (c) == 'o' || (c) == 'e' || (c) == 'T' || (c) == 'u' || (c) == 'I' || (c) == 'Y' || (c) == 'm' || (c) == 'L') && p[1] == 0)
i++;
else if ((!strcmp (p, "Tdata")) )
i++;
}
}
else
n_infiles++;
}
switches = ((struct switchstr *)
xmalloc ((n_switches + 1) * sizeof (struct switchstr)));
infiles = (char **) xmalloc ((n_infiles + 1) * sizeof (char *));
n_switches = 0;
n_infiles = 0;
for (i = 1; i < argc; i++)
{
if (argv[i][0] == '-' && argv[i][1] != 'l')
{
register char *p = &argv[i][1];
register int c = *p;
if (c == 'B')
continue;
switches[n_switches].part1 = p;
if ((((c) == 'D' || (c) == 'U' || (c) == 'o' || (c) == 'e' || (c) == 'T' || (c) == 'u' || (c) == 'I' || (c) == 'Y' || (c) == 'm' || (c) == 'L') && p[1] == 0)
|| (!strcmp (p, "Tdata")) )
switches[n_switches].part2 = argv[++i];
else
switches[n_switches].part2 = 0;
switches[n_switches].valid = 0;
n_switches++;
}
else
infiles[n_infiles++] = argv[i];
}
switches[n_switches].part1 = 0;
infiles[n_infiles] = 0;
}
char *input_filename;
int input_file_number;
int input_filename_length;
int basename_length;
char *input_basename;
int arg_going;
int delete_this_arg;
int this_is_output_file;
int this_is_library_file;
int ignore_spec;
jmp_buf spec_label;
int
do_spec (spec)
char *spec;
{
int value;
clear_args ();
arg_going = 0;
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
ignore_spec = 0;
value = setjmp (spec_label);
if (value != 0)
return value;
value = do_spec_1 (spec, 0);
if (value == 0)
{
if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
argbuf_index--;
if (argbuf_index > 0)
value = execute ();
}
return value;
}
int
do_spec_1 (spec, inswitch)
char *spec;
int inswitch;
{
register char *p = spec;
register int c;
char *string;
while (c = *p++)
switch (inswitch ? 'a' : c)
{
case '\n':
if (arg_going && !ignore_spec)
{
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( 0); (void) 0; }) ;
string = ({ struct obstack *__o = (&obstack); void *value = (void *) __o->object_base; __o->next_free = (((((__o->next_free) - (char *)0) +__o->alignment_mask) & ~ (__o->alignment_mask)) + (char *)0) ; ((__o->next_free - (char *)__o->chunk > __o->chunk_limit - (char *)__o->chunk) ? (__o->next_free = __o->chunk_limit) : 0); __o->object_base = __o->next_free; value; }) ;
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
arg_going = 0;
ignore_spec = 0;
if (argbuf_index > 0 && !strcmp (argbuf[argbuf_index - 1], "|"))
{
int i;
for (i = 0; i < n_switches; i++)
if (!strcmp (switches[i].part1, "pipe"))
break;
if (i < n_switches)
{
switches[i].valid = 1;
break;
}
else
argbuf_index--;
}
{
int value = (argbuf_index > 0) ? execute () : 0;
clear_args ();
arg_going = 0;
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
ignore_spec = 0;
if (value)
longjmp (spec_label, value);
}
break;
case '|':
if (arg_going && !ignore_spec)
{
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( 0); (void) 0; }) ;
string = ({ struct obstack *__o = (&obstack); void *value = (void *) __o->object_base; __o->next_free = (((((__o->next_free) - (char *)0) +__o->alignment_mask) & ~ (__o->alignment_mask)) + (char *)0) ; ((__o->next_free - (char *)__o->chunk > __o->chunk_limit - (char *)__o->chunk) ? (__o->next_free = __o->chunk_limit) : 0); __o->object_base = __o->next_free; value; }) ;
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( c); (void) 0; }) ;
arg_going = 1;
ignore_spec = 0;
break;
case '\t':
case ' ':
if (arg_going && !ignore_spec)
{
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( 0); (void) 0; }) ;
string = ({ struct obstack *__o = (&obstack); void *value = (void *) __o->object_base; __o->next_free = (((((__o->next_free) - (char *)0) +__o->alignment_mask) & ~ (__o->alignment_mask)) + (char *)0) ; ((__o->next_free - (char *)__o->chunk > __o->chunk_limit - (char *)__o->chunk) ? (__o->next_free = __o->chunk_limit) : 0); __o->object_base = __o->next_free; value; }) ;
if (this_is_library_file)
string = find_file (string);
store_arg (string, delete_this_arg, this_is_output_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
}
arg_going = 0;
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
break;
case '%':
switch (c = *p++)
{
case 0:
fatal ("Invalid specification! Bug in cc.");
case 'b':
if (!ignore_spec)
({ struct obstack *__o = (&obstack); int __len = ( basename_length); ((__o->next_free + __len > __o->chunk_limit) ? _obstack_newchunk (__o, __len) : 0); memcpy ( __o->next_free, input_basename, __len) ; __o->next_free += __len; (void) 0; }) ;
arg_going = 1;
break;
case 'd':
delete_this_arg = 2;
break;
case 'e':
{
char *q = p;
char *buf;
while (*p != 0 && *p != '\n') p++;
buf = (char *) __builtin_alloca (p - q + 1);
strncpy (buf, q, p - q);
error ("%s", buf);
return -1;
}
break;
case 'g':
if (!ignore_spec)
({ struct obstack *__o = (&obstack); int __len = ( temp_filename_length); ((__o->next_free + __len > __o->chunk_limit) ? _obstack_newchunk (__o, __len) : 0); memcpy ( __o->next_free, temp_filename, __len) ; __o->next_free += __len; (void) 0; }) ;
delete_this_arg = 1;
arg_going = 1;
break;
case 'i':
if (!ignore_spec)
({ struct obstack *__o = (&obstack); int __len = ( input_filename_length); ((__o->next_free + __len > __o->chunk_limit) ? _obstack_newchunk (__o, __len) : 0); memcpy ( __o->next_free, input_filename, __len) ; __o->next_free += __len; (void) 0; }) ;
arg_going = 1;
break;
case 'o':
if (!ignore_spec)
{
register int f;
for (f = 0; f < n_infiles; f++)
store_arg (outfiles[f], 0, 0);
}
break;
case 's':
this_is_library_file = 1;
break;
case 'w':
this_is_output_file = 1;
break;
case '{':
p = handle_braces (p);
if (p == 0)
return -1;
break;
case '%':
if (!ignore_spec)
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( '%'); (void) 0; }) ;
break;
case '~':
ignore_spec = ! ignore_spec;
arg_going = 0;
break;
case '1':
do_spec_1 ("" , 0);
break;
case '2':
do_spec_1 ("" , 0);
break;
case 'a':
do_spec_1 ("%{m68000:-mc68010}%{mc68000:-mc68010}%{!mc68000:%{!m68000:-mc68020}}" , 0);
break;
case 'A':
do_spec_1 ("" , 0);
break;
case 'c':
do_spec_1 ((1 ? "%{funsigned-char:-D__CHAR_UNSIGNED__}" : "%{!fsigned-char:-D__CHAR_UNSIGNED__}") , 0);
break;
case 'C':
do_spec_1 ("%{!msoft-float:%{mfpa:-D__HAVE_FPA__ }%{!mfpa:-D__HAVE_68881__ }}%{!ansi:%{m68000:-Dmc68010}%{mc68000:-Dmc68010}%{!mc68000:%{!m68000:-Dmc68020}}}" , 0);
break;
case 'l':
do_spec_1 ("" , 0);
break;
case 'L':
do_spec_1 ("%{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p} %{a:/usr/lib/bb_link.o} " , 0);
break;
case 'p':
do_spec_1 ("-Dmc68000 -Dsun -Dunix" , 0);
break;
case 'P':
{
char *x = (char *) __builtin_alloca (strlen ("-Dmc68000 -Dsun -Dunix" ) * 2 + 1);
char *buf = x;
char *y = "-Dmc68000 -Dsun -Dunix" ;
while (1)
{
if (! strncmp (y, "-D", 2))
{
*x++ = '-';
*x++ = 'D';
*x++ = '_';
*x++ = '_';
y += 2;
}
else if (*y == ' ' || *y == 0)
{
*x++ = '_';
*x++ = '_';
if (*y == 0)
break;
else
*x++ = *y++;
}
else
*x++ = *y++;
}
*x = 0;
do_spec_1 (buf, 0);
}
break;
case 'S':
do_spec_1 ("%{pg:gcrt0.o%s}%{!pg:%{p:mcrt0.o%s}%{!p:crt0.o%s}} %{mfpa:Wcrt1.o%s} %{msoft-float:Fcrt1.o%s} %{!mfpa:%{!msoft-float:Mcrt1.o%s}}" , 0);
break;
default:
abort ();
}
break;
default:
if (!ignore_spec)
{
({ struct obstack *__o = (&obstack); ((__o->next_free + 1 > __o->chunk_limit) ? _obstack_newchunk (__o, 1) : 0), *(__o->next_free)++ = ( c); (void) 0; }) ;
arg_going = 1;
}
}
return 0;
}
char *
handle_braces (p)
register char *p;
{
register char *q;
char *filter;
int pipe = 0;
int negate = 0;
int star = 0;
if (*p == '|')
pipe = 1, ++p;
if (*p == '!')
negate = 1, ++p;
if (*p == '*')
star = 1, ++p;
filter = p;
while (*p != ':' && *p != '}') p++;
if (*p != '}')
{
register int count = 1;
q = p + 1;
while (count > 0)
{
if (*q == '{')
count++;
else if (*q == '}')
count--;
else if (*q == 0)
abort ();
q++;
}
}
else
q = p + 1;
if (p[-1] == '*' && p[0] == '}')
{
register int i;
--p;
for (i = 0; i < n_switches; i++)
if (!strncmp (switches[i].part1, filter, p - filter))
give_switch (i, star, p - filter);
}
else
{
register int i;
int present = 0;
if (p[-1] == '*')
{
for (i = 0; i < n_switches; i++)
{
if (!strncmp (switches[i].part1, filter, p - filter - 1))
{
switches[i].valid = 1;
present = 1;
}
}
}
else
{
for (i = 0; i < n_switches; i++)
{
if (!strncmp (switches[i].part1, filter, p - filter)
&& switches[i].part1[p - filter] == 0)
{
switches[i].valid = 1;
present = 1;
break;
}
}
}
if (present != negate)
{
if (*p == '}')
{
give_switch (i, star, p - filter);
}
else
{
if (do_spec_1 (save_string (p + 1, q - p - 2), 0) < 0)
return 0;
}
}
else if (pipe)
{
do_spec_1 ("-");
}
}
return q;
}
give_switch (switchnum, strip_initial, initial_length)
int switchnum;
int strip_initial;
int initial_length;
{
if (!strip_initial)
{
do_spec_1 ("-", 0);
do_spec_1 (switches[switchnum].part1, 1);
do_spec_1 (" ", 0);
if (switches[switchnum].part2 != 0)
{
do_spec_1 (switches[switchnum].part2, 1);
do_spec_1 (" ", 0);
}
}
else
{
int part1_len = strlen (switches[switchnum].part1);
if (part1_len > initial_length)
{
do_spec_1 (switches[switchnum].part1 + initial_length, 1);
do_spec_1 (" ", 0);
}
if (switches[switchnum].part2 != 0)
{
char *p = switches[switchnum].part2;
if (part1_len < initial_length)
p += initial_length - part1_len;
do_spec_1 (p, 1);
do_spec_1 (" ", 0);
}
}
switches[switchnum].valid = 1;
}
char *
find_file (name)
char *name;
{
int size;
char *temp;
int win = 0;
size = strlen (standard_exec_prefix);
if (user_exec_prefix != 0 && strlen (user_exec_prefix) > size)
size = strlen (user_exec_prefix);
if (env_exec_prefix != 0 && strlen (env_exec_prefix) > size)
size = strlen (env_exec_prefix);
if (strlen (standard_exec_prefix) > size)
size = strlen (standard_exec_prefix);
if (strlen (standard_exec_prefix_1) > size)
size = strlen (standard_exec_prefix_1);
if (strlen (standard_startfile_prefix) > size)
size = strlen (standard_startfile_prefix);
if (strlen (standard_startfile_prefix_1) > size)
size = strlen (standard_startfile_prefix_1);
if (strlen (standard_startfile_prefix_2) > size)
size = strlen (standard_startfile_prefix_2);
size += strlen (name) + 1;
temp = (char *) __builtin_alloca (size);
if (user_exec_prefix)
{
strcpy (temp, user_exec_prefix);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win && env_exec_prefix)
{
strcpy (temp, env_exec_prefix);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, standard_exec_prefix);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, standard_exec_prefix_1);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, standard_startfile_prefix);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, standard_startfile_prefix_1);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, standard_startfile_prefix_2);
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (!win)
{
strcpy (temp, "./");
strcat (temp, name);
win = (access (temp, 4 ) == 0);
}
if (win)
return save_string (temp, strlen (temp));
return name;
}
void
fatal_error (signum)
int signum;
{
signal (signum, ((void (*)())(0)) );
delete_temp_files (0);
kill (getpid (), signum);
}
int
main (argc, argv)
int argc;
char **argv;
{
register int i;
int value;
int nolink = 0;
int error_count = 0;
programname = argv[0];
if (signal ( 2 , ((void (*)())(1)) ) != ((void (*)())(1)) )
signal ( 2 , fatal_error);
if (signal ( 1 , ((void (*)())(1)) ) != ((void (*)())(1)) )
signal ( 1 , fatal_error);
if (signal ( 15 , ((void (*)())(1)) ) != ((void (*)())(1)) )
signal ( 15 , fatal_error);
argbuf_length = 10;
argbuf = (char **) xmalloc (argbuf_length * sizeof (char *));
_obstack_begin ((&obstack), 0, 0, xmalloc , free ) ;
choose_temp_base ();
process_command (argc, argv);
if (vflag | print_version)
{
extern char *version_string;
extern char *strchr ();
fprintf ( (&_iob[2]) , "GNU %s version %s",
(strchr (argv[0], '+') == (char *)0) ? "GCC" : "G++",
version_string);
fprintf ( (&_iob[2]) , " (68k, MIT syntax)"); ;
fprintf ( (&_iob[2]) , " compiled by GNU C version %s.\n", "1.35");
if (n_infiles == 0)
exit (0);
}
if (n_infiles == 0)
fatal ("No input files specified.");
outfiles = (char **) xmalloc (n_infiles * sizeof (char *));
memset (outfiles,0, n_infiles * sizeof (char *)) ;
for (i = 0; i < n_infiles; i++)
{
register struct compiler *cp;
input_filename = infiles[i];
input_filename_length = strlen (input_filename);
input_file_number = i;
outfiles[i] = input_filename;
for (cp = compilers; cp->spec; cp++)
{
if (strlen (cp->suffix) < input_filename_length
&& !strcmp (cp->suffix,
infiles[i] + input_filename_length
- strlen (cp->suffix)))
{
register char *p;
input_basename = input_filename;
for (p = input_filename; *p; p++)
if (*p == '/')
input_basename = p + 1;
basename_length = (input_filename_length - strlen (cp->suffix)
- (input_basename - input_filename));
value = do_spec (cp->spec);
if (value < 0)
error_count = 1;
break;
}
}
if (! cp->spec && nolink)
{
error ("%s: linker input file unused since linking not done",
input_filename);
}
clear_failure_queue ();
}
if (! nolink && error_count == 0)
{
value = do_spec (link_spec);
if (value < 0)
error_count = 1;
}
validate_all_switches ();
for (i = 0; i < n_switches; i++)
if (! switches[i].valid)
error ("unrecognized option `-%s'", switches[i].part1);
delete_temp_files (error_count == 0);
exit (error_count);
}
xmalloc (size)
int size;
{
register int value = malloc (size);
if (value == 0)
fatal ("Virtual memory full.");
return value;
}
xrealloc (ptr, size)
int ptr, size;
{
register int value = realloc (ptr, size);
if (value == 0)
fatal ("Virtual memory full.");
return value;
}
char *
concat (s1, s2, s3)
char *s1, *s2, *s3;
{
int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
strcpy (result, s1);
strcpy (result + len1, s2);
strcpy (result + len1 + len2, s3);
*(result + len1 + len2 + len3) = 0;
return result;
}
char *
save_string (s, len)
char *s;
int len;
{
register char *result = (char *) xmalloc (len + 1);
memcpy ( result,s, len) ;
result[len] = 0;
return result;
}
pfatal_with_name (name)
char *name;
{
extern int errno, sys_nerr;
extern char *sys_errlist[];
char *s;
if (errno < sys_nerr)
s = concat ("%s: ", sys_errlist[errno], "");
else
s = "cannot open %s";
fatal (s, name);
}
perror_with_name (name)
char *name;
{
extern int errno, sys_nerr;
extern char *sys_errlist[];
char *s;
if (errno < sys_nerr)
s = concat ("%s: ", sys_errlist[errno], "");
else
s = "cannot open %s";
error (s, name);
}
perror_exec (name)
char *name;
{
extern int errno, sys_nerr;
extern char *sys_errlist[];
char *s;
if (errno < sys_nerr)
s = concat ("installation problem, cannot exec %s: ",
sys_errlist[errno], "");
else
s = "installation problem, cannot exec %s";
error (s, name);
}
int
fatal (__va_1st_arg )
int __va_1st_arg ;
{
va_list ap;
char *format;
(((ap).__va_reg = (int *) __builtin_saveregs2(1)), ((ap).__va_stk = (int *) __builtin_argptr()), ((ap).__va_arg = (__builtin_argsize() - 4 + 3) / 4)) ;
format = (((ap).__va_arg += (__alignof ( char *) >= 8 ? ((ap).__va_arg & 1) : 0) + ((sizeof( char *) + 3) / 4) ), (* (( char * *) (((ap).__va_arg >= 8 + ((sizeof( char *) + 3) / 4) || (...( char *) == 0) ? (ap).__va_stk : (ap).__va_reg) + ((ap).__va_arg - ((sizeof( char *) + 3) / 4) ))))) ;
vfprintf ( (&_iob[2]) , format, ap);
;
fprintf ( (&_iob[2]) , "\n");
delete_temp_files (0);
exit (1);
}
error (__va_1st_arg )
int __va_1st_arg ;
{
va_list ap;
char *format;
(((ap).__va_reg = (int *) __builtin_saveregs2(1)), ((ap).__va_stk = (int *) __builtin_argptr()), ((ap).__va_arg = (__builtin_argsize() - 4 + 3) / 4)) ;
format = (((ap).__va_arg += (__alignof ( char *) >= 8 ? ((ap).__va_arg & 1) : 0) + ((sizeof( char *) + 3) / 4) ), (* (( char * *) (((ap).__va_arg >= 8 + ((sizeof( char *) + 3) / 4) || (...( char *) == 0) ? (ap).__va_stk : (ap).__va_reg) + ((ap).__va_arg - ((sizeof( char *) + 3) / 4) ))))) ;
fprintf ( (&_iob[2]) , "%s: ", programname);
vfprintf ( (&_iob[2]) , format, ap);
;
fprintf ( (&_iob[2]) , "\n");
}
# 1865 "gcc.c"
void
validate_all_switches ()
{
struct compiler *comp;
register char *p;
register char c;
for (comp = compilers; comp->spec; comp++)
{
p = comp->spec;
while (c = *p++)
if (c == '%' && *p == '{')
validate_switches (p + 1);
}
p = link_spec;
while (c = *p++)
if (c == '%' && *p == '{')
validate_switches (p + 1);
}
void
validate_switches (start)
char *start;
{
register char *p = start;
char *filter;
register int i;
if (*p == '|')
++p;
if (*p == '!')
++p;
filter = p;
while (*p != ':' && *p != '}') p++;
if (p[-1] == '*')
{
--p;
for (i = 0; i < n_switches; i++)
if (!strncmp (switches[i].part1, filter, p - filter))
switches[i].valid = 1;
}
else
{
for (i = 0; i < n_switches; i++)
{
if (!strncmp (switches[i].part1, filter, p - filter)
&& switches[i].part1[p - filter] == 0)
switches[i].valid = 1;
}
}
}
Technical Details
Message-ID:
<8910182109.AA28772@huey.matrix.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!MCNC.ORG!matrx!huey!cindyShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!MCNC.ORG!matrx!huey!cindy From: matrx!huey!cindy@MCNC.ORG (Cindy Miller) Newsgroups: gnu.gcc.bug Subject: (none) Message-ID: <8910182109.AA28772@huey.matrix.com> Date: 18 Oct 89 21:09:50 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 6387