aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.phys.columbia.edu>1998-12-16 13:23:47 +0000
committerDave Brolley <brolley@gcc.gnu.org>1998-12-16 08:23:47 -0500
commit692b872ea05eef4d95c608e485e681a3295a0cad (patch)
tree0b4f5e9a75ded165e3453ee3a5091359ad1bdbe7 /gcc
parent36b8337d5c3d2a64a32883f1a372db98482828c7 (diff)
downloadgcc-692b872ea05eef4d95c608e485e681a3295a0cad.zip
gcc-692b872ea05eef4d95c608e485e681a3295a0cad.tar.gz
gcc-692b872ea05eef4d95c608e485e681a3295a0cad.tar.bz2
cpplib.c (do_include): Treat #include_next in the primary source file as #include plus warning.
1998-12-16 Zack Weinberg <zack@rabi.phys.columbia.edu> * cpplib.c (do_include): Treat #include_next in the primary source file as #include plus warning. Treat #include_next in a file included by absolute path as an error. fp == CPP_NULL_BUFFER is a fatal inconsistency. From-SVN: r24340
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/cpplib.c26
2 files changed, 26 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 800d6ba..f1e873a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+1998-12-16 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * cpplib.c (do_include): Treat #include_next in the
+ primary source file as #include plus warning. Treat
+ #include_next in a file included by absolute path as an
+ error. fp == CPP_NULL_BUFFER is a fatal inconsistency.
+
Wed Dec 16 12:28:54 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cccp.c: Don't define MIN/MAX anymore.
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 63c9ff1..932f222 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -2969,17 +2969,25 @@ do_include (pfile, keyword)
break;
if (fp == CPP_NULL_BUFFER (pfile))
- fp = NULL;
+ {
+ cpp_fatal (pfile, "cpp internal error: fp == NULL_BUFFER in do_include");
+ return 1;
+ }
- /* For #include_next, skip in the search path
- past the dir in which the containing file was found. */
- if (skip_dirs)
+ /* For #include_next, skip in the search path past the dir in which the
+ containing file was found. Treat files specified using an absolute path
+ as if there are no more directories to search. Treat the primary source
+ file like any other included source, but generate a warning. */
+ if (skip_dirs && CPP_PREV_BUFFER(fp) != CPP_NULL_BUFFER (pfile))
{
- if (fp)
+ if (fp->ihash->foundhere != ABSOLUTE_PATH)
search_start = fp->ihash->foundhere->next;
}
else
{
+ if (skip_dirs)
+ cpp_warning (pfile, "#include_next in primary source file");
+
if (angle_brackets)
search_start = CPP_OPTIONS (pfile)->bracket_include;
else
@@ -4730,8 +4738,12 @@ cpp_start_read (pfile, fname)
fp = cpp_push_buffer (pfile, NULL, 0);
if (!fp)
return 0;
- if (opts->in_fname == NULL)
- opts->in_fname = "";
+ if (opts->in_fname == NULL || *opts->in_fname == 0)
+ {
+ opts->in_fname = fname;
+ if (opts->in_fname == NULL)
+ opts->in_fname = "";
+ }
fp->nominal_fname = fp->fname = opts->in_fname;
fp->lineno = 0;