summaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-04 12:01:59 +0000
committerneil <neil@138bc75d-0d04-0410-961f-82ee72b054a4>2001-08-04 12:01:59 +0000
commit4dfe8b745ff717c66fab3bc5d759a1d862ddd074 (patch)
tree0aaaf48e2153d5621bc68cb09f9c0d2ef9a3854a /gcc/cpplib.c
parent3cbe3ca9fef6daf335579b8cee2b0fe6fbfe9877 (diff)
downloadgcc-4dfe8b745ff717c66fab3bc5d759a1d862ddd074.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44634 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index b3d1c701794..76e5355d740 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -397,7 +397,7 @@ run_directive (pfile, dir_no, type, buf, count)
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 @@ run_directive (pfile, dir_no, type, buf, count)
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 @@ do_line (pfile)
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 @@ do_line (pfile)
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 @@ cpp_set_callbacks (pfile, cb)
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 @@ cpp_push_buffer (pfile, buffer, len, type, filename)
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 @@ cpp_push_buffer (pfile, buffer, len, type, filename)
/* 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 @@ cpp_pop_buffer (pfile)
}
obstack_free (&pfile->buffer_ob, buffer);
- return pfile->buffer;
+
+ pfile->state.skipping = 0; /* In case missing #endif. */
}
void