aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 571e204..963ab9b 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -619,7 +619,14 @@ do_include_next (pfile)
cpp_token header;
if (!parse_include (pfile, &header))
- _cpp_execute_include (pfile, &header, 0, 1);
+ {
+ /* If this is the primary source file, warn and use the normal
+ search logic. */
+ if (! pfile->buffer->prev)
+ cpp_warning (pfile, "#include_next in primary source file");
+
+ _cpp_execute_include (pfile, &header, 0, pfile->buffer->prev != 0);
+ }
}
/* Subroutine of do_line. Read possible flags after file name. LAST