Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h are also on line-map.h.
* Makefile.in (CPPLIB_H): New, so that dependencies on cpplib.h
are also on line-map.h.
* cppfiles.c (stack_include_file): Update.
* cpphash.h (struct cpp_buffer): New member return_at_eof.
(_cpp_pop_buffer): New.
* cppinit.c (cpp_destroy, cpp_finish): Update.
(do_includes): Mark each buffer to return at EOF.
* cpplex.c (_cpp_lex_token): Pop buffers at EOF. Continue or
return as requested.
* cpplib.c (run_directive, do_line, cpp_push_buffer): Update.
(cpp_pop_buffer): Rename _cpp_pop_buffer. Stop skipping.
* cpplib.h (cpp_pop_buffer): Remove.
(cpp_scan_buffer_nooutput): Rename cpp_scan_nooutput.
* cppmacro.c (cpp_scan_buffer_nooutput): Similarly. No need to pop
buffers.
* cppmain.c (scan_buffer): Rename scan_translation_unit. No need
to pop buffers.
(do_preprocessing): Update.
* fix-header.c (read_scan_file): Update. No need to pop buffers.
* c-parse.in (_yylex): Similarly.
* scan-decls.c (scan_decls): Similarly.
* line-map.h: Update comments.
* cp/spew.c (read_token): No need to pop buffers.
* objc/Make-lang.in (objc-act.o): Update dependencies.
From-SVN: r44634
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index b3d1c70..76e5355 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -397,7 +397,7 @@
unsigned int output_line = pfile->lexer_pos.output_line;
cpp_buffer *buffer;
- buffer = cpp_push_buffer (pfile, (const U_CHAR *) buf, count, type, 0);
+ buffer = cpp_push_buffer (pfile, (const U_CHAR *) buf, count, type, 0, 1);
if (dir_no == T_PRAGMA)
{
@@ -414,8 +414,7 @@
pfile->state.prevent_expansion--;
check_eol (pfile);
end_directive (pfile, 1);
-
- cpp_pop_buffer (pfile);
+ _cpp_pop_buffer (pfile);
}
/* Checks for validity the macro name in #define, #undef, #ifdef and
@@ -770,7 +769,7 @@
if (reason == LC_ENTER)
{
/* Fake a buffer stack for diagnostics. */
- cpp_push_buffer (pfile, 0, 0, BUF_FAKE, fname);
+ cpp_push_buffer (pfile, 0, 0, BUF_FAKE, fname, 0);
/* Fake an include for cpp_included. */
_cpp_fake_include (pfile, fname);
buffer = pfile->buffer;
@@ -782,7 +781,7 @@
buffer->nominal_fname);
else
{
- cpp_pop_buffer (pfile);
+ _cpp_pop_buffer (pfile);
buffer = pfile->buffer;
#ifdef ENABLE_CHECKING
if (strcmp (buffer->nominal_fname, fname))
@@ -1775,12 +1774,13 @@
doesn't fail. It does not generate a file change call back; that
is the responsibility of the caller. */
cpp_buffer *
-cpp_push_buffer (pfile, buffer, len, type, filename)
+cpp_push_buffer (pfile, buffer, len, type, filename, return_at_eof)
cpp_reader *pfile;
const U_CHAR *buffer;
size_t len;
enum cpp_buffer_type type;
const char *filename;
+ int return_at_eof;
{
cpp_buffer *new = xobnew (&pfile->buffer_ob, cpp_buffer);
@@ -1826,6 +1826,7 @@
new->pfile = pfile;
new->include_stack_listed = 0;
new->lineno = 1;
+ new->return_at_eof = return_at_eof;
pfile->state.next_bol = 1;
pfile->buffer_stack_depth++;
@@ -1837,8 +1838,8 @@
/* If called from do_line, pops a single buffer. Otherwise pops all
buffers until a real file is reached. Generates appropriate
call-backs. */
-cpp_buffer *
-cpp_pop_buffer (pfile)
+void
+_cpp_pop_buffer (pfile)
cpp_reader *pfile;
{
cpp_buffer *buffer;
@@ -1884,7 +1885,8 @@
}
obstack_free (&pfile->buffer_ob, buffer);
- return pfile->buffer;
+
+ pfile->state.skipping = 0; /* In case missing #endif. */
}
void