cpplex.c (_cpp_scan_until): Clear AUX field of tokens.

* cpplex.c (_cpp_scan_until): Clear AUX field of tokens.
	* cpplib.c (do_unassert): Put the list to compare against on
	the stack.

From-SVN: r34025
This commit is contained in:
Zack Weinberg 2000-05-19 16:18:43 +00:00 committed by Zack Weinberg
parent ec5bb3cfb0
commit a58f64f5c2
3 changed files with 16 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2000-05-19 Zack Weinberg <zack@wolery.cumb.org>
* cpplex.c (_cpp_scan_until): Clear AUX field of tokens.
* cpplib.c (do_unassert): Put the list to compare against on
the stack.
2000-05-19 Bruce Korb <bkorb@gnu.org> 2000-05-19 Bruce Korb <bkorb@gnu.org>
* fixinc/README: cleaned up old documentation * fixinc/README: cleaned up old documentation

View File

@ -790,6 +790,7 @@ _cpp_scan_until (pfile, list, stop)
list->tokens_used++; list->tokens_used++;
TOK_TYPE (list, i) = type; TOK_TYPE (list, i) = type;
TOK_COL (list, i) = col; TOK_COL (list, i) = col;
TOK_AUX (list, i) = 0;
TOK_FLAGS (list, i) = space_before ? PREV_WHITESPACE : 0; TOK_FLAGS (list, i) = space_before ? PREV_WHITESPACE : 0;
TOK_LEN (list, i) = len; TOK_LEN (list, i) = len;

View File

@ -1607,8 +1607,9 @@ do_unassert (pfile)
U_CHAR *sym; U_CHAR *sym;
size_t len; size_t len;
HASHNODE *hp; HASHNODE *hp;
struct predicate *pred = 0; cpp_toklist ans;
enum cpp_ttype type; enum cpp_ttype type;
int specific = 0;
old_written = CPP_WRITTEN (pfile); old_written = CPP_WRITTEN (pfile);
pfile->no_macro_expand++; pfile->no_macro_expand++;
@ -1624,10 +1625,10 @@ do_unassert (pfile)
type = _cpp_get_directive_token (pfile); type = _cpp_get_directive_token (pfile);
if (type == CPP_OPEN_PAREN) if (type == CPP_OPEN_PAREN)
{ {
pred = (struct predicate *) xmalloc (sizeof (struct predicate)); specific = 1;
_cpp_init_toklist (&pred->answer); _cpp_init_toklist (&ans);
if (_cpp_scan_until (pfile, &pred->answer, CPP_CLOSE_PAREN) if (_cpp_scan_until (pfile, &ans, CPP_CLOSE_PAREN)
!= CPP_CLOSE_PAREN) != CPP_CLOSE_PAREN)
ERROR ("missing close paren in #unassert"); ERROR ("missing close paren in #unassert");
@ -1645,13 +1646,13 @@ do_unassert (pfile)
goto error to clean up. */ goto error to clean up. */
goto error; goto error;
if (pred) if (specific)
{ {
/* Find this specific answer and remove it. */ /* Find this specific answer and remove it. */
struct predicate *o, *p; struct predicate *o, *p;
for (p = NULL, o = hp->value.pred; o; p = o, o = o->next) for (p = NULL, o = hp->value.pred; o; p = o, o = o->next)
if (_cpp_equiv_toklists (&pred->answer, &o->answer)) if (_cpp_equiv_toklists (&ans, &o->answer))
{ {
if (p) if (p)
p->next = o->next; p->next = o->next;
@ -1682,11 +1683,8 @@ do_unassert (pfile)
_cpp_skip_rest_of_line (pfile); _cpp_skip_rest_of_line (pfile);
pfile->no_macro_expand--; pfile->no_macro_expand--;
CPP_SET_WRITTEN (pfile, old_written); CPP_SET_WRITTEN (pfile, old_written);
if (pred) if (specific)
{ _cpp_free_toklist (&ans);
_cpp_free_toklist (&pred->answer);
free (pred);
}
return 0; return 0;
} }