aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-03-12 07:37:03 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-03-12 07:37:03 -0500
commitfe701b404f269296665a5f509f22b028ef506cfa (patch)
treeaa4343954fd66b02124c48eedf3e144fbf05a1e9
parenta32b8cbac844a735becffe2c5becf1d3459effa6 (diff)
downloadgcc-fe701b404f269296665a5f509f22b028ef506cfa.zip
gcc-fe701b404f269296665a5f509f22b028ef506cfa.tar.gz
gcc-fe701b404f269296665a5f509f22b028ef506cfa.tar.bz2
(do_include, hack-vms_include_specification): Change handling of
'#include filename' to be compatible with VAX-C. From-SVN: r6756
-rw-r--r--gcc/cccp.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/gcc/cccp.c b/gcc/cccp.c
index a37ab31..6a6b9f1 100644
--- a/gcc/cccp.c
+++ b/gcc/cccp.c
@@ -4028,6 +4028,26 @@ get_filename:
goto fail;
default:
+#ifdef VMS
+ /*
+ * 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.
+ */
+ if (isalpha(*(--fbeg))) {
+ fend = fbeg;
+ while (fend != limit && (!isspace(*fend))) fend++;
+ warning ("VAX-C-style include specification found, use '#include <filename.h>' !");
+ if (fend == limit) {
+ angle_brackets = 1;
+ /* If -I-, start with the first -I dir after the -I-. */
+ if (first_bracket_include)
+ search_start = first_bracket_include;
+ break;
+ }
+ }
+#endif
+
fail:
if (retried) {
error ("`#%s' expects \"FILENAME\" or <FILENAME>", keyword->name);
@@ -4067,8 +4087,9 @@ get_filename:
/* Allocate this permanently, because it gets stored in the definitions
of macros. */
- fname = (char *) xmalloc (max_include_len + flen + 2);
+ fname = (char *) xmalloc (max_include_len + flen + 4);
/* + 2 above for slash and terminating null. */
+ /* + 2 added for '.h' on VMS (to support '#include filename') */
/* If specified file name is absolute, just open it. */
@@ -4111,6 +4132,10 @@ get_filename:
/* This is a normal VMS filespec, so use it unchanged. */
strncpy (fname, fbeg, flen);
fname[flen] = 0;
+ /* if it's '#include filename', add the missing .h */
+ if (index(fname,'.')==NULL) {
+ strcat (fname, ".h");
+ }
}
#endif /* VMS */
if (importing)
@@ -9379,6 +9404,18 @@ hack_vms_include_specification (fname)
cp = index (fname, '/'); /* Look for the "/" */
}
+ /*
+ * Check if we have a vax-c style '#include filename'
+ * and add the missing .h
+ */
+ if (cp == 0) {
+ if (index(fname,'.') == 0)
+ strcat(fname, ".h");
+ } else {
+ if (index(cp,'.') == 0)
+ strcat(cp, ".h");
+ }
+
cp2 = Local; /* initialize */
/* We are trying to do a number of things here. First of all, we are