aboutsummaryrefslogtreecommitdiff
path: root/gcc/fix-header.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-02 16:09:12 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-02 16:09:12 +0000
commitc56c2073a6268960931acd0b852b6186d4bde179 (patch)
tree90422d7ae261276adf06a32d02442c9b52f52170 /gcc/fix-header.c
parent753e6cf1b64ccc2e8f7946d4a7a010f82ff99c31 (diff)
downloadgcc-c56c2073a6268960931acd0b852b6186d4bde179.zip
gcc-c56c2073a6268960931acd0b852b6186d4bde179.tar.gz
gcc-c56c2073a6268960931acd0b852b6186d4bde179.tar.bz2
cpplib.h (CPP_POP, [...]): Delete.
* cpplib.h (CPP_POP, parse_cleanup_t): Delete. (cpp_buffer): Remove cleanup, seen_eof, manual_pop members. * cppfiles.c (file_cleanup): Delete. * cpphash.c (macro_cleanup): Delete. (collect_objlike_expansion, collect_funlike_expansion, macarg, scan_arguments): Remove CPP_POP case. * cpplex.c (null_cleanup): Delete. (cpp_pop_buffer): Do the work that was done in the cleanups here. Call _cpp_unwind_if_stack from here. (_cpp_expand_to_buffer, cpp_scan_buffer_nooutput, cpp_scan_buffer): Run until we see CPP_EOF and the top of stack is the buffer _below_ the one we stacked. (cpp_get_token): Always pop an exhausted buffer. Return CPP_EOF unless it's a macro buffer. Don't call _cpp_handle_eof. * cpplib.c (skip_if_group): Don't call cpp_get_token to increment the line number. (_cpp_handle_eof): Rename to _cpp_unwind_if_stack. * fix-header.c (read_scan_file) [parsing getchar()]: Run until we see CPP_EOF and the top of stack is the buffer _below_ the one we stacked. * scan-decls.c: Likewise. From-SVN: r33611
Diffstat (limited to 'gcc/fix-header.c')
-rw-r--r--gcc/fix-header.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/gcc/fix-header.c b/gcc/fix-header.c
index 29b4d35..3740ce0 100644
--- a/gcc/fix-header.c
+++ b/gcc/fix-header.c
@@ -658,10 +658,12 @@ read_scan_file (in_fname, argc, argv)
&& (fn = lookup_std_proto ("_filbuf", 7)) != NULL)
{
static char getchar_call[] = "getchar();";
- cpp_buffer *buf
- = cpp_push_buffer (&scan_in, getchar_call, sizeof(getchar_call) - 1);
int old_written = CPP_WRITTEN (&scan_in);
int seen_filbuf = 0;
+ cpp_buffer *buf = CPP_BUFFER (&scan_in);
+ if (cpp_push_buffer (&scan_in, getchar_call,
+ sizeof(getchar_call) - 1) == NULL)
+ return;
/* Scan the macro expansion of "getchar();". */
for (;;)
@@ -671,13 +673,8 @@ read_scan_file (in_fname, argc, argv)
unsigned char *id = scan_in.token_buffer + old_written;
CPP_SET_WRITTEN (&scan_in, old_written);
- if (token == CPP_EOF) /* Should not happen ... */
+ if (token == CPP_EOF && CPP_BUFFER (&scan_in) == buf)
break;
- if (token == CPP_POP && CPP_BUFFER (&scan_in) == buf)
- {
- cpp_pop_buffer (&scan_in);
- break;
- }
if (token == CPP_NAME && cpp_idcmp (id, length, "_filbuf") == 0)
seen_filbuf++;
}