]> gcc.gnu.org Git - gcc.git/commitdiff
(do_include): For VMS...
authorRichard Kenner <kenner@gcc.gnu.org>
Wed, 25 Jan 1995 22:06:11 +0000 (17:06 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 25 Jan 1995 22:06:11 +0000 (17:06 -0500)
(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

gcc/cccp.c

index d72c05501fc224934b0f38ccd3c8151448ad6184..4171f4b36b04580a57a59f98db2e8759fd5eb562 100644 (file)
@@ -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>' !");
This page took 0.075798 seconds and 5 git commands to generate.