summaryrefslogtreecommitdiff
path: root/gcc/cpphash.c
diff options
context:
space:
mode:
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-02 16:09:12 +0000
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-02 16:09:12 +0000
commitd1678bc67c1a9a12253410e4f89a38f715f2a499 (patch)
tree90422d7ae261276adf06a32d02442c9b52f52170 /gcc/cpphash.c
parent9805577e2777772efe3a3b2a9b163fedcd0127b9 (diff)
downloadgcc-d1678bc67c1a9a12253410e4f89a38f715f2a499.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cpphash.c')
-rw-r--r--gcc/cpphash.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/gcc/cpphash.c b/gcc/cpphash.c
index 97ca109cbdd..6ad8350a69f 100644
--- a/gcc/cpphash.c
+++ b/gcc/cpphash.c
@@ -113,7 +113,6 @@ static int dump_hash_helper PARAMS ((void **, void *));
static void push_macro_expansion PARAMS ((cpp_reader *, const U_CHAR *,
int, HASHNODE *));
static int unsafe_chars PARAMS ((cpp_reader *, int, int));
-static int macro_cleanup PARAMS ((cpp_buffer *, cpp_reader *));
static enum cpp_ttype macarg PARAMS ((cpp_reader *, int));
static void special_symbol PARAMS ((cpp_reader *, HASHNODE *));
static int compare_defs PARAMS ((cpp_reader *,
@@ -332,22 +331,6 @@ _cpp_free_definition (h)
h->value.cpval = NULL;
}
-static int
-macro_cleanup (pbuf, pfile)
- cpp_buffer *pbuf;
- cpp_reader *pfile ATTRIBUTE_UNUSED;
-{
- HASHNODE *m = pbuf->macro;
-
- m->disabled = 0;
- if ((m->type == T_FMACRO && pbuf->buf != m->value.fdefn->expansion)
- || m->type == T_SPECLINE || m->type == T_FILE
- || m->type == T_BASE_FILE || m->type == T_INCLUDE_LEVEL
- || m->type == T_STDC)
- free ((PTR) pbuf->buf);
- return 0;
-}
-
/* Create pat nodes. */
static void
@@ -485,7 +468,6 @@ collect_objlike_expansion (pfile, list)
{
switch (list->tokens[i].type)
{
- case CPP_POP:
case CPP_EOF:
cpp_ice (pfile, "EOF in collect_expansion");
/* fall through */
@@ -576,7 +558,6 @@ collect_funlike_expansion (pfile, list, arglist, replacement)
len = list->tokens[i].val.name.len;
switch (token)
{
- case CPP_POP:
case CPP_EOF:
cpp_ice (pfile, "EOF in collect_expansion");
/* fall through */
@@ -1034,14 +1015,9 @@ macarg (pfile, rest_args)
switch (token)
{
case CPP_EOF:
+ /* We've hit end of file; this is an error.
+ Caller will report it. */
return token;
- case CPP_POP:
- /* If we've hit end of file, it's an error (reported by caller).
- Ditto if it's the end of cpp_expand_to_buffer text.
- If we've hit end of macro, just continue. */
- if (!CPP_IS_MACRO_BUFFER (CPP_BUFFER (pfile)))
- return token;
- break;
case CPP_OPEN_PAREN:
paren++;
break;
@@ -1361,7 +1337,7 @@ scan_arguments (pfile, defn, args, name)
}
else
token = macarg (pfile, 0);
- if (token == CPP_EOF || token == CPP_POP)
+ if (token == CPP_EOF)
cpp_error_with_line (pfile, start_line, start_column,
"unterminated macro call");
i++;
@@ -1663,6 +1639,9 @@ funlike_macroexpand (pfile, hp, args)
/* Now put the expansion on the input stack
so our caller will commence reading from it. */
push_macro_expansion (pfile, xbuf, totlen, hp);
+
+ /* Overload buffer->mapped to indicate that xbuf needs to be freed. */
+ CPP_BUFFER (pfile)->mapped = 1;
}
/* Return 1 iff a token ending in C1 followed directly by a token C2
@@ -1771,7 +1750,6 @@ push_macro_expansion (pfile, xbuf, len, hp)
return;
if (advance_cur)
mbuf->cur += 2;
- mbuf->cleanup = macro_cleanup;
mbuf->macro = hp;
mbuf->has_escapes = 1;