From: Richard Kenner Date: Wed, 25 Jan 1995 22:06:11 +0000 (-0500) Subject: (do_include): For VMS... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=71efde97f42ec268edf3b4b5fc3b4e959312cb9f;p=gcc.git (do_include): For VMS... (do_include): For VMS, don't attempt to treat `#include X' as `#include ' 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 --- diff --git a/gcc/cccp.c b/gcc/cccp.c index d72c05501fc..4171f4b36b0 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 ' (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 ' !");