[VMS/committed]: Follow VMS name rules more closely for module include files

Tristan Gingold gingold@adacore.com
Fri Mar 9 10:13:00 GMT 2012


Hi,

on VMS systems, the systems headers are in text archives.  We require that these headers are unarchived, but we also need to follow more closely the naming rules.
In particular, directories and suffixes are stripped when DEC-C looks in archives, and the archives are case insensitive.
To follow that, the patch uses the lower case base name of the file with the .h extension when looking for files in module directories.

Simply building building gcc for VMS tests this patch as there is at least an '#include <sys/types.h>' instance.  (Before, the trick was to add a symlink).

Committed on trunk.

Tristan.

2012-03-09  Tristan Gingold  <gingold@adacore.com>

	* config/vms/vms-c.c (vms_construct_include_filename): New function.
	(vms_c_register_includes): Reference it.

Index: vms-c.c
===================================================================
--- vms-c.c	(revision 185132)
+++ vms-c.c	(working copy)
@@ -304,6 +304,36 @@
   c_register_pragma (NULL, "__extern_prefix", vms_pragma_extern_prefix);
 }
 
+/* Canonicalize the filename (remove directory prefix, force the .h extension),
+   and append it to the directory to create the path, but don't
+   turn / into // or // into ///; // may be a namespace escape.  */
+
+static char *
+vms_construct_include_filename (const char *fname, cpp_dir *dir)
+{
+  size_t dlen, flen;
+  char *path;
+  const char *fbasename = lbasename (fname);
+  size_t i;
+
+  dlen = dir->len;
+  flen = strlen (fbasename) + 2;
+  path = XNEWVEC (char, dlen + 1 + flen + 1);
+  memcpy (path, dir->name, dlen);
+  if (dlen && !IS_DIR_SEPARATOR (path[dlen - 1]))
+    path[dlen++] = '/';
+  for (i = 0; i < flen; i++)
+    if (fbasename[i] == '.')
+      break;
+    else
+      path[dlen + i] = TOLOWER (fbasename[i]);
+  path[dlen + i + 0] = '.';
+  path[dlen + i + 1] = 'h';
+  path[dlen + i + 2] = 0;
+
+  return path;
+}
+
 /* Standard modules list.  */
 static const char * const vms_std_modules[] = { "rtldef", "starlet_c", NULL };
 
@@ -341,7 +371,7 @@
               p->next = NULL;
               p->name = path;
               p->sysp = 1;
-              p->construct = 0;
+              p->construct = vms_construct_include_filename;
               p->user_supplied_p = 0;
               add_cpp_dir_path (p, SYSTEM);
             }



More information about the Gcc-patches mailing list