aboutsummaryrefslogtreecommitdiff
path: root/gcc/cccp.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-01-25 17:06:11 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1995-01-25 17:06:11 -0500
commit71efde97f42ec268edf3b4b5fc3b4e959312cb9f (patch)
tree2fa2d0834d249bce3d79bef7b7041be19b691236 /gcc/cccp.c
parent3a887df45563f1d343889e5fd22dcb2cbcfbaece (diff)
downloadgcc-71efde97f42ec268edf3b4b5fc3b4e959312cb9f.zip
gcc-71efde97f42ec268edf3b4b5fc3b4e959312cb9f.tar.gz
gcc-71efde97f42ec268edf3b4b5fc3b4e959312cb9f.tar.bz2
(do_include): For VMS...
(do_include): For VMS, don't attempt to treat `#include X' as `#include <X.h>' unless `X' has already been macro expanded. (main): For VMS, do a better job of picking out the base name from argv[0]'s absolute name. From-SVN: r8820
Diffstat (limited to 'gcc/cccp.c')
-rw-r--r--gcc/cccp.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index d72c055..4171f4b 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -1149,16 +1149,19 @@ main (argc, argv)
#ifdef VMS
{
/* Remove directories from PROGNAME. */
- char *s;
-
- progname = savestring (argv[0]);
-
- if (!(s = rindex (progname, ']')))
- s = rindex (progname, ':');
- if (s)
- strcpy (progname, s+1);
- if (s = rindex (progname, '.'))
- *s = '\0';
+ char *s = progname;
+
+ if ((p = rindex (s, ':')) != 0) s = p + 1; /* skip device */
+ if ((p = rindex (s, ']')) != 0) s = p + 1; /* skip directory */
+ if ((p = rindex (s, '>')) != 0) s = p + 1; /* alternate (int'n'l) dir */
+ s = progname = savestring (s);
+ 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
@@ -4178,8 +4181,9 @@ get_filename:
* 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.)
*/
- if (isalpha(*(--fbeg))) {
+ if (retried && isalpha(*(--fbeg))) {
fend = fbeg;
while (fend != limit && (!isspace(*fend))) fend++;
warning ("VAX-C-style include specification found, use '#include <filename.h>' !");