mirror of
https://github.com/pret/agbcc.git
synced 2026-08-27 13:04:07 -05:00
remove VMS stuff
This commit is contained in:
617
gcc/cccp.c
617
gcc/cccp.c
@@ -64,25 +64,6 @@ typedef unsigned char U_CHAR;
|
||||
# define OBJECT_SUFFIX ".o"
|
||||
#endif
|
||||
|
||||
/* VMS-specific definitions */
|
||||
#ifdef VMS
|
||||
#include <descrip.h>
|
||||
#include <ssdef.h>
|
||||
#include <syidef.h>
|
||||
#define open(fname,mode,prot) VMS_open (fname,mode,prot)
|
||||
#define fopen(fname,mode) VMS_fopen (fname,mode)
|
||||
#define freopen(fname,mode,ofile) VMS_freopen (fname,mode,ofile)
|
||||
#define fstat(fd,stbuf) VMS_fstat (fd,stbuf)
|
||||
static int VMS_fstat (), VMS_stat ();
|
||||
static int VMS_open ();
|
||||
static FILE *VMS_fopen ();
|
||||
static FILE *VMS_freopen ();
|
||||
static int hack_vms_include_specification ();
|
||||
#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a)))
|
||||
#define INO_T_HASH(a) 0
|
||||
#define INCLUDE_LEN_FUDGE 12 /* leave room for VMS syntax conversion */
|
||||
#endif /* VMS */
|
||||
|
||||
/* Windows does not natively support inodes, and neither does MSDOS. */
|
||||
#if (defined (_WIN32) && ! defined (__CYGWIN__)) || defined (__MSDOS__)
|
||||
#define INO_T_EQ(a, b) 0
|
||||
@@ -1285,21 +1266,6 @@ main (argc, argv)
|
||||
|
||||
progname = base_name (argv[0]);
|
||||
|
||||
#ifdef VMS
|
||||
{
|
||||
/* Remove extension from PROGNAME. */
|
||||
char *p;
|
||||
char *s = progname = savestring (progname);
|
||||
|
||||
if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */
|
||||
if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */
|
||||
&& (p[1] == 'e' || p[1] == 'E')
|
||||
&& (p[2] == 'x' || p[2] == 'X')
|
||||
&& (p[3] == 'e' || p[3] == 'E')
|
||||
&& !p[4])
|
||||
*p = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
in_fname = NULL;
|
||||
out_fname = NULL;
|
||||
@@ -1823,61 +1789,6 @@ main (argc, argv)
|
||||
if (!inhibit_predefs) {
|
||||
char *p = (char *) alloca (strlen (predefs) + 1);
|
||||
|
||||
#ifdef VMS
|
||||
struct dsc$descriptor_s lcl_name;
|
||||
struct item_list {
|
||||
unsigned short length; /* input length */
|
||||
unsigned short code; /* item code */
|
||||
unsigned long dptr; /* data ptr */
|
||||
unsigned long lptr; /* output length ptr */
|
||||
};
|
||||
|
||||
unsigned long syi_length;
|
||||
char syi_data[16];
|
||||
|
||||
struct item_list items[] = {
|
||||
{ 16, SYI$_VERSION, 0, 0 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
items[0].dptr = (unsigned long)syi_data;
|
||||
items[0].lptr = (unsigned long)(&syi_length);
|
||||
|
||||
if (SYS$GETSYIW (0, 0, 0, items, NULL, NULL, NULL, NULL) == SS$_NORMAL)
|
||||
{
|
||||
unsigned long vms_version_value;
|
||||
char *vers;
|
||||
|
||||
vers = syi_data;
|
||||
vms_version_value = 0;
|
||||
|
||||
if (*vers == 'V')
|
||||
vers++;
|
||||
if (ISDIGIT (*vers))
|
||||
{
|
||||
vms_version_value = (*vers - '0') * 10000000;
|
||||
}
|
||||
vers++;
|
||||
if (*vers == '.')
|
||||
{
|
||||
vers++;
|
||||
if (ISDIGIT (*vers))
|
||||
{
|
||||
vms_version_value += (*vers - '0') * 100000;
|
||||
}
|
||||
}
|
||||
|
||||
if (vms_version_value > 0)
|
||||
{
|
||||
char versbuf[32];
|
||||
|
||||
sprintf (versbuf, "__VMS_VER=%08ld", vms_version_value);
|
||||
if (debug_output)
|
||||
output_line_directive (fp, &outbuf, 0, same_file);
|
||||
make_definition (versbuf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
strcpy (p, predefs);
|
||||
while (*p) {
|
||||
@@ -4592,9 +4503,6 @@ do_include (buf, limit, op, keyword)
|
||||
int retried = 0; /* Have already tried macro
|
||||
expanding the include line*/
|
||||
int angle_brackets = 0; /* 0 for "...", 1 for <...> */
|
||||
#ifdef VMS
|
||||
int vaxc_include = 0; /* 1 for token without punctuation */
|
||||
#endif
|
||||
int pcf = -1;
|
||||
char *pcfbuf;
|
||||
char *pcfbuflimit;
|
||||
@@ -4681,16 +4589,6 @@ get_filename:
|
||||
simplify_filename (dsp->fname);
|
||||
nam = base_name (dsp->fname);
|
||||
*nam = 0;
|
||||
#ifdef VMS
|
||||
/* for hack_vms_include_specification(), a local
|
||||
dir specification must start with "./" on VMS. */
|
||||
if (nam == dsp->fname)
|
||||
{
|
||||
*nam++ = '.';
|
||||
*nam++ = '/';
|
||||
*nam = 0;
|
||||
}
|
||||
#endif
|
||||
/* But for efficiency's sake, do not insert the dir
|
||||
if it matches the search list's first dir. */
|
||||
dsp->next = search_start;
|
||||
@@ -4719,28 +4617,6 @@ get_filename:
|
||||
goto fail;
|
||||
|
||||
default:
|
||||
#ifdef VMS
|
||||
/*
|
||||
* Support '#include xyz' like VAX-C to allow for easy use of all the
|
||||
* decwindow include files. It defaults to '#include <xyz.h>' (so the
|
||||
* code from case '<' is repeated here) and generates a warning.
|
||||
* (Note: macro expansion of `xyz' takes precedence.)
|
||||
*/
|
||||
/* Note: The argument of ISALPHA() can be evaluated twice, so do
|
||||
the pre-decrement outside of the macro. */
|
||||
if (retried && (--fin, ISALPHA(*(U_CHAR *) (fin)))) {
|
||||
while (fin != limit && (!ISSPACE(*fin)))
|
||||
*fend++ = *fin++;
|
||||
warning ("VAX-C-style include specification found, use '#include <filename.h>' !");
|
||||
vaxc_include = 1;
|
||||
if (fin == limit) {
|
||||
angle_brackets = 1;
|
||||
/* If -I-, start with the first -I dir after the -I-. */
|
||||
search_start = first_bracket_include;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
fail:
|
||||
if (! retried) {
|
||||
@@ -4849,38 +4725,8 @@ get_filename:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VMS
|
||||
/* Change this 1/2 Unix 1/2 VMS file specification into a
|
||||
full VMS file specification */
|
||||
if (searchptr->fname[0])
|
||||
{
|
||||
strcpy (fname, searchptr->fname);
|
||||
if (fname[strlen (fname) - 1] == ':')
|
||||
{
|
||||
char *slashp;
|
||||
slashp = strchr (fbeg, '/');
|
||||
|
||||
/* start at root-dir of logical device if no path given. */
|
||||
if (slashp == 0)
|
||||
strcat (fname, "[000000]");
|
||||
}
|
||||
strcat (fname, fbeg);
|
||||
|
||||
/* Fix up the filename */
|
||||
hack_vms_include_specification (fname, vaxc_include);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a normal VMS filespec, so use it unchanged. */
|
||||
strcpy (fname, fbeg);
|
||||
/* if it's '#include filename', add the missing .h */
|
||||
if (vaxc_include && index(fname,'.')==NULL)
|
||||
strcat (fname, ".h");
|
||||
}
|
||||
#else
|
||||
strcpy (fname, searchptr->fname);
|
||||
strcat (fname, fbeg);
|
||||
#endif /* VMS */
|
||||
f = open_include_file (fname, searchptr, importing, &inc);
|
||||
if (f != -1) {
|
||||
if (bypass_slot && searchptr != first_bracket_include) {
|
||||
@@ -4896,15 +4742,8 @@ get_filename:
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef VMS
|
||||
/* Our VMS hacks can produce invalid filespecs, so don't worry
|
||||
about errors other than EACCES. */
|
||||
if (errno == EACCES)
|
||||
break;
|
||||
#else
|
||||
if (errno != ENOENT && errno != ENOTDIR)
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5038,13 +4877,6 @@ base_name (fname)
|
||||
char *p;
|
||||
#if defined (__MSDOS__) || defined (_WIN32)
|
||||
if (ISALPHA (s[0]) && s[1] == ':') s += 2;
|
||||
#endif
|
||||
#ifdef VMS
|
||||
if ((p = rindex (s, ':'))) s = p + 1; /* Skip device. */
|
||||
if ((p = rindex (s, ']'))) s = p + 1; /* Skip directory. */
|
||||
if ((p = rindex (s, '>'))) s = p + 1; /* Skip alternate (int'n'l) dir. */
|
||||
if (s != fname)
|
||||
return s;
|
||||
#endif
|
||||
if ((p = rindex (s, '/'))) s = p + 1;
|
||||
#ifdef DIR_SEPARATOR
|
||||
@@ -5065,9 +4897,6 @@ absolute_filename (filename)
|
||||
#if defined (__CYGWIN__)
|
||||
/* At present, any path that begins with a drive spec is absolute. */
|
||||
if (ISALPHA (filename[0]) && filename[1] == ':') return 1;
|
||||
#endif
|
||||
#ifdef VMS
|
||||
if (index (filename, ':') != 0) return 1;
|
||||
#endif
|
||||
if (filename[0] == '/') return 1;
|
||||
#ifdef DIR_SEPARATOR
|
||||
@@ -5118,11 +4947,9 @@ simplify_filename (filename)
|
||||
to0 = to;
|
||||
|
||||
for (;;) {
|
||||
#ifndef VMS
|
||||
if (from[0] == '.' && from[1] == '/')
|
||||
from += 2;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* Copy this component and trailing /, if any. */
|
||||
while ((*to++ = *from++) != '/') {
|
||||
@@ -5322,13 +5149,6 @@ open_include_file (filename, searchptr, importing, pinc)
|
||||
|
||||
if (fd < 0)
|
||||
{
|
||||
#ifdef VMS
|
||||
/* if #include <dir/file> fails, try again with hacked spec. */
|
||||
if (!hack_vms_include_specification (fname, 0))
|
||||
return fd;
|
||||
fd = open (fname, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
#endif
|
||||
return fd;
|
||||
}
|
||||
|
||||
@@ -9567,22 +9387,11 @@ my_strerror (errnum)
|
||||
{
|
||||
char *result;
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
|
||||
#else
|
||||
result = strerror (errnum);
|
||||
#endif
|
||||
#else /* VMS */
|
||||
/* VAXCRTL's strerror() takes an optional second argument, which only
|
||||
matters when the first argument is EVMSERR. However, it's simplest
|
||||
just to pass it unconditionally. `vaxc$errno' is declared in
|
||||
<errno.h>, and maintained by the library in parallel with `errno'.
|
||||
We assume that caller's `errnum' either matches the last setting of
|
||||
`errno' by the library or else does not have the value `EVMSERR'. */
|
||||
|
||||
result = strerror (errnum, vaxc$errno);
|
||||
#endif
|
||||
|
||||
if (!result)
|
||||
result = "undocumented I/O error";
|
||||
@@ -10717,12 +10526,7 @@ new_include_prefix (prev_file_name, component, prefix, name)
|
||||
if (len == 1 && dir->fname[len - 1] == '.')
|
||||
len = 0;
|
||||
else
|
||||
#ifdef VMS
|
||||
/* must be '/', hack_vms_include_specification triggers on it. */
|
||||
dir->fname[len++] = '/';
|
||||
#else
|
||||
dir->fname[len++] = DIR_SEPARATOR;
|
||||
#endif
|
||||
dir->fname[len] = 0;
|
||||
}
|
||||
|
||||
@@ -10735,9 +10539,6 @@ new_include_prefix (prev_file_name, component, prefix, name)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef VMS
|
||||
/* VMS can't stat dir prefixes, so skip these optimizations in VMS. */
|
||||
|
||||
/* Add a trailing "." if there is a filename. This increases the number
|
||||
of systems that can stat directories. We remove it below. */
|
||||
if (len != 0)
|
||||
@@ -10767,7 +10568,6 @@ new_include_prefix (prev_file_name, component, prefix, name)
|
||||
free (dir);
|
||||
return 0;
|
||||
}
|
||||
#endif /* ! VMS */
|
||||
|
||||
dir->next = 0;
|
||||
dir->c_system_include_path = 0;
|
||||
@@ -10964,11 +10764,7 @@ pfatal_with_name (name)
|
||||
char *name;
|
||||
{
|
||||
perror_with_name (name);
|
||||
#ifdef VMS
|
||||
exit (vaxc$errno);
|
||||
#else
|
||||
exit (FATAL_EXIT_CODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Handler for SIGPIPE. */
|
||||
@@ -11034,417 +10830,4 @@ savestring (input)
|
||||
return output;
|
||||
}
|
||||
|
||||
#ifdef VMS
|
||||
|
||||
/* Under VMS we need to fix up the "include" specification filename.
|
||||
|
||||
Rules for possible conversions
|
||||
|
||||
fullname tried paths
|
||||
|
||||
name name
|
||||
./dir/name [.dir]name
|
||||
/dir/name dir:name
|
||||
/name [000000]name, name
|
||||
dir/name dir:[000000]name, dir:name, dir/name
|
||||
dir1/dir2/name dir1:[dir2]name, dir1:[000000.dir2]name
|
||||
path:/name path:[000000]name, path:name
|
||||
path:/dir/name path:[000000.dir]name, path:[dir]name
|
||||
path:dir/name path:[dir]name
|
||||
[path]:[dir]name [path.dir]name
|
||||
path/[dir]name [path.dir]name
|
||||
|
||||
The path:/name input is constructed when expanding <> includes.
|
||||
|
||||
return 1 if name was changed, 0 else. */
|
||||
|
||||
static int
|
||||
hack_vms_include_specification (fullname, vaxc_include)
|
||||
char *fullname;
|
||||
int vaxc_include;
|
||||
{
|
||||
register char *basename, *unixname, *local_ptr, *first_slash;
|
||||
int f, check_filename_before_returning, must_revert;
|
||||
char Local[512];
|
||||
|
||||
check_filename_before_returning = 0;
|
||||
must_revert = 0;
|
||||
/* See if we can find a 1st slash. If not, there's no path information. */
|
||||
first_slash = index (fullname, '/');
|
||||
if (first_slash == 0)
|
||||
return 0; /* Nothing to do!!! */
|
||||
|
||||
/* construct device spec if none given. */
|
||||
|
||||
if (index (fullname, ':') == 0)
|
||||
{
|
||||
|
||||
/* If fullname has a slash, take it as device spec. */
|
||||
|
||||
if (first_slash == fullname)
|
||||
{
|
||||
first_slash = index (fullname+1, '/'); /* 2nd slash ? */
|
||||
if (first_slash)
|
||||
*first_slash = ':'; /* make device spec */
|
||||
for (basename = fullname; *basename != 0; basename++)
|
||||
*basename = *(basename+1); /* remove leading slash */
|
||||
}
|
||||
else if ((first_slash[-1] != '.') /* keep ':/', './' */
|
||||
&& (first_slash[-1] != ':')
|
||||
&& (first_slash[-1] != ']')) /* or a vms path */
|
||||
{
|
||||
*first_slash = ':';
|
||||
}
|
||||
else if ((first_slash[1] == '[') /* skip './' in './[dir' */
|
||||
&& (first_slash[-1] == '.'))
|
||||
fullname += 2;
|
||||
}
|
||||
|
||||
/* Get part after first ':' (basename[-1] == ':')
|
||||
or last '/' (basename[-1] == '/'). */
|
||||
|
||||
basename = base_name (fullname);
|
||||
|
||||
/*
|
||||
* Check if we have a vax-c style '#include filename'
|
||||
* and add the missing .h
|
||||
*/
|
||||
|
||||
if (vaxc_include && !index (basename,'.'))
|
||||
strcat (basename, ".h");
|
||||
|
||||
local_ptr = Local; /* initialize */
|
||||
|
||||
/* We are trying to do a number of things here. First of all, we are
|
||||
trying to hammer the filenames into a standard format, such that later
|
||||
processing can handle them.
|
||||
|
||||
If the file name contains something like [dir.], then it recognizes this
|
||||
as a root, and strips the ".]". Later processing will add whatever is
|
||||
needed to get things working properly.
|
||||
|
||||
If no device is specified, then the first directory name is taken to be
|
||||
a device name (or a rooted logical). */
|
||||
|
||||
/* Point to the UNIX filename part (which needs to be fixed!)
|
||||
but skip vms path information.
|
||||
[basename != fullname since first_slash != 0]. */
|
||||
|
||||
if ((basename[-1] == ':') /* vms path spec. */
|
||||
|| (basename[-1] == ']')
|
||||
|| (basename[-1] == '>'))
|
||||
unixname = basename;
|
||||
else
|
||||
unixname = fullname;
|
||||
|
||||
if (*unixname == '/')
|
||||
unixname++;
|
||||
|
||||
/* If the directory spec is not rooted, we can just copy
|
||||
the UNIX filename part and we are done. */
|
||||
|
||||
if (((basename - fullname) > 1)
|
||||
&& ( (basename[-1] == ']')
|
||||
|| (basename[-1] == '>')))
|
||||
{
|
||||
if (basename[-2] != '.')
|
||||
{
|
||||
|
||||
/* The VMS part ends in a `]', and the preceding character is not a `.'.
|
||||
-> PATH]:/name (basename = '/name', unixname = 'name')
|
||||
We strip the `]', and then splice the two parts of the name in the
|
||||
usual way. Given the default locations for include files in cccp.c,
|
||||
we will only use this code if the user specifies alternate locations
|
||||
with the /include (-I) switch on the command line. */
|
||||
|
||||
basename -= 1; /* Strip "]" */
|
||||
unixname--; /* backspace */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* The VMS part has a ".]" at the end, and this will not do. Later
|
||||
processing will add a second directory spec, and this would be a syntax
|
||||
error. Thus we strip the ".]", and thus merge the directory specs.
|
||||
We also backspace unixname, so that it points to a '/'. This inhibits the
|
||||
generation of the 000000 root directory spec (which does not belong here
|
||||
in this case). */
|
||||
|
||||
basename -= 2; /* Strip ".]" */
|
||||
unixname--; /* backspace */
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
/* We drop in here if there is no VMS style directory specification yet.
|
||||
If there is no device specification either, we make the first dir a
|
||||
device and try that. If we do not do this, then we will be essentially
|
||||
searching the users default directory (as if they did a #include "asdf.h").
|
||||
|
||||
Then all we need to do is to push a '[' into the output string. Later
|
||||
processing will fill this in, and close the bracket. */
|
||||
|
||||
if ((unixname != fullname) /* vms path spec found. */
|
||||
&& (basename[-1] != ':'))
|
||||
*local_ptr++ = ':'; /* dev not in spec. take first dir */
|
||||
|
||||
*local_ptr++ = '['; /* Open the directory specification */
|
||||
}
|
||||
|
||||
if (unixname == fullname) /* no vms dir spec. */
|
||||
{
|
||||
must_revert = 1;
|
||||
if ((first_slash != 0) /* unix dir spec. */
|
||||
&& (*unixname != '/') /* not beginning with '/' */
|
||||
&& (*unixname != '.')) /* or './' or '../' */
|
||||
*local_ptr++ = '.'; /* dir is local ! */
|
||||
}
|
||||
|
||||
/* at this point we assume that we have the device spec, and (at least
|
||||
the opening "[" for a directory specification. We may have directories
|
||||
specified already.
|
||||
|
||||
If there are no other slashes then the filename will be
|
||||
in the "root" directory. Otherwise, we need to add
|
||||
directory specifications. */
|
||||
|
||||
if (index (unixname, '/') == 0)
|
||||
{
|
||||
/* if no directories specified yet and none are following. */
|
||||
if (local_ptr[-1] == '[')
|
||||
{
|
||||
/* Just add "000000]" as the directory string */
|
||||
strcpy (local_ptr, "000000]");
|
||||
local_ptr += strlen (local_ptr);
|
||||
check_filename_before_returning = 1; /* we might need to fool with this later */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* As long as there are still subdirectories to add, do them. */
|
||||
while (index (unixname, '/') != 0)
|
||||
{
|
||||
/* If this token is "." we can ignore it
|
||||
if it's not at the beginning of a path. */
|
||||
if ((unixname[0] == '.') && (unixname[1] == '/'))
|
||||
{
|
||||
/* remove it at beginning of path. */
|
||||
if ( ((unixname == fullname) /* no device spec */
|
||||
&& (fullname+2 != basename)) /* starts with ./ */
|
||||
/* or */
|
||||
|| ((basename[-1] == ':') /* device spec */
|
||||
&& (unixname-1 == basename))) /* and ./ afterwards */
|
||||
*local_ptr++ = '.'; /* make '[.' start of path. */
|
||||
unixname += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add a subdirectory spec. Do not duplicate "." */
|
||||
if ( local_ptr[-1] != '.'
|
||||
&& local_ptr[-1] != '['
|
||||
&& local_ptr[-1] != '<')
|
||||
*local_ptr++ = '.';
|
||||
|
||||
/* If this is ".." then the spec becomes "-" */
|
||||
if ( (unixname[0] == '.')
|
||||
&& (unixname[1] == '.')
|
||||
&& (unixname[2] == '/'))
|
||||
{
|
||||
/* Add "-" and skip the ".." */
|
||||
if ((local_ptr[-1] == '.')
|
||||
&& (local_ptr[-2] == '['))
|
||||
local_ptr--; /* prevent [.- */
|
||||
*local_ptr++ = '-';
|
||||
unixname += 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Copy the subdirectory */
|
||||
while (*unixname != '/')
|
||||
*local_ptr++= *unixname++;
|
||||
|
||||
unixname++; /* Skip the "/" */
|
||||
}
|
||||
|
||||
/* Close the directory specification */
|
||||
if (local_ptr[-1] == '.') /* no trailing periods */
|
||||
local_ptr--;
|
||||
|
||||
if (local_ptr[-1] == '[') /* no dir needed */
|
||||
local_ptr--;
|
||||
else
|
||||
*local_ptr++ = ']';
|
||||
}
|
||||
|
||||
/* Now add the filename. */
|
||||
|
||||
while (*unixname)
|
||||
*local_ptr++ = *unixname++;
|
||||
*local_ptr = 0;
|
||||
|
||||
/* Now append it to the original VMS spec. */
|
||||
|
||||
strcpy ((must_revert==1)?fullname:basename, Local);
|
||||
|
||||
/* If we put a [000000] in the filename, try to open it first. If this fails,
|
||||
remove the [000000], and return that name. This provides flexibility
|
||||
to the user in that they can use both rooted and non-rooted logical names
|
||||
to point to the location of the file. */
|
||||
|
||||
if (check_filename_before_returning)
|
||||
{
|
||||
f = open (fullname, O_RDONLY, 0666);
|
||||
if (f >= 0)
|
||||
{
|
||||
/* The file name is OK as it is, so return it as is. */
|
||||
close (f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The filename did not work. Try to remove the [000000] from the name,
|
||||
and return it. */
|
||||
|
||||
basename = index (fullname, '[');
|
||||
local_ptr = index (fullname, ']') + 1;
|
||||
strcpy (basename, local_ptr); /* this gets rid of it */
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* VMS */
|
||||
|
||||
#ifdef VMS
|
||||
|
||||
/* The following wrapper functions supply additional arguments to the VMS
|
||||
I/O routines to optimize performance with file handling. The arguments
|
||||
are:
|
||||
"mbc=16" - Set multi-block count to 16 (use a 8192 byte buffer).
|
||||
"deq=64" - When extending the file, extend it in chunks of 32Kbytes.
|
||||
"fop=tef"- Truncate unused portions of file when closing file.
|
||||
"shr=nil"- Disallow file sharing while file is open. */
|
||||
|
||||
static FILE *
|
||||
VMS_freopen (fname, type, oldfile)
|
||||
char *fname;
|
||||
char *type;
|
||||
FILE *oldfile;
|
||||
{
|
||||
#undef freopen /* Get back the real freopen routine. */
|
||||
if (strcmp (type, "w") == 0)
|
||||
return freopen (fname, type, oldfile,
|
||||
"mbc=16", "deq=64", "fop=tef", "shr=nil");
|
||||
return freopen (fname, type, oldfile, "mbc=16");
|
||||
}
|
||||
|
||||
static FILE *
|
||||
VMS_fopen (fname, type)
|
||||
char *fname;
|
||||
char *type;
|
||||
{
|
||||
#undef fopen /* Get back the real fopen routine. */
|
||||
/* The gcc-vms-1.42 distribution's header files prototype fopen with two
|
||||
fixed arguments, which matches ANSI's specification but not VAXCRTL's
|
||||
pre-ANSI implementation. This hack circumvents the mismatch problem. */
|
||||
FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
|
||||
|
||||
if (*type == 'w')
|
||||
return (*vmslib_fopen) (fname, type, "mbc=32",
|
||||
"deq=64", "fop=tef", "shr=nil");
|
||||
else
|
||||
return (*vmslib_fopen) (fname, type, "mbc=32");
|
||||
}
|
||||
|
||||
static int
|
||||
VMS_open (fname, flags, prot)
|
||||
char *fname;
|
||||
int flags;
|
||||
int prot;
|
||||
{
|
||||
#undef open /* Get back the real open routine. */
|
||||
return open (fname, flags, prot, "mbc=16", "deq=64", "fop=tef");
|
||||
}
|
||||
|
||||
/* more VMS hackery */
|
||||
#include <fab.h>
|
||||
#include <nam.h>
|
||||
|
||||
extern unsigned long SYS$PARSE(), SYS$SEARCH();
|
||||
|
||||
/* Work around another library bug. If a file is located via a searchlist,
|
||||
and if the device it's on is not the same device as the one specified
|
||||
in the first element of that searchlist, then both stat() and fstat()
|
||||
will fail to return info about it. `errno' will be set to EVMSERR, and
|
||||
`vaxc$errno' will be set to SS$_NORMAL due yet another bug in stat()!
|
||||
We can get around this by fully parsing the filename and then passing
|
||||
that absolute name to stat().
|
||||
|
||||
Without this fix, we can end up failing to find header files, which is
|
||||
bad enough, but then compounding the problem by reporting the reason for
|
||||
failure as "normal successful completion." */
|
||||
|
||||
#undef fstat /* Get back to the library version. */
|
||||
|
||||
static int
|
||||
VMS_fstat (fd, statbuf)
|
||||
int fd;
|
||||
struct stat *statbuf;
|
||||
{
|
||||
int result = fstat (fd, statbuf);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
FILE *fp;
|
||||
char nambuf[NAM$C_MAXRSS+1];
|
||||
|
||||
if ((fp = fdopen (fd, "r")) != 0 && fgetname (fp, nambuf) != 0)
|
||||
result = VMS_stat (nambuf, statbuf);
|
||||
/* No fclose(fp) here; that would close(fd) as well. */
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
VMS_stat (name, statbuf)
|
||||
const char *name;
|
||||
struct stat *statbuf;
|
||||
{
|
||||
int result = stat (name, statbuf);
|
||||
|
||||
if (result < 0)
|
||||
{
|
||||
struct FAB fab;
|
||||
struct NAM nam;
|
||||
char exp_nam[NAM$C_MAXRSS+1], /* expanded name buffer for SYS$PARSE */
|
||||
res_nam[NAM$C_MAXRSS+1]; /* resultant name buffer for SYS$SEARCH */
|
||||
|
||||
fab = cc$rms_fab;
|
||||
fab.fab$l_fna = (char *) name;
|
||||
fab.fab$b_fns = (unsigned char) strlen (name);
|
||||
fab.fab$l_nam = (void *) &nam;
|
||||
nam = cc$rms_nam;
|
||||
nam.nam$l_esa = exp_nam, nam.nam$b_ess = sizeof exp_nam - 1;
|
||||
nam.nam$l_rsa = res_nam, nam.nam$b_rss = sizeof res_nam - 1;
|
||||
nam.nam$b_nop = NAM$M_PWD | NAM$M_NOCONCEAL;
|
||||
if (SYS$PARSE (&fab) & 1)
|
||||
{
|
||||
if (SYS$SEARCH (&fab) & 1)
|
||||
{
|
||||
res_nam[nam.nam$b_rsl] = '\0';
|
||||
result = stat (res_nam, statbuf);
|
||||
}
|
||||
/* Clean up searchlist context cached by the system. */
|
||||
nam.nam$b_nop = NAM$M_SYNCHK;
|
||||
fab.fab$l_fna = 0, fab.fab$b_fns = 0;
|
||||
(void) SYS$PARSE (&fab);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* VMS */
|
||||
|
||||
@@ -163,9 +163,5 @@ cpp_pfatal_with_name (pfile, name)
|
||||
const char *name;
|
||||
{
|
||||
cpp_perror_with_name (pfile, name);
|
||||
#ifdef VMS
|
||||
exit (vaxc$errno);
|
||||
#else
|
||||
exit (FATAL_EXIT_CODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
287
gcc/cppfiles.c
287
gcc/cppfiles.c
@@ -48,15 +48,8 @@ static long safe_read PROTO ((int, char *, int));
|
||||
static void simplify_pathname PROTO ((char *));
|
||||
static struct file_name_list *actual_directory PROTO ((cpp_reader *, char *));
|
||||
|
||||
#if 0
|
||||
static void hack_vms_include_specification PROTO ((char *));
|
||||
#endif
|
||||
|
||||
/* Windows does not natively support inodes, and neither does MSDOS.
|
||||
VMS has non-numeric inodes. */
|
||||
#ifdef VMS
|
||||
#define INO_T_EQ(a, b) (!bcmp((char *) &(a), (char *) &(b), sizeof (a)))
|
||||
#elif (defined _WIN32 && !defined CYGWIN) || defined __MSDOS__
|
||||
/* Windows does not natively support inodes, and neither does MSDOS. */
|
||||
#if (defined _WIN32 && !defined CYGWIN) || defined __MSDOS__
|
||||
#define INO_T_EQ(a, b) 0
|
||||
#else
|
||||
#define INO_T_EQ(a, b) ((a) == (b))
|
||||
@@ -1070,279 +1063,3 @@ simplify_pathname (path)
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* It is not clear when this should be used if at all, so I've
|
||||
disabled it until someone who understands VMS can look at it. */
|
||||
#if 0
|
||||
|
||||
/* Under VMS we need to fix up the "include" specification filename.
|
||||
|
||||
Rules for possible conversions
|
||||
|
||||
fullname tried paths
|
||||
|
||||
name name
|
||||
./dir/name [.dir]name
|
||||
/dir/name dir:name
|
||||
/name [000000]name, name
|
||||
dir/name dir:[000000]name, dir:name, dir/name
|
||||
dir1/dir2/name dir1:[dir2]name, dir1:[000000.dir2]name
|
||||
path:/name path:[000000]name, path:name
|
||||
path:/dir/name path:[000000.dir]name, path:[dir]name
|
||||
path:dir/name path:[dir]name
|
||||
[path]:[dir]name [path.dir]name
|
||||
path/[dir]name [path.dir]name
|
||||
|
||||
The path:/name input is constructed when expanding <> includes. */
|
||||
|
||||
|
||||
static void
|
||||
hack_vms_include_specification (fullname)
|
||||
char *fullname;
|
||||
{
|
||||
register char *basename, *unixname, *local_ptr, *first_slash;
|
||||
int f, check_filename_before_returning, must_revert;
|
||||
char Local[512];
|
||||
|
||||
check_filename_before_returning = 0;
|
||||
must_revert = 0;
|
||||
/* See if we can find a 1st slash. If not, there's no path information. */
|
||||
first_slash = index (fullname, '/');
|
||||
if (first_slash == 0)
|
||||
return 0; /* Nothing to do!!! */
|
||||
|
||||
/* construct device spec if none given. */
|
||||
|
||||
if (index (fullname, ':') == 0)
|
||||
{
|
||||
|
||||
/* If fullname has a slash, take it as device spec. */
|
||||
|
||||
if (first_slash == fullname)
|
||||
{
|
||||
first_slash = index (fullname+1, '/'); /* 2nd slash ? */
|
||||
if (first_slash)
|
||||
*first_slash = ':'; /* make device spec */
|
||||
for (basename = fullname; *basename != 0; basename++)
|
||||
*basename = *(basename+1); /* remove leading slash */
|
||||
}
|
||||
else if ((first_slash[-1] != '.') /* keep ':/', './' */
|
||||
&& (first_slash[-1] != ':')
|
||||
&& (first_slash[-1] != ']')) /* or a vms path */
|
||||
{
|
||||
*first_slash = ':';
|
||||
}
|
||||
else if ((first_slash[1] == '[') /* skip './' in './[dir' */
|
||||
&& (first_slash[-1] == '.'))
|
||||
fullname += 2;
|
||||
}
|
||||
|
||||
/* Get part after first ':' (basename[-1] == ':')
|
||||
or last '/' (basename[-1] == '/'). */
|
||||
|
||||
basename = base_name (fullname);
|
||||
|
||||
local_ptr = Local; /* initialize */
|
||||
|
||||
/* We are trying to do a number of things here. First of all, we are
|
||||
trying to hammer the filenames into a standard format, such that later
|
||||
processing can handle them.
|
||||
|
||||
If the file name contains something like [dir.], then it recognizes this
|
||||
as a root, and strips the ".]". Later processing will add whatever is
|
||||
needed to get things working properly.
|
||||
|
||||
If no device is specified, then the first directory name is taken to be
|
||||
a device name (or a rooted logical). */
|
||||
|
||||
/* Point to the UNIX filename part (which needs to be fixed!)
|
||||
but skip vms path information.
|
||||
[basename != fullname since first_slash != 0]. */
|
||||
|
||||
if ((basename[-1] == ':') /* vms path spec. */
|
||||
|| (basename[-1] == ']')
|
||||
|| (basename[-1] == '>'))
|
||||
unixname = basename;
|
||||
else
|
||||
unixname = fullname;
|
||||
|
||||
if (*unixname == '/')
|
||||
unixname++;
|
||||
|
||||
/* If the directory spec is not rooted, we can just copy
|
||||
the UNIX filename part and we are done. */
|
||||
|
||||
if (((basename - fullname) > 1)
|
||||
&& ( (basename[-1] == ']')
|
||||
|| (basename[-1] == '>')))
|
||||
{
|
||||
if (basename[-2] != '.')
|
||||
{
|
||||
|
||||
/* The VMS part ends in a `]', and the preceding character is not a `.'.
|
||||
-> PATH]:/name (basename = '/name', unixname = 'name')
|
||||
We strip the `]', and then splice the two parts of the name in the
|
||||
usual way. Given the default locations for include files in cccp.c,
|
||||
we will only use this code if the user specifies alternate locations
|
||||
with the /include (-I) switch on the command line. */
|
||||
|
||||
basename -= 1; /* Strip "]" */
|
||||
unixname--; /* backspace */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* The VMS part has a ".]" at the end, and this will not do. Later
|
||||
processing will add a second directory spec, and this would be a syntax
|
||||
error. Thus we strip the ".]", and thus merge the directory specs.
|
||||
We also backspace unixname, so that it points to a '/'. This inhibits the
|
||||
generation of the 000000 root directory spec (which does not belong here
|
||||
in this case). */
|
||||
|
||||
basename -= 2; /* Strip ".]" */
|
||||
unixname--; /* backspace */
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
||||
{
|
||||
|
||||
/* We drop in here if there is no VMS style directory specification yet.
|
||||
If there is no device specification either, we make the first dir a
|
||||
device and try that. If we do not do this, then we will be essentially
|
||||
searching the users default directory (as if they did a #include "asdf.h").
|
||||
|
||||
Then all we need to do is to push a '[' into the output string. Later
|
||||
processing will fill this in, and close the bracket. */
|
||||
|
||||
if ((unixname != fullname) /* vms path spec found. */
|
||||
&& (basename[-1] != ':'))
|
||||
*local_ptr++ = ':'; /* dev not in spec. take first dir */
|
||||
|
||||
*local_ptr++ = '['; /* Open the directory specification */
|
||||
}
|
||||
|
||||
if (unixname == fullname) /* no vms dir spec. */
|
||||
{
|
||||
must_revert = 1;
|
||||
if ((first_slash != 0) /* unix dir spec. */
|
||||
&& (*unixname != '/') /* not beginning with '/' */
|
||||
&& (*unixname != '.')) /* or './' or '../' */
|
||||
*local_ptr++ = '.'; /* dir is local ! */
|
||||
}
|
||||
|
||||
/* at this point we assume that we have the device spec, and (at least
|
||||
the opening "[" for a directory specification. We may have directories
|
||||
specified already.
|
||||
|
||||
If there are no other slashes then the filename will be
|
||||
in the "root" directory. Otherwise, we need to add
|
||||
directory specifications. */
|
||||
|
||||
if (index (unixname, '/') == 0)
|
||||
{
|
||||
/* if no directories specified yet and none are following. */
|
||||
if (local_ptr[-1] == '[')
|
||||
{
|
||||
/* Just add "000000]" as the directory string */
|
||||
strcpy (local_ptr, "000000]");
|
||||
local_ptr += strlen (local_ptr);
|
||||
check_filename_before_returning = 1; /* we might need to fool with this later */
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* As long as there are still subdirectories to add, do them. */
|
||||
while (index (unixname, '/') != 0)
|
||||
{
|
||||
/* If this token is "." we can ignore it
|
||||
if it's not at the beginning of a path. */
|
||||
if ((unixname[0] == '.') && (unixname[1] == '/'))
|
||||
{
|
||||
/* remove it at beginning of path. */
|
||||
if ( ((unixname == fullname) /* no device spec */
|
||||
&& (fullname+2 != basename)) /* starts with ./ */
|
||||
/* or */
|
||||
|| ((basename[-1] == ':') /* device spec */
|
||||
&& (unixname-1 == basename))) /* and ./ afterwards */
|
||||
*local_ptr++ = '.'; /* make '[.' start of path. */
|
||||
unixname += 2;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add a subdirectory spec. Do not duplicate "." */
|
||||
if ( local_ptr[-1] != '.'
|
||||
&& local_ptr[-1] != '['
|
||||
&& local_ptr[-1] != '<')
|
||||
*local_ptr++ = '.';
|
||||
|
||||
/* If this is ".." then the spec becomes "-" */
|
||||
if ( (unixname[0] == '.')
|
||||
&& (unixname[1] == '.')
|
||||
&& (unixname[2] == '/'))
|
||||
{
|
||||
/* Add "-" and skip the ".." */
|
||||
if ((local_ptr[-1] == '.')
|
||||
&& (local_ptr[-2] == '['))
|
||||
local_ptr--; /* prevent [.- */
|
||||
*local_ptr++ = '-';
|
||||
unixname += 3;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Copy the subdirectory */
|
||||
while (*unixname != '/')
|
||||
*local_ptr++= *unixname++;
|
||||
|
||||
unixname++; /* Skip the "/" */
|
||||
}
|
||||
|
||||
/* Close the directory specification */
|
||||
if (local_ptr[-1] == '.') /* no trailing periods */
|
||||
local_ptr--;
|
||||
|
||||
if (local_ptr[-1] == '[') /* no dir needed */
|
||||
local_ptr--;
|
||||
else
|
||||
*local_ptr++ = ']';
|
||||
}
|
||||
|
||||
/* Now add the filename. */
|
||||
|
||||
while (*unixname)
|
||||
*local_ptr++ = *unixname++;
|
||||
*local_ptr = 0;
|
||||
|
||||
/* Now append it to the original VMS spec. */
|
||||
|
||||
strcpy ((must_revert==1)?fullname:basename, Local);
|
||||
|
||||
/* If we put a [000000] in the filename, try to open it first. If this fails,
|
||||
remove the [000000], and return that name. This provides flexibility
|
||||
to the user in that they can use both rooted and non-rooted logical names
|
||||
to point to the location of the file. */
|
||||
|
||||
if (check_filename_before_returning)
|
||||
{
|
||||
f = open (fullname, O_RDONLY, 0666);
|
||||
if (f >= 0)
|
||||
{
|
||||
/* The file name is OK as it is, so return it as is. */
|
||||
close (f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* The filename did not work. Try to remove the [000000] from the name,
|
||||
and return it. */
|
||||
|
||||
basename = index (fullname, '[');
|
||||
local_ptr = index (fullname, ']') + 1;
|
||||
strcpy (basename, local_ptr); /* this gets rid of it */
|
||||
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
#endif /* VMS */
|
||||
|
||||
33
gcc/cpplib.c
33
gcc/cpplib.c
@@ -2942,24 +2942,6 @@ do_include (pfile, keyword)
|
||||
if (fbeg[-1] == '<')
|
||||
angle_brackets = 1;
|
||||
}
|
||||
#ifdef VMS
|
||||
else if (token == CPP_NAME)
|
||||
{
|
||||
/* Support '#include xyz' like VAX-C to allow for easy use of
|
||||
* all the decwindow include files. It defaults to '#include
|
||||
* <xyz.h>' and generates a warning. */
|
||||
cpp_warning (pfile,
|
||||
"VAX-C-style include specification found, use '#include <filename.h>' !");
|
||||
angle_brackets = 1;
|
||||
|
||||
/* Append the missing `.h' to the name. */
|
||||
CPP_PUTS (pfile, ".h", 3)
|
||||
CPP_NUL_TERMINATE_Q (pfile);
|
||||
|
||||
fbeg = pfile->token_buffer + old_written;
|
||||
fend = CPP_PWRITTEN (pfile);
|
||||
}
|
||||
#endif
|
||||
else
|
||||
{
|
||||
cpp_error (pfile,
|
||||
@@ -5105,11 +5087,7 @@ cpp_start_read (pfile, fname)
|
||||
}
|
||||
|
||||
/* Supply our own suffix. */
|
||||
#ifndef VMS
|
||||
strcpy (q, ".o");
|
||||
#else
|
||||
strcpy (q, ".obj");
|
||||
#endif
|
||||
|
||||
deps_output (pfile, p, ':');
|
||||
deps_output (pfile, opts->in_fname, ' ');
|
||||
@@ -6515,22 +6493,11 @@ my_strerror (errnum)
|
||||
{
|
||||
char *result;
|
||||
|
||||
#ifndef VMS
|
||||
#ifndef HAVE_STRERROR
|
||||
result = (char *) ((errnum < sys_nerr) ? sys_errlist[errnum] : 0);
|
||||
#else
|
||||
result = strerror (errnum);
|
||||
#endif
|
||||
#else /* VMS */
|
||||
/* VAXCRTL's strerror() takes an optional second argument, which only
|
||||
matters when the first argument is EVMSERR. However, it's simplest
|
||||
just to pass it unconditionally. `vaxc$errno' is declared in
|
||||
<errno.h>, and maintained by the library in parallel with `errno'.
|
||||
We assume that caller's `errnum' either matches the last setting of
|
||||
`errno' by the library or else does not have the value `EVMSERR'. */
|
||||
|
||||
result = strerror (errnum, vaxc$errno);
|
||||
#endif
|
||||
|
||||
if (!result)
|
||||
result = "undocumented I/O error";
|
||||
|
||||
26
gcc/gcc.c
26
gcc/gcc.c
@@ -38,9 +38,6 @@ compilation is specified by a string called a "spec". */
|
||||
#include "obstack.h"
|
||||
#include "prefix.h"
|
||||
|
||||
#ifdef VMS
|
||||
#define exit __posix_exit
|
||||
#endif
|
||||
|
||||
/* By default there is no special suffix for executables. */
|
||||
#ifdef EXECUTABLE_SUFFIX
|
||||
@@ -1443,7 +1440,6 @@ static int argbuf_index;
|
||||
/* We want this on by default all the time now. */
|
||||
#define MKTEMP_EACH_FILE
|
||||
|
||||
#ifdef MKTEMP_EACH_FILE
|
||||
|
||||
extern char *make_temp_file PROTO((char *));
|
||||
|
||||
@@ -1458,7 +1454,6 @@ static struct temp_name {
|
||||
int filename_length; /* strlen (filename). */
|
||||
struct temp_name *next;
|
||||
} *temp_names;
|
||||
#endif
|
||||
|
||||
|
||||
/* Number of commands executed so far. */
|
||||
@@ -2001,7 +1996,6 @@ void
|
||||
putenv (str)
|
||||
char *str;
|
||||
{
|
||||
#ifndef VMS /* nor about VMS */
|
||||
|
||||
extern char **environ;
|
||||
char **old_environ = environ;
|
||||
@@ -2036,7 +2030,6 @@ putenv (str)
|
||||
memcpy ((char *) (environ + 1), (char *) old_environ,
|
||||
sizeof (char *) * (num_envs+1));
|
||||
|
||||
#endif /* VMS */
|
||||
}
|
||||
|
||||
#endif /* HAVE_PUTENV */
|
||||
@@ -2621,7 +2614,7 @@ execute ()
|
||||
for (n_commands = 1, i = 0; i < argbuf_index; i++)
|
||||
if (strcmp (argbuf[i], "|") == 0)
|
||||
{ /* each command. */
|
||||
#if defined (__MSDOS__) || defined (OS2) || defined (VMS)
|
||||
#if defined (__MSDOS__) || defined (OS2)
|
||||
fatal ("-pipe not supported");
|
||||
#endif
|
||||
argbuf[i] = 0; /* termination of command args. */
|
||||
@@ -4040,7 +4033,6 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef MKTEMP_EACH_FILE
|
||||
/* ??? This has a problem: the total number of
|
||||
values mktemp can return is limited.
|
||||
That matters for the names of object files.
|
||||
@@ -4093,18 +4085,6 @@ do_spec_1 (spec, inswitch, soft_matched_part)
|
||||
|
||||
obstack_grow (&obstack, t->filename, t->filename_length);
|
||||
delete_this_arg = 1;
|
||||
#else
|
||||
obstack_grow (&obstack, temp_filename, temp_filename_length);
|
||||
if (c == 'u' || c == 'U')
|
||||
{
|
||||
static int unique;
|
||||
char buff[9];
|
||||
if (c == 'u')
|
||||
unique++;
|
||||
sprintf (buff, "%d", unique);
|
||||
obstack_grow (&obstack, buff, strlen (buff));
|
||||
}
|
||||
#endif
|
||||
delete_this_arg = 1;
|
||||
}
|
||||
arg_going = 1;
|
||||
@@ -5118,10 +5098,6 @@ main (argc, argv)
|
||||
|
||||
/* Choose directory for temp files. */
|
||||
|
||||
#ifndef MKTEMP_EACH_FILE
|
||||
temp_filename = choose_temp_base ();
|
||||
temp_filename_length = strlen (temp_filename);
|
||||
#endif
|
||||
|
||||
/* Make a table of what switches there are (switches, n_switches).
|
||||
Make a table of specified input files (infiles, n_infiles).
|
||||
|
||||
403
gcc/gcc.hlp
403
gcc/gcc.hlp
@@ -1,403 +0,0 @@
|
||||
1 GCC
|
||||
|
||||
The GCC command invokes the GNU C compiler.
|
||||
|
||||
GCC file-spec
|
||||
|
||||
2 Parameters
|
||||
|
||||
file-spec
|
||||
|
||||
A C source file. If no input file extension is specified, GNU C
|
||||
assumes .C as the default extension unless the /PLUS qualifier is
|
||||
given, in which case .CC is assumed as the default extension.
|
||||
|
||||
If an extension of .CPP is given, then the source file is assumed to
|
||||
be the output of the preprocessor, and thus the preprocessor is not
|
||||
executed.
|
||||
|
||||
If an extension of .S is given, then the source file is assumed to be
|
||||
the assembly code output of the compiler, and only the assembler is
|
||||
called to generate an object file.
|
||||
|
||||
2 Qualifiers
|
||||
|
||||
GNU C command qualifiers modify the way the compiler handles the
|
||||
compilation.
|
||||
|
||||
The following is the list of available qualifiers for GNU C:
|
||||
|
||||
/CASE_HACK
|
||||
/CC1_OPTIONS=(option [,option...]])
|
||||
/DEBUG
|
||||
/DEFINE=(identifier[=definition][,...])
|
||||
/G_FLOAT
|
||||
/INCLUDE_DIRECTORY=(path [,path...]])
|
||||
/LIST[=filename]
|
||||
/MACHINE_CODE
|
||||
/OBJECT[=filename]
|
||||
/OPTIMIZE
|
||||
/PLUS
|
||||
/PROFILE[=identifier]
|
||||
/SCAN=(file[,file...])
|
||||
/SHOW[=option]
|
||||
/UNDEFINE=(identifier[,identifier,...])
|
||||
/VERBOSE
|
||||
/VERSION
|
||||
/WARNING
|
||||
|
||||
2 Linking
|
||||
|
||||
When linking programs compiled with GNU C, you should include the GNU
|
||||
C library before the VAX C library. For example,
|
||||
|
||||
LINK object-file,GNU_CC:[000000]GCCLIB/LIB,SYS$LIBRARY:VAXCRTL/LIB
|
||||
|
||||
You can also link your program with the shared VAX C library. This
|
||||
can reduce the size of the .EXE file, as well as make it smaller when
|
||||
it's running. For example,
|
||||
|
||||
$ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,SYS$INPUT/OPT
|
||||
SYS$SHARE:VAXCRTL/SHARE
|
||||
|
||||
(If you use the second example and type it in by hand, be sure to
|
||||
type ^Z after the last carriage return). A simpler alternative would
|
||||
be to place the single line:
|
||||
|
||||
SYS$SHARE:VAXCRTL/SHARE
|
||||
|
||||
into a file called VAXCRTL.OPT, and then use the link command:
|
||||
|
||||
$ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,VAXCRTL.OPT/OPT
|
||||
|
||||
If a program has been compiled with /G_FLOAT, then the linking
|
||||
instructions are slightly different. If you are linking with the
|
||||
non-shared library, then the command that you should use would be:
|
||||
|
||||
LINK object-file,GNU_CC:[000000]GCCLIB/LIB,SYS$LIBRARY:VAXCRTLG/LIB -
|
||||
,SYS$LIBRARY:VAXCRTL/LIB
|
||||
|
||||
Note that both VAXCRTL and VAXCRTLG must be linked to. If you are
|
||||
using the shared VAX C library, then you should use a command like:
|
||||
|
||||
$ LINK object-file, GNU_CC:[000000]GCCLIB/LIB,SYS$INPUT:/OPTIONS
|
||||
SYS$SHARE:VAXCRTLG/SHARE
|
||||
|
||||
In the case of the sharable library, only one library needs to be
|
||||
linked to.
|
||||
|
||||
2 /CASE_HACK
|
||||
|
||||
/[NO]CASE_HACK D=/CASE_HACK
|
||||
|
||||
Since the VMS Linker and Librarian are not case sensitive with
|
||||
respect to symbol names, a "case-hack" is appended to a symbol name
|
||||
when the symbol contains upper case characters.
|
||||
|
||||
There are cases where this is undesirable, (mainly when using certain
|
||||
applications where modules have been precompiled, perhaps in another
|
||||
language) and we want to compile without case hacking. In these
|
||||
cases the /NOCASE_HACK switch disables case hacking.
|
||||
|
||||
2 /CC1_OPTIONS
|
||||
|
||||
This specifies additional switches to the compiler itself which
|
||||
cannot be set by means of the compiler driver.
|
||||
|
||||
2 /DEBUG
|
||||
|
||||
/DEBUG includes additional information in the object file output so
|
||||
that the program can be debugged with the VAX Symbolic Debugger.
|
||||
|
||||
To use the debugger it is also necessary to link the debugger to your
|
||||
program, which is done by specifying the /DEBUG qualifier to the link
|
||||
command. With the debugger it is possible to set breakpoints,
|
||||
examine variables, and set variables to new values. See the VAX
|
||||
Symbolic Debugger manual for more information, or type "HELP" from
|
||||
the debugger prompt.
|
||||
|
||||
2 /DEFINE
|
||||
|
||||
/DEFINE=(identifier[=definition][,...])
|
||||
|
||||
/DEFINE defines a string or macro ('definition') to be substituted
|
||||
for every occurrence of a given string ('identifier') in a program.
|
||||
It is equivalent to the #define preprocessor directive.
|
||||
|
||||
All definitions and identifiers are converted to uppercase unless
|
||||
they are in quotation marks.
|
||||
|
||||
The simple form of the /DEFINE qualifier:
|
||||
|
||||
/DEFINE=vms
|
||||
|
||||
results in a definition equivalent to the preprocessor directive:
|
||||
|
||||
#define VMS 1
|
||||
|
||||
You must enclose macro definitions in quotation marks, as in this
|
||||
example:
|
||||
|
||||
/DEFINE="C(x)=((x) & 0xff)"
|
||||
|
||||
This definition is the same as the preprocessor definition:
|
||||
|
||||
#define C(x) ((x) & 0xff)
|
||||
|
||||
If more than one /DEFINE is present on the GCC command line, only the
|
||||
last /DEFINE is used.
|
||||
|
||||
If both /DEFINE and /UNDEFINE are present on a command line, /DEFINE
|
||||
is evaluated before /UNDEFINE.
|
||||
|
||||
2 /G_FLOAT
|
||||
|
||||
Instructs the compiler to use "G" floating point arithmetic instead
|
||||
of "D". The difference is that double precision has a range of
|
||||
approximately +/-0.56e-308 to +/-0.9 e+308, with approximately 15
|
||||
decimal digits precision.
|
||||
|
||||
"D" floating point has the same range as single precision floating
|
||||
point, with approximately 17 decimal digits precision.
|
||||
|
||||
If you use the /G_FLOAT qualifier, the linking instructions are
|
||||
different. See "Linking" for further details.
|
||||
|
||||
2 /LIST
|
||||
|
||||
/LIST[=list_file_name]
|
||||
|
||||
This does not generate a listing file in the usual sense, however it
|
||||
does direct the compiler to save the preprocessor output. If a file
|
||||
is not specified, then this output is written into a file with the
|
||||
same name as the source file and an extension of .CPP.
|
||||
|
||||
2 /INCLUDE_DIRECTORY
|
||||
|
||||
/INCLUDE_DIRECTORY=(path [,path...])
|
||||
|
||||
The /INCLUDE_DIRECTORY qualifier provides additional directories to
|
||||
search for user-defined include files. 'path' can be either a
|
||||
logical name or a directory specification.
|
||||
|
||||
There are two forms for specifying include files - #include
|
||||
"file-spec" and #include <file-spec>. For the #include "file-spec"
|
||||
form, the search order is:
|
||||
|
||||
1. The directory containing the source file.
|
||||
|
||||
2. The directories in the /INCLUDE qualifier (if any).
|
||||
|
||||
3. The directory (or directories) specified in the logical name
|
||||
GNU_CC_INCLUDE.
|
||||
|
||||
4. The directory (or directories) specified in the logical name
|
||||
SYS$LIBRARY.
|
||||
|
||||
For the #include <file-spec> form, the search order is:
|
||||
|
||||
1. The directories specified in the /INCLUDE qualifier (if any).
|
||||
|
||||
2. The directory (or directories) specified in the logical name
|
||||
GNU_CC_INCLUDE.
|
||||
|
||||
3. The directory (or directories) specified in the logical name
|
||||
SYS$LIBRARY.
|
||||
|
||||
2 /MACHINE_CODE
|
||||
|
||||
Tells GNU C to output the machine code generated by the compiler.
|
||||
The machine code is output to a file with the same name as the input
|
||||
file, with the extension .S. An object file is still generated,
|
||||
unless /NOOBJ is also specified.
|
||||
|
||||
2 /OBJECT
|
||||
|
||||
/OBJECT[=filename]
|
||||
/NOOBJECT
|
||||
|
||||
Controls whether or not an object file is generated by the
|
||||
compiler.
|
||||
|
||||
2 /OPTIMIZE
|
||||
|
||||
/[NO]OPTIMIZE
|
||||
|
||||
Controls whether optimization is performed by the compiler. By
|
||||
default, optimization is on. /NOOPTIMIZE turns optimization off.
|
||||
|
||||
2 /PLUS
|
||||
|
||||
Instructs the compiler driver to use the GNU-C++ compiler instead of
|
||||
the GNU-C compiler. Note that the default extension of source files
|
||||
is .CC when this qualifier is in effect.
|
||||
|
||||
2 /PROFILE
|
||||
|
||||
/PROFILE[=identifier]
|
||||
|
||||
Instructs the compiler to generate function profiling code. You must
|
||||
link your program to the profiler when you use this options. The
|
||||
profile statistics are automatically printed out on the terminal
|
||||
during image exit. (i.e. no modifications to your source file are
|
||||
required in order to use the profiler).
|
||||
|
||||
There are three identifiers that can be used with the /PROFILE
|
||||
switch. These are ALL, FUNCTION, and BLOCK. If /PROFILE is given
|
||||
without an identifier, then FUNCTION is assumed.
|
||||
|
||||
3 Block_Profiler
|
||||
|
||||
The block profiler counts how many times control of the program
|
||||
passes certain points in your program. This is useful in determining
|
||||
which portions of a program would benefit from recoding for
|
||||
optimization.
|
||||
|
||||
The report for the block profiler contains the function name, file
|
||||
name, PC, and the source file line number as well as the count of how
|
||||
many times control has passed through the specified source line.
|
||||
|
||||
3 Function_Profiler
|
||||
|
||||
The function profiler counts how many times each function is entered,
|
||||
and keeps track of how much CPU time is used within each function.
|
||||
|
||||
You should be careful about interpreting the results of profiles
|
||||
where there are inline functions. When a function is included as
|
||||
inline, then there is no call to the internal data collection routine
|
||||
used by the profiler, and thus there will be no record of this
|
||||
function being called. The compiler does generate a callable version
|
||||
of each inline function, and if this called version is used, then the
|
||||
profiler's data collection routine will be called.
|
||||
|
||||
2 /SCAN
|
||||
|
||||
/SCAN=(file[,file...])
|
||||
|
||||
This qualifier supplies a list of files that will be read as input,
|
||||
and the output will be discarded before processing the regular input
|
||||
file. Because the output generated from the files is discarded, the
|
||||
only effect of this qualifier is to make the macros defined in the
|
||||
files available for use in the main input.
|
||||
|
||||
2 /SHOW
|
||||
|
||||
/SHOW[=option]
|
||||
|
||||
This causes the preprocessor to generate information other than the
|
||||
preprocessed input file. When this qualifier is used, no assembly
|
||||
code and no object file is generated.
|
||||
|
||||
The output of the preprocessor is placed in the file specified by the
|
||||
/LIST qualifier, if present. If the /LIST qualifier is not present,
|
||||
then the output is placed in a file with the same name as the input
|
||||
file with an extension that depends upon which option that is
|
||||
selected.
|
||||
|
||||
3 DEFINITIONS
|
||||
|
||||
This option causes the preprocessor to dump a list of all of the
|
||||
definitions to the output file. This is useful for debugging
|
||||
purposes, since it lets you determine whether or not everything has
|
||||
been defined properly.
|
||||
|
||||
If the default file name is used for the output, the extension will
|
||||
be .DEF.
|
||||
|
||||
3 RULES
|
||||
|
||||
This option causes the preprocessor to output a rule suitable for
|
||||
MAKE, describing the dependencies of the main source file. The
|
||||
preprocessor outputs one MAKE rule containing the object file name
|
||||
for that source file, a colon, and the names of all the concluded
|
||||
files. If there are many included files then the rule is split into
|
||||
several lines using the '\'-newline.
|
||||
|
||||
When using this option, only files included with the "#include "file"
|
||||
directive are mentioned.
|
||||
|
||||
If the default file name is used for the output, a null extension
|
||||
will be used.
|
||||
|
||||
3 ALL
|
||||
|
||||
This option is similar to RULES, except that it also mentions files
|
||||
included with the "#include <file.h>" directive.
|
||||
|
||||
If the default file name is used for the output, a null extension
|
||||
will be used.
|
||||
|
||||
2 /UNDEFINE
|
||||
|
||||
/UNDEFINE cancels a macro definition. Thus, it is the same as the
|
||||
#undef preprocessor directive.
|
||||
|
||||
If more than one /UNDEFINE is present on the GCC command line, only
|
||||
the last /UNDEFINE is used.
|
||||
|
||||
If both /DEFINE and /UNDEFINE are present on a command line, /DEFINE
|
||||
is evaluated before /UNDEFINE.
|
||||
|
||||
2 /VERBOSE
|
||||
|
||||
Controls whether the user sees the invocation command strings for the
|
||||
preprocessor, compiler, and assembler. The compiler also outputs
|
||||
some statistics on time spent in its various phases.
|
||||
|
||||
2 /VERSION
|
||||
|
||||
Causes the preprocessor and the compiler to identify themselves by
|
||||
their version numbers, and in the case of the compiler, the version
|
||||
number of the compiler that built it.
|
||||
|
||||
2 /WARNING
|
||||
|
||||
When this qualifier is present, warnings about usage that should be
|
||||
avoided are given by the compiler. For more information, see "Using
|
||||
and Porting GNU CC", in the section on command line options, under
|
||||
"-Wall".
|
||||
|
||||
Warnings are also generated by the preprocessor when this qualifier
|
||||
is given.
|
||||
|
||||
2 Known_Incompatibilities_with_VAX-C
|
||||
|
||||
There are several known incompatibilities between GNU-C and VAX-C.
|
||||
Some common ones will be briefly described here. A complete
|
||||
description can be found in "Using and Porting GNU CC" in the chapter
|
||||
entitled "Using GNU CC on VMS".
|
||||
|
||||
GNU-C provides case hacking as a means of giving case sensitivity
|
||||
to symbol names. The case hack is a hexadecimal number appended to
|
||||
the symbol name, with a bit being set for each upper case letter.
|
||||
Symbols with all lower case, or symbols that have a dollar sign ("$")
|
||||
are not case hacked. There are times that this is undesirable,
|
||||
namely when you wish to link your program against a precompiled
|
||||
library which was compiled with a non-GNU-C compiler. X-windows (or
|
||||
DECWindows) is an example of this. In these instances, the
|
||||
/NOCASE_HACK switch should be used.
|
||||
|
||||
If you require case hacking in some cases, but not in others (i.e.
|
||||
Libg++ with DECWindows), then it is recommended that you develop a
|
||||
header file which will define all mixed case functions that should
|
||||
not have a case hack as the lower case equivalents.
|
||||
|
||||
GNU-C does not provide the globaldef and globalref mechanism
|
||||
which is used by VAX-C to coerce the VMS linker to include certain
|
||||
object modules from a library. There are assembler hacks, which are
|
||||
available to the user through the macros defined in gnu_hacks.h,
|
||||
which effectively give you the ability to perform these functions.
|
||||
While not syntactically identical, they do provide most of the
|
||||
functionality.
|
||||
|
||||
Note that globaldefs of enums is not supported in the way that it is
|
||||
under VAX-C. This can be easily simulated, however, by globaldefing
|
||||
an integer variable, and then globalvaluing all of the enumerated
|
||||
states.
|
||||
|
||||
Furthermore, the way that globalvalue is currently implemented, the
|
||||
data type of the globalvalue variable is seen to the compiler to be a
|
||||
pointer to the data type that you specify. This is necessary in
|
||||
order to make the compiler correctly address the globalvalue
|
||||
variables.
|
||||
|
||||
15
gcc/getpwd.c
15
gcc/getpwd.c
@@ -7,19 +7,19 @@
|
||||
BSD systems) now provides getcwd as called for by POSIX. Allow for
|
||||
the few exceptions to the general rule here. */
|
||||
|
||||
#if !(defined (POSIX) || defined (USG) || defined (VMS)) || defined (HAVE_GETWD)
|
||||
#if !(defined (POSIX) || defined (USG) ) || defined (HAVE_GETWD)
|
||||
#define getcwd(buf,len) getwd(buf)
|
||||
#ifdef MAXPATHLEN
|
||||
#define GUESSPATHLEN (MAXPATHLEN + 1)
|
||||
#else
|
||||
#define GUESSPATHLEN 100
|
||||
#endif
|
||||
#else /* (defined (USG) || defined (VMS)) */
|
||||
#else /* (defined (USG)) */
|
||||
/* We actually use this as a starting point, not a limit. */
|
||||
#define GUESSPATHLEN 100
|
||||
#endif /* (defined (USG) || defined (VMS)) */
|
||||
#endif /* (defined (USG)) */
|
||||
|
||||
#if !(defined (VMS) || (defined(_WIN32) && !defined(__CYGWIN__)))
|
||||
#if !( defined(_WIN32) && !defined(__CYGWIN__))
|
||||
|
||||
/* Get the working directory. Use the PWD environment variable if it's
|
||||
set correctly, since this is faster and gives more uniform answers
|
||||
@@ -67,7 +67,7 @@ getpwd ()
|
||||
return p;
|
||||
}
|
||||
|
||||
#else /* VMS || _WIN32 && !__CYGWIN__ */
|
||||
#else /* _WIN32 && !__CYGWIN__ */
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#define MAXPATHLEN 255
|
||||
@@ -80,11 +80,8 @@ getpwd ()
|
||||
|
||||
if (!pwd)
|
||||
pwd = getcwd (xmalloc (MAXPATHLEN + 1), MAXPATHLEN + 1
|
||||
#ifdef VMS
|
||||
, 0
|
||||
#endif
|
||||
);
|
||||
return pwd;
|
||||
}
|
||||
|
||||
#endif /* VMS || _WIN32 && !__CYGWIN__ */
|
||||
#endif /* _WIN32 && !__CYGWIN__ */
|
||||
|
||||
545
gcc/make-cc1.com
545
gcc/make-cc1.com
@@ -1,545 +0,0 @@
|
||||
$v='f$verify(0) !make-cc1.com
|
||||
$!
|
||||
$! Build the GNU C compiler on VMS.
|
||||
$!
|
||||
$! Usage:
|
||||
$! $ @make-cc1.com [host-compiler] [various]
|
||||
$!
|
||||
$! where [host-compiler] is one of "GNUC", "VAXC", "DECC";
|
||||
$! default when none specified is "GNUC",
|
||||
$! and where [various] is one or more of "CC1", "CC1PLUS",
|
||||
$! "CC1OBJ", "OBJCLIB", "INDEPENDENT", "BC", "ALL", "LINK", "DEBUG".
|
||||
$! "CC1" (C compiler) is the default; of the others, only
|
||||
$! "CC1PLUS" (C++ compiler), "CC1OBJ" (Objective-C compiler),
|
||||
$! and "OBJCLIB" (Objective-C run-time library) are of interest
|
||||
$! for normal installation.
|
||||
$! If both [host-compiler] and other option(s) are specified,
|
||||
$! the host compiler argument must come first.
|
||||
$!
|
||||
$ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
|
||||
$
|
||||
$ p1 = f$edit(p1,"UPCASE,TRIM")
|
||||
$ if p1.eqs."" then p1 = "GNUC"
|
||||
$!
|
||||
$! Compiler-specific setup (assume GNU C, then override as necessary):
|
||||
$!
|
||||
$ CC = "gcc"
|
||||
$ CFLAGS = "/Opt=2/Debug/noVerbos/CC1=""-mpcc-alignment"""
|
||||
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
|
||||
$ if p1.eqs."GNUC"
|
||||
$ then
|
||||
$ p1 = ""
|
||||
$ else
|
||||
$ CC = "cc"
|
||||
$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
|
||||
$ if p2.eqs."DEBUG" .or. p3.eqs."DEBUG" then CFLAGS = CFLAGS + "/Debug"
|
||||
$ if p1.eqs."VAXC"
|
||||
$ then
|
||||
$ p1 = ""
|
||||
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
|
||||
$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
|
||||
$ define/noLog SYS SYS$LIBRARY:
|
||||
$ else
|
||||
$ if p1.eqs."DECC"
|
||||
$ then
|
||||
$ p1 = ""
|
||||
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
|
||||
$ CC = CC + "/Prefix=All/Warn=Disabl=(ImplicitFunc)"
|
||||
$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
|
||||
$ define/noLog SYS DECC$LIBRARY_INCLUDE:
|
||||
$ endif !DECC
|
||||
$ endif !VAXC
|
||||
$ endif !GNUC
|
||||
$
|
||||
$!
|
||||
$! Other setup:
|
||||
$!
|
||||
$ LDFLAGS = "/noMap"
|
||||
$ PARSER = "bison"
|
||||
$ PARSER_FLAGS= "/Define/Verbose"
|
||||
$ RENAME = "rename/New_Version"
|
||||
$ LINK = "link"
|
||||
$ EDIT = "edit"
|
||||
$ SEARCH = "search"
|
||||
$ ABORT = "exit %x002C"
|
||||
$ echo = "write sys$output"
|
||||
$!
|
||||
$! Stage[123] options
|
||||
$!
|
||||
$ CINCL1 = "/Incl=[]" !stage 1 -I flags
|
||||
$ CINCL2 = "/Incl=([],[.ginclude])" !stage 2,3,... flags
|
||||
$ CINCL_SUB = "/Incl=([],[-],[-.ginclude])" ![.cp] flags
|
||||
$
|
||||
$!!!!!!!
|
||||
$! Nothing beyond this point should need any local configuration changes.
|
||||
$!!!!!!!
|
||||
$
|
||||
$! Set the default directory to the same place as this command procedure.
|
||||
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
|
||||
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||
$
|
||||
$!
|
||||
$! First we figure out what needs to be done. This is sort of like a limited
|
||||
$! make facility - the command line options specify exactly what components
|
||||
$! we want to build. The following options are understood:
|
||||
$!
|
||||
$! LINK: Assume that the object modules for the selected compiler(s)
|
||||
$! have already been compiled, perform link phase only.
|
||||
$!
|
||||
$! CC1: Compile and link "C" compiler.
|
||||
$!
|
||||
$! CC1PLUS:Compile and link "C++" compiler.
|
||||
$!
|
||||
$! CC1OBJ: Compile and link objective C compiler.
|
||||
$!
|
||||
$! ALL: Compile and link all of the CC1 passes.
|
||||
$!
|
||||
$! INDEPENDENT:
|
||||
$! Compile language independent source modules. (On by default).
|
||||
$!
|
||||
$! BC:
|
||||
$! Compile byte compiler source modules. (On by default).
|
||||
$!
|
||||
$! OBJCLIB:
|
||||
$! Compile Objective-C run-time library.
|
||||
$!
|
||||
$! DEBUG: Link images with /debug.
|
||||
$!
|
||||
$! If you want to list more than one option, you should use a spaces to
|
||||
$! separate them.
|
||||
$!
|
||||
$! Any one of the above options can be prefaced with a "NO". For example,
|
||||
$! if you had already built GCC, and you wanted to build G++, you could use the
|
||||
$! "CC1PLUS NOINDEPENDENT" options, which would only compile the C++ language
|
||||
$! specific source files, and then link the C++ compiler.
|
||||
$!
|
||||
$! If you do not specify which compiler you want to build, it is assumed that
|
||||
$! you want to build GNU-C ("CC1").
|
||||
$!
|
||||
$! Now figure out what we have been requested to do.
|
||||
$p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
|
||||
$p1 = f$edit(p1,"COMPRESS,TRIM")
|
||||
$i=0
|
||||
$DO_ALL = 0
|
||||
$DO_LINK = 0
|
||||
$DO_DEBUG = 0
|
||||
$DO_CC1PLUS = 0
|
||||
$DO_CC1OBJ = 0
|
||||
$DO_OBJCLIB = 0
|
||||
$if f$trnlnm("cfile$").nes."" then close/noLog cfile$
|
||||
$open cfile$ compilers.list
|
||||
$cinit:read cfile$ compilername/end=cinit_done
|
||||
$DO_'compilername'=0
|
||||
$goto cinit
|
||||
$cinit_done: close cfile$
|
||||
$DO_INDEPENDENT = 1
|
||||
$DO_DEFAULT = 1
|
||||
$DO_BC = 1
|
||||
$loop:
|
||||
$string = f$element(i," ",p1)
|
||||
$if string.eqs." " then goto done
|
||||
$flag = 1
|
||||
$if string.eqs."CC1PLUS" then DO_DEFAULT = 0
|
||||
$if string.eqs."CC1OBJ" then DO_DEFAULT = 0
|
||||
$if string.eqs."OBJCLIB"
|
||||
$then DO_DEFAULT = 0
|
||||
$ DO_INDEPENDENT = DO_CC1OBJ
|
||||
$ DO_BC = DO_CC1OBJ
|
||||
$endif
|
||||
$if f$extract(0,2,string).nes."NO" then goto parse_option
|
||||
$ string=f$extract(2,f$length(string)-2,string)
|
||||
$ flag = 0
|
||||
$parse_option:
|
||||
$DO_'string' = flag
|
||||
$i=i+1
|
||||
$goto loop
|
||||
$!
|
||||
$done:
|
||||
$if DO_DEFAULT.eq.1 then DO_CC1 = 1
|
||||
$echo "This command file will now perform the following actions:
|
||||
$if DO_LINK.eq.1 then goto link_only
|
||||
$if DO_ALL.eq.1 then echo " Compile all language specific object modules."
|
||||
$if DO_CC1.eq.1 then echo " Compile C specific object modules."
|
||||
$if DO_CC1PLUS.eq.1 then echo " Compile C++ specific object modules."
|
||||
$if DO_CC1OBJ.eq.1 then echo " Compile obj-C specific object modules."
|
||||
$if DO_INDEPENDENT.eq.1 then echo " Compile language independent object modules."
|
||||
$if DO_BC.eq.1 then echo " Compile byte compiler object modules."
|
||||
$if DO_OBJCLIB.eq.1 then echo " Create Objective-C run-time library."
|
||||
$link_only:
|
||||
$if DO_CC1.eq.1 then echo " Link C compiler (gcc-cc1.exe)."
|
||||
$if DO_CC1PLUS.eq.1 then echo " Link C++ compiler (gcc-cc1plus.exe)."
|
||||
$if DO_CC1OBJ.eq.1 then echo " Link objective-C compiler (gcc-cc1obj.exe)."
|
||||
$if DO_DEBUG.eq.1 then echo " Link images to run under debugger."
|
||||
$!
|
||||
$! Update CFLAGS with appropriate CINCLx value.
|
||||
$!
|
||||
$if f$edit(f$extract(0,3,CC),"LOWERCASE").nes."gcc" then goto stage1
|
||||
$if f$search("gcc-cc1.exe").eqs."" then goto stage1
|
||||
$if f$file_attr("gnu_cc:[000000]gcc-cc1.exe","FID").nes.-
|
||||
f$file_attr("gcc-cc1.exe","FID") then goto stage1
|
||||
$ CFLAGS = CFLAGS + CINCL2
|
||||
$ goto cinclX
|
||||
$stage1:
|
||||
$ CFLAGS = CFLAGS + CINCL1
|
||||
$cinclX:
|
||||
$!
|
||||
$! Test and see if we need these messages or not. The -1 switch gives it away.
|
||||
$!
|
||||
$gas := $gnu_cc:[000000]gcc-as.exe
|
||||
$if f$search(gas-"$").eqs."" then goto gas_missing_message !must be VAXC
|
||||
$define/user sys$error sys$scratch:gas_test.tmp
|
||||
$gas -1 nla0: -o nla0:
|
||||
$size=f$file_attributes("sys$scratch:gas_test.tmp","ALQ")
|
||||
$delete/nolog sys$scratch:gas_test.tmp;*
|
||||
$if size.eq.0 then goto skip_gas_message
|
||||
$type sys$input: !an old version of gas was found
|
||||
|
||||
-----
|
||||
Note: you appear to have an old version of gas, the GNU assembler.
|
||||
GCC 2.x treats external variables differently than GCC 1.x does. Before
|
||||
you use GCC 2.x, you should obtain a version of the assembler which works
|
||||
with GCC 2.x (gas-1.38 and earlier did not have the necessary support;
|
||||
gas-2.0 through gas-2.3 did not work reliably for vax/vms configuration).
|
||||
The assembler in gcc-vms-1.42 contained patches to provide the proper
|
||||
support, and more recent versions have an up to date version of gas which
|
||||
provides the support. gas from binutils-2.5 or later is recommended.
|
||||
|
||||
If you do not update the assembler, the compiler will still work,
|
||||
but `extern const' variables will be treated as `extern'. This will result
|
||||
in linker warning messages about mismatched psect attributes, and these
|
||||
variables will be placed in read/write storage.
|
||||
-----
|
||||
|
||||
$goto skip_gas_message
|
||||
$gas_missing_message:
|
||||
$type sys$input: !no version of gas was found
|
||||
|
||||
-----
|
||||
Note: you appear to be missing gas, the GNU assembler. Since
|
||||
GCC produces assembly code as output from compilation, you need the
|
||||
assembler to make full use of the compiler. It should be put in place
|
||||
as GNU_CC:[000000]GCC-AS.EXE.
|
||||
|
||||
A prebuilt copy of gas is available from the "gcc-vms" distribution,
|
||||
and the gas source code is included in the GNU "binutils" distribution.
|
||||
Version 2.5.2 or later is recommended.
|
||||
-----
|
||||
|
||||
$skip_gas_message:
|
||||
$!
|
||||
$!
|
||||
$ if DO_DEBUG.eq.1 then LDFLAGS = LDFLAGS + "/Debug"
|
||||
$!
|
||||
$if DO_LINK.eq.1 then goto no_yfiles !compile_cc1
|
||||
$!
|
||||
$! Build alloca if necessary (in 'LIBS for use with VAXC)
|
||||
$!
|
||||
$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).ge.f$length(LIBS) then -
|
||||
goto skip_alloca
|
||||
$ if f$search("alloca.obj").nes."" then - !does .obj exist? is it up to date?
|
||||
if f$cvtime(f$file_attributes("alloca.obj","RDT")).gts.-
|
||||
f$cvtime(f$file_attributes("alloca.c","RDT")) then goto skip_alloca
|
||||
$set verify
|
||||
$ 'CC''CFLAGS'/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
|
||||
$!'f$verify(0)
|
||||
$skip_alloca:
|
||||
$!
|
||||
$if DO_BC.eq.1
|
||||
$ then
|
||||
$ call compile bi_all.opt ""
|
||||
$ if f$trnlnm("ifile$").nes."" then close/noLog ifile$
|
||||
$ open ifile$ bc_all.list
|
||||
$ read ifile$ bc_line
|
||||
$ close ifile$
|
||||
$ bc_index = 0
|
||||
$bc_loop:
|
||||
$ tfile = f$element(bc_index, ",", bc_line)
|
||||
$ if tfile.eqs."," then goto bc_done
|
||||
$ call bc_generate 'tfile' "bi_all.opt/opt,"
|
||||
$ bc_index = bc_index + 1
|
||||
$ goto bc_loop
|
||||
$bc_done:
|
||||
$ endif
|
||||
$!
|
||||
$!
|
||||
$if DO_INDEPENDENT.eq.1
|
||||
$ then
|
||||
$!
|
||||
$! First build a couple of header files from the machine description
|
||||
$! These are used by many of the source modules, so we build them now.
|
||||
$!
|
||||
$set verify
|
||||
$ 'CC''CFLAGS' rtl.c
|
||||
$ 'CC''CFLAGS' obstack.c
|
||||
$!'f$verify(0)
|
||||
$! Generate insn-attr.h
|
||||
$ call generate insn-attr.h
|
||||
$ call generate insn-flags.h
|
||||
$ call generate insn-codes.h
|
||||
$ call generate insn-config.h
|
||||
$!
|
||||
$call compile independent.opt "rtl,obstack,insn-attrtab"
|
||||
$!
|
||||
$ call generate insn-attrtab.c "rtlanal.obj,"
|
||||
$set verify
|
||||
$ 'CC''CFLAGS' insn-attrtab.c
|
||||
$ 'CC''CFLAGS' bc-emit.c
|
||||
$ 'CC''CFLAGS' bc-optab.c
|
||||
$!'f$verify(0)
|
||||
$ endif
|
||||
$!
|
||||
$compile_cc1:
|
||||
$if (DO_CC1 + DO_CC1OBJ) .ne.0
|
||||
$ then
|
||||
$if (f$search("C-PARSE.Y") .eqs. "") then goto yes_yfiles
|
||||
$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
|
||||
f$cvtime(f$file_attributes("C-PARSE.Y","RDT"))) -
|
||||
then goto yes_yfiles
|
||||
$if f$parse("[.OBJC]").eqs."" then create/Directory [.objc]
|
||||
$if (f$search("[.OBJC]OBJC-PARSE.Y") .eqs. "") then goto yes_yfiles
|
||||
$if (f$cvtime(f$file_attributes("C-PARSE.IN","RDT")).gts. -
|
||||
f$cvtime(f$file_attributes("[.OBJC]OBJC-PARSE.Y","RDT"))) -
|
||||
then goto yes_yfiles
|
||||
$GOTO no_yfiles
|
||||
$yes_yfiles:
|
||||
$echo "Now processing c-parse.in to generate c-parse.y and [.objc]objc-parse.y."
|
||||
$ EDIT/Tpu/noJournal/noSection/noDisplay/Command=sys$input:
|
||||
!
|
||||
! Read c-parse.in, write c-parse.y and objc/objc-parse.y, depending on
|
||||
! paired lines of "ifc" & "end ifc" and "ifobjc" & "end ifobjc" to
|
||||
! control what goes into each file. Most lines will be common to
|
||||
! both (hence not bracketed by either control pair). Mismatched
|
||||
! pairs aren't detected--garbage in, garbage out...
|
||||
!
|
||||
|
||||
PROCEDURE do_output()
|
||||
IF NOT objc_only THEN POSITION(END_OF(c)); COPY_TEXT(input_line); ENDIF;
|
||||
IF NOT c_only THEN POSITION(END_OF(objc)); COPY_TEXT(input_line); ENDIF;
|
||||
POSITION(input_file); !reset
|
||||
ENDPROCEDURE;
|
||||
|
||||
input_file := CREATE_BUFFER("input", "c-parse.in"); !load data
|
||||
SET(NO_WRITE, input_file);
|
||||
c := CREATE_BUFFER("c_output"); !1st output file
|
||||
objc := CREATE_BUFFER("objc_output"); !2nd output file
|
||||
|
||||
POSITION(BEGINNING_OF(input_file));
|
||||
c_only := 0;
|
||||
objc_only := 0;
|
||||
|
||||
LOOP
|
||||
EXITIF MARK(NONE) = END_OF(input_file); !are we done yet?
|
||||
|
||||
input_line := CURRENT_LINE; !access current_line just once
|
||||
CASE EDIT(input_line, TRIM_TRAILING, OFF, NOT_IN_PLACE)
|
||||
["ifc"] : c_only := 1;
|
||||
["end ifc"] : c_only := 0;
|
||||
["ifobjc"] : objc_only := 1;
|
||||
["end ifobjc"] : objc_only := 0;
|
||||
! default -- add non-control line to either or both output files
|
||||
[INRANGE] : do_output(); !between "end" and "if"
|
||||
[OUTRANGE] : do_output(); !before "end" or after "if"
|
||||
ENDCASE;
|
||||
|
||||
MOVE_VERTICAL(1); !go to next line
|
||||
ENDLOOP;
|
||||
|
||||
WRITE_FILE(c, "c-parse.y");
|
||||
WRITE_FILE(objc, "[.objc]objc-parse.y");
|
||||
QUIT
|
||||
$ endif
|
||||
$no_yfiles:
|
||||
$!
|
||||
$open cfile$ compilers.list
|
||||
$cloop:read cfile$ compilername/end=cdone
|
||||
$! language specific modules
|
||||
$!
|
||||
$if (DO_ALL + DO_'compilername').eq.0 then goto cloop
|
||||
$if DO_LINK.eq.0 then -
|
||||
call compile 'compilername'-objs.opt "obstack,bc-emit,bc-optab"
|
||||
$!
|
||||
$! CAUTION: If you want to link gcc-cc1* to the sharable image library
|
||||
$! VAXCRTL, see the notes in gcc.texinfo (or INSTALL) first.
|
||||
$!
|
||||
$set verify
|
||||
$ 'LINK''LDFLAGS'/Exe=gcc-'compilername'.exe version.opt/Opt,-
|
||||
'compilername'-objs.opt/Opt,independent.opt/Opt,-
|
||||
'LIBS'
|
||||
$!'f$verify(0)
|
||||
$goto cloop
|
||||
$!
|
||||
$!
|
||||
$cdone: close cfile$
|
||||
$!
|
||||
$ if DO_OBJCLIB
|
||||
$ then set default [.objc] !push
|
||||
$ save_cflags = CFLAGS
|
||||
$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
|
||||
$ MFLAGS = "/Lang=ObjC" + CFLAGS
|
||||
$ library/Obj [-]objclib.olb/Create
|
||||
$ if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
|
||||
$ open/Read ifile$ [-]objc-objs.opt
|
||||
$ocl1: read/End=ocl3 ifile$ line
|
||||
$ i = 0
|
||||
$ocl2: o = f$element(i,",",line)
|
||||
$ if o.eqs."," then goto ocl1
|
||||
$ n = o - ".o"
|
||||
$ if f$search(n + ".m").nes.""
|
||||
$ then f = n + ".m"
|
||||
$ flags = MFLAGS
|
||||
$ else f = n + ".c"
|
||||
$ flags = CFLAGS
|
||||
$ endif
|
||||
$ set verify
|
||||
$ 'CC' 'flags' 'f'
|
||||
$!'f$verify(0)'
|
||||
$ library/Obj [-]objclib.olb 'n'.obj/Insert
|
||||
$ delete/noConfirm/noLog 'n'.obj;*
|
||||
$ i = i + 1
|
||||
$ goto ocl2
|
||||
$ocl3: close ifile$
|
||||
$ CFLAGS = save_cflags
|
||||
$ set default [-] !pop
|
||||
$ endif !DO_OBJCLIB
|
||||
$!
|
||||
$! Done
|
||||
$!
|
||||
$! 'f$verify(v)
|
||||
$exit
|
||||
$!
|
||||
$! Various DCL subroutines follow...
|
||||
$!
|
||||
$! This routine takes parameter p1 to be a linker options file with a list
|
||||
$! of object files that are needed. It extracts the names, and compiles
|
||||
$! each source module, one by one. File names that begin with an
|
||||
$! "INSN-" are assumed to be generated by a GEN*.C program.
|
||||
$!
|
||||
$! Parameter P2 is a list of files which will appear in the options file
|
||||
$! that should not be compiled. This allows us to handle special cases.
|
||||
$!
|
||||
$compile:
|
||||
$subroutine
|
||||
$on error then goto c_err
|
||||
$on control_y then goto c_err
|
||||
$open ifile$ 'p1'
|
||||
$loop: read ifile$ line/end=c_done
|
||||
$!
|
||||
$i=0
|
||||
$loop1:
|
||||
$flnm=f$element(i,",",line)
|
||||
$i=i+1
|
||||
$if flnm.eqs."" then goto loop
|
||||
$if flnm.eqs."," then goto loop
|
||||
$if f$locate(flnm,p2).lt.f$length(p2) then goto loop1
|
||||
$! check for front-end subdirectory: "[.prfx]flnm"
|
||||
$prfx = ""
|
||||
$k = f$locate("]",flnm)
|
||||
$if k.eq.1 ![]c-common for [.cp]
|
||||
$then
|
||||
$ if f$search(f$parse(".obj",flnm)).nes."" then goto loop1
|
||||
$ flnm = f$extract(2,999,flnm)
|
||||
$else if k.lt.f$length(flnm)
|
||||
$ then prfx = f$extract(2,k-2,flnm)
|
||||
$ flnm = f$extract(k+1,99,flnm)
|
||||
$ endif
|
||||
$endif
|
||||
$ if prfx.nes.""
|
||||
$ then set default [.'prfx'] !push
|
||||
$ save_cflags = CFLAGS
|
||||
$ CFLAGS = CFLAGS - CINCL1 - CINCL2 + CINCL_SUB
|
||||
$ endif
|
||||
$!
|
||||
$ if f$locate("parse",flnm).nes.f$length(flnm)
|
||||
$ then
|
||||
$ if f$search("''flnm'.c").nes."" then -
|
||||
if f$cvtime(f$file_attributes("''flnm'.c","RDT")).ges. -
|
||||
f$cvtime(f$file_attributes("''flnm'.y","RDT")) then goto skip_yacc
|
||||
$ set verify
|
||||
$ 'PARSER' 'PARSER_FLAGS' 'flnm'.y
|
||||
$ 'RENAME' 'flnm'_tab.c 'flnm'.c
|
||||
$ 'RENAME' 'flnm'_tab.h 'flnm'.h
|
||||
$!'f$verify(0)
|
||||
$ if flnm.eqs."cp-parse" .or. (prfx.eqs."cp" .and. flnm.eqs."parse")
|
||||
$ then ! fgrep '#define YYEMPTY' cp-parse.c >>cp-parse.h
|
||||
$ if f$trnlnm("JFILE$").nes."" then close/noLog jfile$
|
||||
$ open/Append jfile$ 'flnm'.h
|
||||
$ 'SEARCH'/Exact/Output=jfile$ 'flnm'.c "#define YYEMPTY"
|
||||
$ close jfile$
|
||||
$ endif
|
||||
$skip_yacc:
|
||||
$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
|
||||
$ endif
|
||||
$!
|
||||
$if f$extract(0,5,flnm).eqs."insn-" then call generate 'flnm'.c
|
||||
$!
|
||||
$set verify
|
||||
$ 'CC''CFLAGS' 'flnm'.c
|
||||
$!'f$verify(0)
|
||||
$ if prfx.nes.""
|
||||
$ then set default [-] !pop
|
||||
$ CFLAGS = save_CFLAGS
|
||||
$ endif
|
||||
$
|
||||
$goto loop1
|
||||
$!
|
||||
$!
|
||||
$! In case of error or abort, go here (In order to close file).
|
||||
$!
|
||||
$c_err: !'f$verify(0)
|
||||
$close ifile$
|
||||
$ABORT
|
||||
$!
|
||||
$c_done:
|
||||
$close ifile$
|
||||
$endsubroutine
|
||||
$!
|
||||
$! This subroutine generates the insn-* files. The first argument is the
|
||||
$! name of the insn-* file to generate. The second argument contains a
|
||||
$! list of any other object modules which must be linked to the gen*.c
|
||||
$! program.
|
||||
$!
|
||||
$generate:
|
||||
$subroutine
|
||||
$if f$extract(0,5,p1).nes."INSN-"
|
||||
$ then
|
||||
$ write sys$error "Unknown file passed to generate."
|
||||
$ ABORT
|
||||
$ endif
|
||||
$root1=f$parse(f$extract(5,255,p1),,,"NAME")
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS' GEN'root1'.C
|
||||
$ 'LINK''f$string(LDFLAGS - "/Debug")' GEN'root1'.OBJ,rtl.obj,obstack.obj,'p2' -
|
||||
'LIBS'
|
||||
$! 'f$verify(0)
|
||||
$!
|
||||
$set verify
|
||||
$ assign/user 'p1' sys$output:
|
||||
$ mcr sys$disk:[]GEN'root1' vax.md
|
||||
$!'f$verify(0)
|
||||
$endsubroutine
|
||||
$!
|
||||
$! This subroutine generates the bc-* files. The first argument is the
|
||||
$! name of the bc-* file to generate. The second argument contains a
|
||||
$! list of any other object modules which must be linked to the bi*.c
|
||||
$! program.
|
||||
$!
|
||||
$bc_generate:
|
||||
$subroutine
|
||||
$if f$extract(0,3,p1).nes."BC-"
|
||||
$ then
|
||||
$ write sys$error "Unknown file passed to bc_generate."
|
||||
$ ABORT
|
||||
$ endif
|
||||
$root1=f$parse(f$extract(3,255,p1),,,"NAME")
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS' BI-'root1'.C
|
||||
$ 'LINK''f$string(LDFLAGS - "/Debug")' BI-'root1'.OBJ,'p2' -
|
||||
'LIBS'
|
||||
$! 'f$verify(0)
|
||||
$!
|
||||
$set verify
|
||||
$ assign/user bytecode.def sys$input:
|
||||
$ assign/user 'p1' sys$output:
|
||||
$ mcr sys$disk:[]BI-'root1'
|
||||
$!'f$verify(0)
|
||||
$endsubroutine
|
||||
@@ -1,119 +0,0 @@
|
||||
$v='f$verify(0) !make-cccp.com
|
||||
$!
|
||||
$! Build the GNU C preprocessor on VMS.
|
||||
$!
|
||||
$! Usage:
|
||||
$! $ @make-cccp.com [compiler] [link-only]
|
||||
$!
|
||||
$! where [compiler] is one of "GNUC", "VAXC", "DECC";
|
||||
$! default when none specified is "GNUC",
|
||||
$! and where [link-only] is "LINK" or omitted.
|
||||
$! If both options are specified, the compiler must come first.
|
||||
$!
|
||||
$ if f$type(gcc_debug).eqs."INTEGER" then if gcc_debug.and.1 then set verify
|
||||
$
|
||||
$ p1 = f$edit(p1,"UPCASE,TRIM")
|
||||
$ if p1.eqs."" then p1 = "GNUC"
|
||||
$!
|
||||
$! Compiler-specific setup (assume GNU C, then override as necessary):
|
||||
$!
|
||||
$ CC = "gcc"
|
||||
$ CFLAGS = "/Opt=2/Debug/noVerbos"
|
||||
$ LIBS = "gnu_cc:[000000]gcclib.olb/Libr,sys$library:vaxcrtl.olb/Libr"
|
||||
$ if p1.nes."GNUC"
|
||||
$ then
|
||||
$ CC = "cc"
|
||||
$ CFLAGS = "/noOpt" !disable optimizer when bootstrapping with native cc
|
||||
$ if p1.eqs."VAXC"
|
||||
$ then
|
||||
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/VAXC"
|
||||
$ LIBS = "alloca.obj,sys$library:vaxcrtl.olb/Libr"
|
||||
$ define/noLog SYS SYS$LIBRARY:
|
||||
$ else
|
||||
$ if p1.eqs."DECC"
|
||||
$ then
|
||||
$ if f$trnlnm("DECC$CC_DEFAULT").nes."" then CC = "cc/DECC"
|
||||
$ CC = CC + "/Prefix=All"
|
||||
$ LIBS = "alloca.obj" !DECC$SHR will be found implicitly by linker
|
||||
$ define/noLog SYS DECC$LIBRARY_INCLUDE:
|
||||
$ else
|
||||
$ if p1.nes."LINK"
|
||||
$ then
|
||||
$ type sys$input: /Output=sys$error:
|
||||
$DECK
|
||||
[compiler] argument should be one of "GNUC", "VAXC", or "DECC".
|
||||
|
||||
Usage:
|
||||
$ @make-cccp.com [compiler] [link-only]
|
||||
|
||||
$EOD
|
||||
$ exit %x1000002C + 0*f$verify(v) !%SYSTEM-F-ABORT
|
||||
$ endif !!LINK
|
||||
$ endif !DECC
|
||||
$ endif !VAXC
|
||||
$ endif !!GNUC
|
||||
$
|
||||
$!
|
||||
$! Other setup:
|
||||
$!
|
||||
$ LDFLAGS = "/noMap"
|
||||
$ PARSER = "bison"
|
||||
$ RENAME = "rename/New_Version"
|
||||
$ LINK = "link"
|
||||
$ echo = "write sys$output"
|
||||
$
|
||||
$!!!!!!!
|
||||
$! Nothing beyond this point should need any local configuration changes.
|
||||
$!!!!!!!
|
||||
$
|
||||
$! Set the default directory to the same place as this command procedure.
|
||||
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
|
||||
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||
$
|
||||
$ if p1.eqs."LINK" .or. p2.eqs."LINK" then goto Link
|
||||
$ echo " Building the preprocessor."
|
||||
$
|
||||
$! Compile the simplest file first, to catch problem with compiler setup early.
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS' version.c
|
||||
$!'f$verify(0)
|
||||
$
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS' cccp.c
|
||||
$!'f$verify(0)
|
||||
$
|
||||
$! Compile preprocessor's parser, possibly making it with yacc first.
|
||||
$ if f$search("CEXP.C").nes."" then -
|
||||
if f$cvtime(f$file_attributes("CEXP.C","RDT")).ges.-
|
||||
f$cvtime(f$file_attributes("CEXP.Y","RDT")) then goto skip_yacc
|
||||
$ set verify
|
||||
$ 'PARSER' cexp.y
|
||||
$ 'RENAME' cexp_tab.c cexp.c
|
||||
$!'f$verify(0)
|
||||
$skip_yacc:
|
||||
$ echo " (Ignore any warning about not finding file ""bison.simple"".)"
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS' cexp.c
|
||||
$ 'CC''CFLAGS'/Define="PREFIX=""_dummy_""" prefix.c
|
||||
$!'f$verify(0)
|
||||
$
|
||||
$! In case there's no builtin alloca support, use the C simulation.
|
||||
$ if f$locate("alloca.obj",f$edit(LIBS,"lowercase")).lt.f$length(LIBS)
|
||||
$ then
|
||||
$ set verify
|
||||
$ 'CC''CFLAGS'/Incl=[]/Defi=("HAVE_CONFIG_H","STACK_DIRECTION=(-1)") alloca.c
|
||||
$!'f$verify(0)
|
||||
$ endif
|
||||
$!
|
||||
$
|
||||
$Link:
|
||||
$ echo " Linking the preprocessor."
|
||||
$ set verify
|
||||
$ 'LINK''LDFLAGS'/Exe=gcc-cpp.exe -
|
||||
cccp.obj,cexp.obj,prefix.obj,version.obj,version.opt/Opt,-
|
||||
'LIBS'
|
||||
$!'f$verify(0)
|
||||
$!
|
||||
$! Done
|
||||
$!
|
||||
$ exit 1+0*f$verify(v)
|
||||
@@ -1,71 +0,0 @@
|
||||
$! make-gcc.com -- VMS build procedure for GNU CC.
|
||||
$!
|
||||
$! Usage:
|
||||
$! $ @make-gcc.com [host-compiler] [component list]
|
||||
$!
|
||||
$! where [host-compiler] is one of "GNUC", "VAXC", "DECC";
|
||||
$! default when none specified is "GNUC",
|
||||
$! and where [component list] is space separated list beginning
|
||||
$! with "CC1" and optionally followed by "CC1PLUS"; default if
|
||||
$! nothing is specified is "CC1" (the C compiler); choosing
|
||||
$! "CC1PLUS" (the C++ compiler) without also specifying "CC1"
|
||||
$! will not work. (See make-cc1.com for other potential component
|
||||
$! values; but unless you're developing or debugging the compiler
|
||||
$! suite itself, the two above are the only ones of interest.)
|
||||
$!
|
||||
$! For a "stage 2" or subsequent build, always specify GNUC as
|
||||
$! the host compiler.
|
||||
$!
|
||||
$! Note:
|
||||
$! Even though it is possible to build with VAX C or DEC C,
|
||||
$! a prior version of the gcc-vms binary distribution is still
|
||||
$! required to be able to use the newly built GNU CC compiler(s),
|
||||
$! because the gcc source distribution does not supply the driver
|
||||
$! program which the DCL command "GCC" implements or the C header
|
||||
$! files and gcclib support library.
|
||||
$!
|
||||
$
|
||||
$!
|
||||
$! Change working directory to the location of this procedure.
|
||||
$!
|
||||
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
|
||||
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||
$
|
||||
$!
|
||||
$! First, we build the preprocessor.
|
||||
$!
|
||||
$ @make-cccp.com 'p1' 'p2'
|
||||
$!
|
||||
$! To install it, copy the resulting GCC-CPP.EXE to the GNU_CC:[000000]
|
||||
$! directory.
|
||||
$!
|
||||
$
|
||||
$!
|
||||
$! Now we build the C compiler. To build the C++ compiler too, use
|
||||
$! $ @make-gcc GNUC cc1 cc1plus
|
||||
$! when invoking this command procedure. Note that you should not
|
||||
$! do this for a "stage 1" build.
|
||||
$!
|
||||
$ @make-cc1.com 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
|
||||
$!
|
||||
$! To install it (them), copy the resulting GCC-CC1.EXE (and GCC-CC1PLUS.EXE)
|
||||
$! to the GNU_CC:[000000] directory.
|
||||
$!
|
||||
$
|
||||
$!
|
||||
$! Now we build the `libgcc2' support library. It will need to be merged
|
||||
$! with the existing gcclib.olb library.
|
||||
$!
|
||||
$ @make-l2.com 'p1' 'p2' 'p3' 'p4' 'p5' 'p6' 'p7' 'p8'
|
||||
$!
|
||||
$! To install, save a backup copy of GNU_CC:[000000]GCCLIB.OLB somewhere,
|
||||
$! then update the original using the newly created LIBGCC2.OLB via
|
||||
$! $ library/Obj libgcc2.olb /Extract=*/Output=libgcc2.obj
|
||||
$! $ library/Obj gnu_cc:[000000]gcclib.olb libgcc2.obj /Replace
|
||||
$!
|
||||
$! Depending upon how old your present gcclib library is, you might have
|
||||
$! to delete some modules, such as `eprintf' and `new', to avoid conflicting
|
||||
$! symbols from obsolete routines. After deleting any such modules, just
|
||||
$! repeat the `library/replace' step.
|
||||
$!
|
||||
$ exit
|
||||
149
gcc/make-l2.com
149
gcc/make-l2.com
@@ -1,149 +0,0 @@
|
||||
$! make-l2.com -- VMS build procedure for libgcc2.
|
||||
$
|
||||
$! Change working directory to the location of this command procedure.
|
||||
$ flnm = f$enviroment("PROCEDURE") !get current procedure name
|
||||
$ set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||
$!
|
||||
$! Command file to build libgcc2.olb. You should only run this once you
|
||||
$! have the current compiler installed, otherwise some of the builtins will
|
||||
$! not be recognized. Once you have built libgcc2.olb, you can merge this
|
||||
$! with gnu_cc:[000000]gcclib.olb
|
||||
$!
|
||||
$! All of the C source code is assumed to be in libgcc2.c, and a list of the
|
||||
$! modules that we need from there is in libgcc2.list (which is generated
|
||||
$! when vmsconfig.com is run). The C++ source is found in the [.cp.inc]
|
||||
$! directory and managed via libgcc2-cxx.list.
|
||||
$!
|
||||
$ if f$search("gcc-cc1.exe").eqs.""
|
||||
$ then
|
||||
$ gcc_cc1:=$gnu_cc:[000000]gcc-cc1
|
||||
$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
|
||||
$ else
|
||||
$ gcc_cc1:=$sys$disk:[]gcc-cc1
|
||||
$ endif
|
||||
$!
|
||||
$ if f$search("gcc-cpp.exe").eqs.""
|
||||
$ then
|
||||
$ gcc_cpp:=$gnu_cc:[000000]gcc-cpp
|
||||
$ if f$extract(0,1,f$trnlnm("GNU_CC_VERSION")).eqs."1" then goto nocompile
|
||||
$ Version:='f$trnlnm("GNU_CC_VERSION")'
|
||||
$ else
|
||||
$ gcc_cpp:=$sys$disk:[]gcc-cpp
|
||||
$ open ifile$ version.opt
|
||||
$ read ifile$ line
|
||||
$ close ifile$
|
||||
$ Version=line - "ident=""" - """
|
||||
$ endif
|
||||
$!
|
||||
$ if f$search("gcc-cc1plus.exe").eqs.""
|
||||
$ then gcc_cxx = "$gnu_cc:[000000]gcc-cc1plus"
|
||||
$ else gcc_cxx = "$sys$disk:[]gcc-cc1plus"
|
||||
$ endif
|
||||
$!
|
||||
$gcc_as:=$gnu_cc:[000000]gcc-as
|
||||
$cpp_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.cpp
|
||||
$ s_file:=sys$scratch:gcc_'f$getjpi(0,"pid")'.s
|
||||
$!
|
||||
$set symbol/scope=(nolocal,noglobal)
|
||||
$!
|
||||
$lib/create libgcc2.olb
|
||||
$on error then goto c_err
|
||||
$on control_y then goto c_err
|
||||
$
|
||||
$if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
|
||||
$open ifile$ libgcc2.list
|
||||
$loop:
|
||||
$!
|
||||
$read ifile$ line/end=c_done
|
||||
$i=0
|
||||
$loop1:
|
||||
$flnm=f$element(i," ",line)
|
||||
$i=i+1
|
||||
$if flnm.eqs."" then goto loop
|
||||
$if flnm.eqs." " then goto loop
|
||||
$!
|
||||
$flnm = "L"+flnm
|
||||
$if flnm.eqs."L_exit" then goto loop1
|
||||
$write sys$output "$ gcc/debug/define=""''flnm'"" LIBGCC2.C"
|
||||
$!
|
||||
$objname = flnm
|
||||
$if flnm.eqs."L_builtin_New" then objname = "L_builtin_nnew"
|
||||
$!
|
||||
$! We do this by hand, since the VMS compiler driver does not have a way
|
||||
$! of specifying an alternate location for the compiler executables.
|
||||
$!
|
||||
$ if arch .eqs. "alpha"
|
||||
$ then
|
||||
$ gcc_cpp "-D__IEEE_FLOAT" "-I[]" "-I[.config]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
|
||||
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
|
||||
-quiet -mgas "-O1" -mfloat-ieee -o 's_file'
|
||||
$ else
|
||||
$ gcc_cpp "-I[]" "-I[.config]" "-I[.ginclude]" "-D''flnm'" libgcc2.c 'cpp_file'
|
||||
$ gcc_cc1 'cpp_file' -dumpbase 'objname' -
|
||||
-quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file'
|
||||
$ endif
|
||||
$ delete/nolog 'cpp_file';
|
||||
$ gcc_as 's_file' -o 'objname'.OBJ
|
||||
$ if arch .eqs. "vax"
|
||||
$ then
|
||||
$! Assemble again, preserving lowercase symbol names this time.
|
||||
$ gcc_as -h3 's_file' -o 'objname'-c.OBJ
|
||||
$ library libgcc2.olb 'objname'.obj,'objname'-c.obj
|
||||
$ delete/nolog 'objname'.obj;,'objname'-c.obj;
|
||||
$ else
|
||||
$ library libgcc2.olb 'objname'.obj
|
||||
$ delete/nolog 'objname'.obj;
|
||||
$ endif
|
||||
$ delete/nolog 's_file';
|
||||
$!
|
||||
$!
|
||||
$goto loop1
|
||||
$!
|
||||
$! In case of error or abort, go here (In order to close file).
|
||||
$!
|
||||
$c_err: !'f$verify(0)
|
||||
$close ifile$
|
||||
$ exit %x2c
|
||||
$!
|
||||
$c_done:
|
||||
$close ifile$
|
||||
$
|
||||
$
|
||||
$ EXIT
|
||||
$ !gcc-2.8.0: C++ libgcc2 code disabled since it's not adequately tested
|
||||
$
|
||||
$!
|
||||
$ p1 = p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+p7+" "+p8
|
||||
$ p1 = " " + f$edit(p1,"COMPRESS,TRIM,UPCASE") + " "
|
||||
$! (note: substring locations can only be equal when neither string is present)
|
||||
$ if f$locate(" CC1PLUS ",p1).eq.f$locate(" CXX ",p1) then goto cxx_done
|
||||
$ if f$search("libgcc2-cxx.list").eqs."" then goto cxx_done
|
||||
$!
|
||||
$ open/read ifile$ libgcc2-cxx.list
|
||||
$cxx_line_loop:
|
||||
$ read ifile$ line/end=cxx_done
|
||||
$ i = 0
|
||||
$cxx_file_loop:
|
||||
$ flnm = f$element(i,",",line)
|
||||
$ i = i + 1
|
||||
$ if flnm.eqs."" .or. flnm.eqs."," then goto cxx_line_loop
|
||||
$ write sys$output "$ gcc/plus/debug ''flnm'.cc"
|
||||
$ objname = flnm
|
||||
$!
|
||||
$ gcc_cpp -+ "-I[]" "-I[.ginclude]" "-I[.cp.inc]" [.cp]'flnm'.cc 'cpp_file'
|
||||
$ gcc_cxx 'cpp_file' -dumpbase 'objname' -fexceptions -
|
||||
-quiet -mgnu -g "-O1" -mvaxc-alignment -o 's_file'
|
||||
$ delete/nolog 'cpp_file';
|
||||
$ gcc_as "-vGNU CC V''Version'" 's_file' -o 'objname'.OBJ
|
||||
$! Assemble again, preserving lowercase symbol names this time.
|
||||
$ gcc_as "-vGNU CC V''Version'" -h3 's_file' -o 'objname'-c.OBJ
|
||||
$ delete/nolog 's_file';
|
||||
$
|
||||
$ library libgcc2.olb 'objname'.obj,'objname'-c.obj
|
||||
$ delete/nolog 'objname'.obj;,'objname'-c.obj;
|
||||
$!
|
||||
$ goto cxx_file_loop
|
||||
$!
|
||||
$cxx_done:
|
||||
$ close ifile$
|
||||
$ exit
|
||||
40
gcc/toplev.c
40
gcc/toplev.c
@@ -75,26 +75,6 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "xcoffout.h"
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
/* The extra parameters substantially improve the I/O performance. */
|
||||
static FILE *
|
||||
vms_fopen (fname, type)
|
||||
char * fname;
|
||||
char * type;
|
||||
{
|
||||
/* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
|
||||
fixed arguments, which matches ANSI's specification but not VAXCRTL's
|
||||
pre-ANSI implementation. This hack circumvents the mismatch problem. */
|
||||
FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
|
||||
|
||||
if (*type == 'w')
|
||||
return (*vmslib_fopen) (fname, type, "mbc=32",
|
||||
"deq=64", "fop=tef", "shr=nil");
|
||||
else
|
||||
return (*vmslib_fopen) (fname, type, "mbc=32");
|
||||
}
|
||||
#define fopen vms_fopen
|
||||
#endif /* VMS */
|
||||
|
||||
#ifndef DEFAULT_GDB_EXTENSIONS
|
||||
#define DEFAULT_GDB_EXTENSIONS 1
|
||||
@@ -135,7 +115,7 @@ You Lose! You must define PREFERRED_DEBUGGING_TYPE!
|
||||
|
||||
extern int rtx_equal_function_value_matters;
|
||||
|
||||
#if ! (defined (VMS) || defined (OS2))
|
||||
#if ! defined (OS2)
|
||||
extern char **environ;
|
||||
#endif
|
||||
extern char *version_string, *language_string;
|
||||
@@ -1338,26 +1318,12 @@ get_run_time ()
|
||||
return (tms.tms_utime + tms.tms_stime) * (1000000 / TICKS_PER_SECOND);
|
||||
}
|
||||
#else
|
||||
#ifndef VMS
|
||||
{
|
||||
struct rusage rusage;
|
||||
getrusage (0, &rusage);
|
||||
return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
|
||||
+ rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
|
||||
}
|
||||
#else /* VMS */
|
||||
{
|
||||
struct
|
||||
{
|
||||
int proc_user_time;
|
||||
int proc_system_time;
|
||||
int child_user_time;
|
||||
int child_system_time;
|
||||
} vms_times;
|
||||
times ((void *) &vms_times);
|
||||
return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
|
||||
}
|
||||
#endif /* VMS */
|
||||
#endif /* USG */
|
||||
#endif /* _SC_CLK_TCK */
|
||||
#endif /* _WIN32 */
|
||||
@@ -5276,7 +5242,7 @@ main (argc, argv)
|
||||
|
||||
compile_file (filename);
|
||||
|
||||
#if !defined(OS2) && !defined(VMS) && (!defined(_WIN32) || defined (__CYGWIN__))
|
||||
#if !defined(OS2) && (!defined(_WIN32) || defined (__CYGWIN__))
|
||||
if (flag_print_mem)
|
||||
{
|
||||
char *lim = (char *) sbrk (0);
|
||||
@@ -5292,7 +5258,7 @@ main (argc, argv)
|
||||
#endif /* not USG */
|
||||
#endif
|
||||
}
|
||||
#endif /* ! OS2 && ! VMS && (! _WIN32 || CYGWIN) */
|
||||
#endif /* ! OS2 && (! _WIN32 || CYGWIN) */
|
||||
|
||||
if (errorcount)
|
||||
exit (FATAL_EXIT_CODE);
|
||||
|
||||
@@ -1,500 +0,0 @@
|
||||
$ !
|
||||
$ ! Set up to compile GCC on VMS.
|
||||
$ !
|
||||
$ ! Set the def dir to proper place for use in batch. Works for interactive too.
|
||||
$flnm = f$enviroment("PROCEDURE") ! get current procedure name
|
||||
$set default 'f$parse(flnm,,,"DEVICE")''f$parse(flnm,,,"DIRECTORY")'
|
||||
$ !
|
||||
$set symbol/scope=(nolocal,noglobal)
|
||||
$if f$trnlnm("IFILE$").nes."" then close/noLog ifile$
|
||||
$ !
|
||||
$ echo = "write sys$output"
|
||||
$ !
|
||||
$ arch_indx = 1 + ((f$getsyi("CPU").ge.128).and.1) ! vax==1, alpha==2
|
||||
$ arch = f$element(arch_indx,"|","|vax|alpha|")
|
||||
$ !
|
||||
$ if f$search("config.h") .nes. "" then delete config.h.*
|
||||
$ if arch .eqs. "vax"
|
||||
$ then
|
||||
$ copy [.config.'arch']xm-vms.h []config.h
|
||||
$ echo "Linked `config.h' to `[.config.''arch']xm-vms.h'."
|
||||
$else
|
||||
$ open/write cfile []config.h
|
||||
$ write cfile "#include "+"""config/"+arch+"/xm-"+arch+".h"+"""
|
||||
$ write cfile "#include "+"""config/"+arch+"/xm-vms.h"+"""
|
||||
$ close cfile
|
||||
$ echo "Created `config.h'."
|
||||
$ endif
|
||||
$ !
|
||||
$ if f$search("tconfig.h") .nes. "" then delete tconfig.h.*
|
||||
$ create []tconfig.h
|
||||
$DECK
|
||||
/* tconfig.h == config.h :: target and host configurations are the same */
|
||||
#include "config.h"
|
||||
$EOD
|
||||
$ echo "Created `tconfig.h'.
|
||||
$ !
|
||||
$ if f$search("hconfig.h") .nes. "" then delete hconfig.h.*
|
||||
$ create []hconfig.h
|
||||
$DECK
|
||||
/* hconfig.h == config.h :: host and target configurations are the same */
|
||||
#include "config.h"
|
||||
$EOD
|
||||
$ echo "Created `hconfig.h'.
|
||||
$ !
|
||||
$ if f$search("tm.h") .nes. "" then delete tm.h.*
|
||||
$ !
|
||||
$ edit/tpu/nojournal/nosection/nodisplay/command=sys$input -
|
||||
[.config.'arch']vms.h /output=[]tm.h
|
||||
$DECK
|
||||
!
|
||||
! Copy file, changing lines of the form
|
||||
! #include "vax/*"
|
||||
! or
|
||||
! #include "alpha/*"
|
||||
! into
|
||||
! #include "config-*"
|
||||
!
|
||||
file := CREATE_BUFFER("file", GET_INFO(COMMAND_LINE, "file_name"));
|
||||
targ := LINE_BEGIN & '#include' & SPAN(ASCII(32)+ASCII(9))
|
||||
& '"' & ('vax' | 'alpha') & '/';
|
||||
rang := CREATE_RANGE(BEGINNING_OF(file), END_OF(file));
|
||||
LOOP
|
||||
incl := SEARCH_QUIETLY(targ, FORWARD, EXACT, rang);
|
||||
EXITIF incl = 0;
|
||||
POSITION(BEGINNING_OF(incl));
|
||||
ERASE(incl);
|
||||
COPY_TEXT('#include "config-');
|
||||
rang := CREATE_RANGE(END_OF(incl), END_OF(file));
|
||||
ENDLOOP;
|
||||
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
|
||||
QUIT
|
||||
$ EOD
|
||||
$ echo "Generated `tm.h' from `[.config.''arch']vms.h'."
|
||||
$ !
|
||||
$ !crude hack to allow compiling from [.cp] subdirectory
|
||||
$ if f$search("config-''arch'.h") .nes. "" then delete config-'arch'.h;*
|
||||
$ copy [.config.'arch']'arch'.h []config-'arch'.h
|
||||
$ echo "Linked `config-''arch'.h' to `[.config.''arch']''arch'.h' for `tm.h'."
|
||||
$ !
|
||||
$ call make_lang_incl "options.h"
|
||||
$ !
|
||||
$ call make_lang_incl "specs.h"
|
||||
$ !
|
||||
$ if arch .eqs. "vax"
|
||||
$ then
|
||||
$ if f$search("''arch'.md") .nes. "" then delete 'arch'.md;*
|
||||
$ copy [.config.'arch']'arch'.md []'arch'.md
|
||||
$ echo "Copied `''arch'.md' from `[.config.''arch']''arch'.md'."
|
||||
$ endif
|
||||
$ !
|
||||
$ if f$search("aux-output.c") .nes. "" then delete aux-output.c.*
|
||||
$ copy [.config.'arch']'arch'.c []aux-output.c
|
||||
$ echo "Linked `aux-output.c' to `[.config.''arch']''arch'.c'.
|
||||
$ !
|
||||
$ !
|
||||
$ !
|
||||
$ ! Create the file version.opt, which helps identify the executable.
|
||||
$ !
|
||||
$search version.c version_string,"="/match=and/output=t.tmp
|
||||
$open ifile$ t.tmp
|
||||
$read ifile$ line
|
||||
$close ifile$
|
||||
$delete t.tmp;
|
||||
$line=f$element(1,"""",line) !extract the portion between 1st & 2nd quotes
|
||||
$! Format of 'line' is "name-nn.nn.nn[.nn] [date text]" (without the quotes).
|
||||
$! We want "name-nn.nn.nn[.nn][-date]"; "-date" suffix is optional.
|
||||
$id = f$element(1,"-",line) !strip "name-" prefix
|
||||
$if id.eqs."-" then id = line !no prefix found?
|
||||
$id = f$element(0," ",id) + "-" + f$element(1," ",id) !first two tokens
|
||||
$id = id - "- " !in case 2nd token was empty
|
||||
$if f$length(id).gt.15 then id = f$extract(0,15,id) !length limitation
|
||||
$!
|
||||
$open/write ifile$ version.opt
|
||||
$write ifile$ "ident="+""""+id+""""
|
||||
$close ifile$
|
||||
$purge version.opt
|
||||
$!
|
||||
$!
|
||||
$! create linker options files that lists all of the components for all
|
||||
$! possible compilers. We do this by editing the file Makefile.in, and
|
||||
$! generating the relevant files from it.
|
||||
$!
|
||||
$!
|
||||
$! Make a copy of the makefile if the sources are on a disk that is NFS
|
||||
$! mounted on a unix machine.
|
||||
$if f$search("Makefile.in").eqs."" .and. f$search("$M$akefile.in").nes."" -
|
||||
then copy $M$akefile.in Makefile.in
|
||||
$! This should be automated across all front-end subdirectories.
|
||||
$! For now, it's hardcoded.
|
||||
$if f$search("[.cp]Makefile.in").eqs."" .and. f$search("[.cp]$M$akefile.in").nes."" -
|
||||
then copy [.cp]$M$akefile.in [.cp]Makefile.in
|
||||
$!
|
||||
$!
|
||||
$echo "Now processing Makefile.in to generate linker option files."
|
||||
$edit/TPU/noJournal/noSection/noDisplay/Command=sys$input: Makefile.in -
|
||||
/Start_Position=('arch_indx') ! 1 for vax, 2 for alpha
|
||||
!!
|
||||
VARIABLE makefile_buf, opt_file_buf, complist_buf, extra_compilers; ! Globals.
|
||||
VARIABLE arch; ! String 'vax' or 'alpha', set in configure_makefile().
|
||||
|
||||
!!
|
||||
PROCEDURE process_makefile( )
|
||||
!
|
||||
! Interpret Makefile.in and subsidiary Make-lang.in templates.
|
||||
!
|
||||
LOCAL range1, cmark, makefilename;
|
||||
|
||||
makefilename := GET_INFO (COMMAND_LINE, 'FILE_NAME'); ! "Makefile.in"
|
||||
makefile_buf := CREATE_BUFFER ("makefile", makefilename);
|
||||
opt_file_buf := CREATE_BUFFER ("opt_file");
|
||||
complist_buf := CREATE_BUFFER ("complist");
|
||||
extra_compilers := CREATE_ARRAY;
|
||||
!
|
||||
SET (NO_WRITE, makefile_buf, ON); ! Used as workspace; don't save it.
|
||||
SET (OUTPUT_FILE, complist_buf, "compilers.list");
|
||||
!
|
||||
! Make some textual substitutions.
|
||||
!
|
||||
configure_makefile ();
|
||||
!
|
||||
! Collect a list of supported compilers (``COMPILERS=xxx'' macro).
|
||||
!
|
||||
identify_compilers ();
|
||||
!
|
||||
! Plus other known compilers described by Make-lang.in makefile fragments.
|
||||
! Add new entries as needed; args are (target name, subdirectory name).
|
||||
!
|
||||
additional_compiler ("cc1plus", "cp");
|
||||
!
|
||||
WRITE_FILE (complist_buf); ! Now save "compilers.list".
|
||||
!
|
||||
! Add to this list, as required. The file "Makefile.in" is searched for
|
||||
! a tag that looks like "LINE_BEGIN + 'tag + (optional space) + "="".
|
||||
! The contents are assumed to be a list of object files, and from this
|
||||
! list a VMS linker options file is generated.
|
||||
!
|
||||
generate_option_file ("OBJS", "=", "independent.opt");
|
||||
generate_option_file ("LIB2FUNCS", "=", "libgcc2.list");
|
||||
generate_option_file ("CXX_LIB2FUNCS", "=", "libgcc2-cxx.list");
|
||||
!
|
||||
! Now change OBJS in the Makefile, so each language specific options file
|
||||
! does not pick up all of the language independent files.
|
||||
!
|
||||
POSITION (BEGINNING_OF (makefile_buf));
|
||||
COPY_TEXT ("OBJS="); ! New copy with empty value, seen before real OBJS.
|
||||
SPLIT_LINE;
|
||||
!
|
||||
! Lastly, process each compiler-specific object dependency list.
|
||||
!
|
||||
POSITION (BEGINNING_OF (complist_buf));
|
||||
LOOP
|
||||
cmark := MARK (NONE);
|
||||
EXITIF (cmark = END_OF (complist_buf));
|
||||
! The current line contains the name of a compiler target, such as "cc1".
|
||||
MESSAGE (CURRENT_LINE); ! Give some interactive feedback.
|
||||
generate_option_file (CURRENT_LINE, ":", CURRENT_LINE + "-objs.opt");
|
||||
POSITION (cmark);
|
||||
MOVE_VERTICAL (1); ! Go to the next line.
|
||||
ENDLOOP;
|
||||
ENDPROCEDURE; !process_makefile
|
||||
!!
|
||||
|
||||
PROCEDURE process_objc_lib( )
|
||||
!
|
||||
! Interpret objc/Makefile, after finishing the top makefile.
|
||||
!
|
||||
ON_ERROR
|
||||
[TPU$_OPENIN]:
|
||||
MESSAGE ("Cannot load objc/Makefile for ""ObjClib""; skipping it.");
|
||||
RETURN;
|
||||
ENDON_ERROR;
|
||||
|
||||
ERASE (makefile_buf); !discard top Makefile
|
||||
POSITION (END_OF (makefile_buf));
|
||||
READ_FILE ("[.objc]Make-lang.in"); !load objc one
|
||||
MESSAGE ("objclib");
|
||||
pat_replace (ASCII(9), " "); !change any <tab> to <space>
|
||||
generate_option_file ("OBJC_O", "=", "objc-objs.opt");
|
||||
POSITION (BEGINNING_OF (makefile_buf));
|
||||
! Join any continuation lines; we want the header list to be one line.
|
||||
pat_replace ("\" & LINE_END, );
|
||||
generate_option_file ("OBJC_H", "=", "objc-hdrs.list");
|
||||
ENDPROCEDURE; !process_objc_lib
|
||||
!!
|
||||
|
||||
PROCEDURE configure_makefile( )
|
||||
!
|
||||
! Plug in some values normally handled by `configure'. Rather than
|
||||
! replacing the dummy entries, insert the real entries before them.
|
||||
!
|
||||
IF (GET_INFO (COMMAND_LINE, 'START_RECORD') <> 2) THEN
|
||||
arch := 'vax';
|
||||
ELSE
|
||||
arch := 'alpha';
|
||||
ENDIF;
|
||||
POSITION (BEGINNING_OF (makefile_buf));
|
||||
COPY_TEXT ("target=" + arch + "-vms"); SPLIT_LINE;
|
||||
COPY_TEXT ("out_file=aux-output.c"); SPLIT_LINE; ! 'arch'/'arch'.c
|
||||
COPY_TEXT ("out_object_file=aux-output.o"); SPLIT_LINE; ! aux-output.obj
|
||||
COPY_TEXT ("md_file=" + arch + ".md"); SPLIT_LINE; ! 'arch'/'arch'.md
|
||||
COPY_TEXT ("tm_file=tm.h"); SPLIT_LINE; ! 'arch'/tm-vms.h
|
||||
pat_replace ("@" &
|
||||
SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789")
|
||||
& "@", ); ! strip `configure' dummy values
|
||||
ENDPROCEDURE; !configure_makefile
|
||||
!!
|
||||
|
||||
PROCEDURE identify_compilers( )
|
||||
!
|
||||
! Retrieve the list of supported compilers from Makefile.in, and put them
|
||||
! into file "compilers.list", one per line, for subsequent access from DCL.
|
||||
!
|
||||
LOCAL range1;
|
||||
|
||||
! Strip most comments from the makefile, to speed up subsequent processing.
|
||||
POSITION (BEGINNING_OF (makefile_buf));
|
||||
pat_replace (LINE_BEGIN & "#" & REMAIN & LINE_END, );
|
||||
pat_replace ("$(exeext)", );
|
||||
pat_replace ("@all_compilers@", );
|
||||
!# ! Convert directory references to VMS syntax (actually, just strip it).
|
||||
!# pat_replace (" $(srcdir)/", " ");
|
||||
! Look up the ``COMPILERS=cc1 xyzzy'' Makefile macro and put
|
||||
! its ``cc1 xyzzy'' value into the compilers buffer.
|
||||
POSITION (BEGINNING_OF (complist_buf));
|
||||
!#--at some point we may want to add this--
|
||||
!# recursive_fetch_tag ("CCCP", "="); ! Include the preprocessor.
|
||||
!# POSITION (END_OF (complist_buf));
|
||||
recursive_fetch_tag ("COMPILERS", "=");
|
||||
! Convert all spaces into newlines, then remove any blank lines.
|
||||
pat_replace (SPAN(" "), LINE_END);
|
||||
pat_replace (LINE_BEGIN & LINE_END, );
|
||||
ENDPROCEDURE; !identify_compilers
|
||||
!!
|
||||
|
||||
PROCEDURE additional_compiler( cname, subdir )
|
||||
!
|
||||
! Load Make-lang.in for compiler CNAME from SUBDIR and append it to the
|
||||
! end of Makefile.in's buffer. Add CNAME to the "compilers.list" buffer.
|
||||
!
|
||||
ON_ERROR
|
||||
! Don't abort if user removes the supporting subdirectory for a
|
||||
! language she's not interested in.
|
||||
[TPU$_OPENIN]:
|
||||
MESSAGE ("Cannot load " + subdir + "/Make-lang.in for "
|
||||
+ '"' + cname + '"' + "; skipping it.");
|
||||
RETURN;
|
||||
ENDON_ERROR;
|
||||
|
||||
POSITION (END_OF (makefile_buf));
|
||||
SPLIT_LINE; ! Separate with a blank line.
|
||||
READ_FILE ("[." + subdir + "]Make-lang.in"); ! Load Makefile fragment.
|
||||
! Make sure that $(xxx_OTH_SRCS) expands to empty string by renaming $(it)
|
||||
pat_replace ("_OTH_SRCS)", "_OTH_SRCS_dummy_)");
|
||||
! Convert subdirectory references into VMS syntax.
|
||||
pat_replace ("$(srcdir)/" + subdir + "/", "[." + subdir + "]");
|
||||
|
||||
! Temporary? hack for cp/Make-lang.in's mishandling of "input.c".
|
||||
IF (subdir = 'cp') THEN
|
||||
pat_replace ("[.cp]input.c", ); ! Discard this text.
|
||||
ENDIF;
|
||||
|
||||
! Add this name to compilers.list.
|
||||
POSITION (END_OF (complist_buf));
|
||||
COPY_TEXT (cname);
|
||||
! Make array entry indexed by compiler's file name; its value is arbitrary.
|
||||
extra_compilers{cname} := subdir;
|
||||
ENDPROCEDURE; !additional_compiler
|
||||
!!
|
||||
|
||||
PROCEDURE generate_option_file( tag_name, punct, outfile_name )
|
||||
!
|
||||
! Produce a file listing the names of particular object files, for use
|
||||
! as input to the linker and also for use in finding source names by
|
||||
! make-cc1.com. Generally, any name suffix will be suppressed.
|
||||
!
|
||||
LOCAL range1, range2;
|
||||
|
||||
POSITION (BEGINNING_OF (opt_file_buf));
|
||||
recursive_fetch_tag (tag_name, punct);
|
||||
! First fix up for subdirectory/Make-lang.in.
|
||||
IF (pat_replace ("stamp-objlist" & (SPAN(" ")|LINE_END), " ") > 0) THEN
|
||||
recursive_fetch_tag ("stamp-objlist", ":");
|
||||
ENDIF;
|
||||
! Now fix up a few things in the output buffer.
|
||||
pat_replace ("Makefile" & (SPAN(" ")|LINE_END), " ");
|
||||
!# FILL (CURRENT_BUFFER, " ", 1, 80, 0); ! Condense things a bit.
|
||||
pat_replace ("." & ("o"|"c"|"y") & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END);
|
||||
pat_replace ("." & ("o"|"c"|"y") & SPAN(" "), ",");
|
||||
pat_replace (".h" & (SPAN(" ")|LINE_END), ".h,");
|
||||
! Remove trailing commas, if present.
|
||||
pat_replace ("," & ((SPAN(" ")&LINE_END)|LINE_END), LINE_END);
|
||||
! Get rid of spaces and blank lines.
|
||||
pat_replace (SPAN(" "), LINE_END);
|
||||
pat_replace (LINE_BEGIN & LINE_END, );
|
||||
! Second fix up for subdirectory/Make-lang.in;
|
||||
! avoid "sticky defaults" when linker processes the resulting options file.
|
||||
IF (extra_compilers{outfile_name - "-objs.opt"} <> TPU$K_UNSPECIFIED) THEN
|
||||
POSITION (BEGINNING_OF (opt_file_buf));
|
||||
range1 := CREATE_RANGE (MARK (NONE), END_OF (CURRENT_BUFFER), NONE);
|
||||
LOOP
|
||||
range2 := SEARCH_QUIETLY (LINE_BEGIN | ",", FORWARD, EXACT, range1);
|
||||
EXITIF (range2 = 0);
|
||||
POSITION (BEGINNING_OF (range2));
|
||||
IF (CURRENT_CHARACTER = ",") THEN MOVE_HORIZONTAL (1); ENDIF;
|
||||
! If it's not already "[.subdir]name", explicitly make it "[]name".
|
||||
IF (CURRENT_CHARACTER <> "[") THEN COPY_TEXT ("[]"); ENDIF;
|
||||
MOVE_HORIZONTAL (1);
|
||||
MODIFY_RANGE (range1, MARK (NONE), END_OF (range1));
|
||||
ENDLOOP;
|
||||
ENDIF;
|
||||
! Now write the output file.
|
||||
SET (OUTPUT_FILE, opt_file_buf, outfile_name);
|
||||
WRITE_FILE (opt_file_buf);
|
||||
ERASE (opt_file_buf); ! Clear buffer out for next opt_file pass.
|
||||
ENDPROCEDURE; !generate_option_file
|
||||
!!
|
||||
|
||||
PROCEDURE recursive_fetch_tag( tag_n, punct )
|
||||
!
|
||||
! Look up TAG_N, copy it to OPT_FILE_BUF, and then translate any $(...)
|
||||
! definitions that appear. The translation is put at the current point.
|
||||
!
|
||||
LOCAL mark1, mark2, range1, tag_range, tag_string;
|
||||
|
||||
fetch_tag (tag_n, punct);
|
||||
! Substitute any makefile symbols $(...).
|
||||
POSITION (BEGINNING_OF (CURRENT_BUFFER));
|
||||
LOOP
|
||||
range1 := SEARCH_QUIETLY ("$(" &
|
||||
SPAN("abcdefghijklmnopqrstuvwxyz_ABCDEFGHIJKLMNOPQRSTUVWXYZ#~0123456789")
|
||||
& ")", FORWARD, EXACT);
|
||||
EXITIF (range1 = 0);
|
||||
POSITION (BEGINNING_OF (range1));
|
||||
MOVE_HORIZONTAL (2); ! Past opening "$(".
|
||||
mark1 := MARK (NONE);
|
||||
POSITION (END_OF (range1));
|
||||
MOVE_HORIZONTAL (-1); ! In front of closing ")".
|
||||
mark2 := MARK (NONE);
|
||||
tag_range := CREATE_RANGE (mark1, mark2, NONE);
|
||||
POSITION (END_OF (range1));
|
||||
tag_string := STR (tag_range);
|
||||
ERASE (range1);
|
||||
fetch_tag (tag_string, "=");
|
||||
POSITION (BEGINNING_OF (CURRENT_BUFFER));
|
||||
ENDLOOP;
|
||||
ENDPROCEDURE; !recursive_fetch_tag
|
||||
!!
|
||||
|
||||
PROCEDURE fetch_tag( tag_n, punct )
|
||||
!
|
||||
! Looks up the translation of a tag, and inserts it at the current location
|
||||
! in the buffer.
|
||||
!
|
||||
LOCAL mark0, mark1, mark2, range2;
|
||||
|
||||
mark0 := MARK (NONE); ! Remember where we started; restore before return.
|
||||
POSITION (BEGINNING_OF (makefile_buf));
|
||||
! The tag definition always starts in the first column, and might have
|
||||
! optional space(es) before "=" or ":" punctuation.
|
||||
range2 := SEARCH_QUIETLY (LINE_BEGIN & tag_n & ((SPAN(" ") & punct) | punct),
|
||||
FORWARD, EXACT);
|
||||
IF (range2 = 0) THEN
|
||||
POSITION (mark0);
|
||||
RETURN;
|
||||
ENDIF;
|
||||
POSITION (END_OF (range2));
|
||||
MOVE_HORIZONTAL (1); ! Move beyond "TAG=".
|
||||
mark1 := MARK (NONE);
|
||||
POSITION (BEGINNING_OF (range2));
|
||||
LOOP
|
||||
MOVE_VERTICAL (1);
|
||||
MOVE_HORIZONTAL (-2);
|
||||
EXITIF (CURRENT_CHARACTER <> "\");
|
||||
ERASE_CHARACTER (1);
|
||||
MOVE_HORIZONTAL (1);
|
||||
ENDLOOP;
|
||||
MOVE_HORIZONTAL (1);
|
||||
mark2 := MARK (NONE);
|
||||
range2 := CREATE_RANGE (mark1, mark2, NONE);
|
||||
POSITION (mark0);
|
||||
IF (LENGTH (range2) <> 0) THEN
|
||||
COPY_TEXT (range2);
|
||||
ENDIF;
|
||||
ENDPROCEDURE; !fetch_tag
|
||||
!!
|
||||
|
||||
PROCEDURE pat_replace( oldstring, newstring )
|
||||
!
|
||||
! Replace all occurrences of a pattern.
|
||||
!
|
||||
LOCAL range1, range2, kill_it, count;
|
||||
|
||||
count := 0;
|
||||
kill_it := (GET_INFO (newstring, 'TYPE') = UNSPECIFIED); ! Omitted arg.
|
||||
range1 := CREATE_RANGE (BEGINNING_OF (CURRENT_BUFFER),
|
||||
END_OF (CURRENT_BUFFER), NONE);
|
||||
LOOP
|
||||
range2 := SEARCH_QUIETLY (oldstring, FORWARD, EXACT, range1);
|
||||
EXITIF (range2 = 0);
|
||||
count := count + 1;
|
||||
POSITION (BEGINNING_OF (range2));
|
||||
ERASE (range2);
|
||||
IF (newstring = LINE_END) THEN
|
||||
SPLIT_LINE;
|
||||
ELSE IF (NOT kill_it) THEN
|
||||
COPY_TEXT (newstring);
|
||||
ENDIF; ENDIF;
|
||||
MODIFY_RANGE (range1, MARK (NONE), END_OF (range1));
|
||||
ENDLOOP;
|
||||
RETURN count;
|
||||
ENDPROCEDURE; !pat_replace
|
||||
!!
|
||||
|
||||
!
|
||||
! This is the main routine.
|
||||
!
|
||||
process_makefile ();
|
||||
process_objc_lib (); !this uses a different makefile
|
||||
QUIT; ! All done; don't write any modified buffers.
|
||||
!!
|
||||
$ echo ""
|
||||
$!
|
||||
$! Remove excessive versions of the option files...
|
||||
$!
|
||||
$ purge *.opt,*.list
|
||||
$!
|
||||
$!
|
||||
$!
|
||||
$ if f$search("config.status") .nes. "" then delete config.status.*
|
||||
$ create config.status
|
||||
$ open/append ifile$ config.status
|
||||
$ write ifile$ "Links are now set up for use with a ''arch' running VMS."
|
||||
$ close ifile$
|
||||
$ type config.status
|
||||
$ echo ""
|
||||
$!
|
||||
$ exit
|
||||
$
|
||||
$!
|
||||
$! Construct a header file based on subdirectory contents
|
||||
$!
|
||||
$make_lang_incl: subroutine
|
||||
$ if f$search(p1).nes."" then delete 'p1';*
|
||||
$ create 'p1' !empty file with ordinary text-file attributes
|
||||
$ open/Append ifile$ 'p1'
|
||||
$ write ifile$ "/* ''p1' */"
|
||||
$ hfile = f$search("[]''p1'")
|
||||
$ topdir = f$parse(hfile,,,"DIRECTORY") - "]"
|
||||
$lang_incl_loop:
|
||||
$ hfile = f$search("[.*]lang-''p1'")
|
||||
$ if hfile.eqs."" then goto lang_incl_done
|
||||
$ dir = f$parse(hfile,,,"DIRECTORY") - "]"
|
||||
$! convert absolute path to relative one, yielding "[.subdir]"
|
||||
$ dir = "[" + f$edit(dir - topdir,"LOWERCASE") + "]"
|
||||
$ write ifile$ "#include ""''dir'lang-''p1'"""
|
||||
$ goto lang_incl_loop
|
||||
$lang_incl_done:
|
||||
$ close ifile$
|
||||
$ echo "Created `''p1''."
|
||||
$ endsubroutine !make_lang_incl
|
||||
Reference in New Issue
Block a user