Commit 7061aa5a by Zack Weinberg Committed by Dave Brolley

cpphash.h (union hash_value): Remove `keydef' member, add a `struct hashnode…

cpphash.h (union hash_value): Remove `keydef' member, add a `struct hashnode *aschain' member for #assert.

1998-12-15  Zack Weinberg  <zack@rabi.phys.columbia.edu>
	* cpphash.h (union hash_value): Remove `keydef' member, add a
          `struct hashnode *aschain' member for #assert.
	  * cpplib.c (struct tokenlist_list, struct
          assertion_hashnode): Delete structure definitions.
          (assertion_install, assertion_lookup, delete_assertion,
          check_assertion, compare_token_lists, reverse_token_list,
          read_token_list, free_token_list): Delete functions.
          (parse_assertion): New function.
	  (cpp_cleanup): Don't destroy the assertion_hashtable.
          (do_assert): Gut and rewrite.  #assert foo (bar) places
          entries for `#foo' and `#foo(bar)' in the macro hash table,
          type T_ASSERT.  The value union's `aschain' member is used
          to chain all answers for a given predicate together.
          (do_unassert): Also rewritten.  Take an un-asserted
          answer off the chain from its predicate and call
          delete_macro on the hashnode, or walk a predicate chain
          calling delete_macro on all the entries.
          (cpp_read_check_assertion): Simply call parse_assertion to
          get the canonical assertion name, and look that up in the
          hash table.
	* cpplib.h (ASSERTION_HASHNODE,ASSERTION_HASHSIZE,assertion_hashtab):
 	Removed.
	* cpphash.c (install): Use bcopy instead of an explicit loop
          to copy the macro name.
	* cppexp.c (cpp_lex): Convert the result of
          cpp_read_check_assertion to a `struct operation' directly;
          don't go through parse_number.

From-SVN: r24325
parent 4b259e3f
1998-12-15 Zack Weinberg <zack@rabi.phys.columbia.edu>
* cpphash.h (union hash_value): Remove `keydef' member, add a
`struct hashnode *aschain' member for #assert.
* cpplib.c (struct tokenlist_list, struct
assertion_hashnode): Delete structure definitions.
(assertion_install, assertion_lookup, delete_assertion,
check_assertion, compare_token_lists, reverse_token_list,
read_token_list, free_token_list): Delete functions.
(parse_assertion): New function.
(cpp_cleanup): Don't destroy the assertion_hashtable.
(do_assert): Gut and rewrite. #assert foo (bar) places
entries for `#foo' and `#foo(bar)' in the macro hash table,
type T_ASSERT. The value union's `aschain' member is used
to chain all answers for a given predicate together.
(do_unassert): Also rewritten. Take an un-asserted
answer off the chain from its predicate and call
delete_macro on the hashnode, or walk a predicate chain
calling delete_macro on all the entries.
(cpp_read_check_assertion): Simply call parse_assertion to
get the canonical assertion name, and look that up in the
hash table.
* cpplib.h (ASSERTION_HASHNODE,ASSERTION_HASHSIZE,assertion_hashtab):
Removed.
* cpphash.c (install): Use bcopy instead of an explicit loop
to copy the macro name.
* cppexp.c (cpp_lex): Convert the result of
cpp_read_check_assertion to a `struct operation' directly;
don't go through parse_number.
Tue Dec 15 18:27:39 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* loop.h (struct induction): Delete times_used member.
......
......@@ -274,8 +274,11 @@ cpp_lex (pfile, skip_evaluation)
cpp_skip_hspace (pfile);
c = CPP_BUF_PEEK (CPP_BUFFER (pfile));
if (c == '#')
return parse_number (pfile,
cpp_read_check_assertion (pfile) ? "1" : "0", 1);
{
op.op = INT;
op.value = cpp_read_check_assertion (pfile);
return op;
}
if (c == '\n')
{
......
......@@ -154,7 +154,7 @@ install (name, len, type, ivalue, value, hash)
{
register HASHNODE *hp;
register int i, bucket;
register U_CHAR *p, *q;
register U_CHAR *p;
if (len < 0) {
p = name;
......@@ -182,10 +182,7 @@ install (name, len, type, ivalue, value, hash)
else
hp->value.cpval = value;
hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE);
p = hp->name;
q = name;
for (i = 0; i < len; i++)
*p++ = *q++;
bcopy (name, hp->name, len);
hp->name[len] = 0;
return hp;
}
......
......@@ -4,9 +4,7 @@ union hashval {
int ival;
char *cpval;
DEFINITION *defn;
#if 0
KEYDEF *keydef;
#endif
struct hashnode *aschain; /* for #assert */
};
struct hashnode {
......
......@@ -144,9 +144,6 @@ struct cpp_buffer {
struct cpp_pending; /* Forward declaration - for C++. */
struct file_name_map_list;
typedef struct assertion_hashnode ASSERTION_HASHNODE;
#define ASSERTION_HASHSIZE 37
/* Maximum nesting of cpp_buffers. We use a static limit, partly for
efficiency, and partly to limit runaway recursion. */
#define CPP_STACK_MAX 200
......@@ -230,8 +227,6 @@ struct cpp_reader
struct tm *timebuf;
ASSERTION_HASHNODE *assertion_hashtab[ASSERTION_HASHSIZE];
/* Buffer of -M output. */
char *deps_buffer;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment