This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

kill hack_vms_include_specification


This patch removes the hack_vms_include_specification function from
cppfiles.c.  It has been #ifdefed out since 1998 and no one has
objected.  Further, looking at some VMS documentation, it appears
that their C library now translates Unix to VMS pathnames for you, so
we need not bother.

I'm genuinely curious: is there anyone out there using GCC on VMS,
still?

Since the patch consists entirely of removal of #if 0 blocks, I did
not bother to do a complete bootstrap, but I did compile libcpp after
the changes.

zw

	* cppfiles.c (hack_vms_include_specification): Delete function
	(not used since 1998).

===================================================================
Index: cppfiles.c
--- cppfiles.c	2000/12/13 19:20:14	1.93
+++ cppfiles.c	2000/12/15 04:43:40
@@ -107,10 +107,6 @@ static void purge_cache 	PARAMS ((struct
 static void destroy_include_file_node	PARAMS ((splay_tree_value));
 static int report_missing_guard		PARAMS ((splay_tree_node, void *));
 
-#if 0
-static void hack_vms_include_specification PARAMS ((char *));
-#endif
-
 /* We use a splay tree to store information about all the include
    files seen in this compilation.  The key of each tree node is the
    physical path to the file.  The value is 0 if the file does not
@@ -1170,279 +1166,3 @@ _cpp_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 = strchr (fullname, '/');
-  if (first_slash == 0)
-    return 0;				/* Nothing to do!!! */
-
-  /* construct device spec if none given.  */
-
-  if (strchr (fullname, ':') == 0)
-    {
-
-      /* If fullname has a slash, take it as device spec.  */
-
-      if (first_slash == fullname)
-	{
-	  first_slash = strchr (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,
-	   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 (strchr (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 (strchr (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|O_NONBLOCK);
-      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 = strchr (fullname, '[');
-      local_ptr = strchr (fullname, ']') + 1;
-      strcpy (basename, local_ptr);		/* this gets rid of it */
-
-    }
-
-  return 1;
-}
-#endif	/* VMS */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]