aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-04-29 20:58:12 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-04-29 20:58:12 +0000
commit5cebbd8de37bec65562d047500b13d93c6ad839f (patch)
tree3485b8cc5bd488923ed2e4a7685f61b49bd637e6 /gcc/cpphash.h
parent0bf0f02717e5029aed0aacda9198e05d7c1d2c2d (diff)
downloadgcc-5cebbd8de37bec65562d047500b13d93c6ad839f.zip
gcc-5cebbd8de37bec65562d047500b13d93c6ad839f.tar.gz
gcc-5cebbd8de37bec65562d047500b13d93c6ad839f.tar.bz2
cpphash.h: Move struct reflist, struct definition, and the DEFINITION typedef to cpphash.c.
* cpphash.h: Move struct reflist, struct definition, and the DEFINITION typedef to cpphash.c. Use 'struct definition *' in union hashval. _cpp_free_definition takes a HASHNODE pointer. * cpphash.c (_cpp_free_definition): Free data pointed to by MCONST, XCONST, MACRO, and FMACRO nodes properly. (_cpp_create_definition, del_HASHNODE): Just call _cpp_free_definition to clear out a hashnode. * cpplib.c (do_pragma_poison): Likewise. From-SVN: r33536
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h53
1 files changed, 2 insertions, 51 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 2d2ea8d..498dee5 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -24,55 +24,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned char U_CHAR;
-/* Structure allocated for every #define. For a simple replacement
- such as
- #define foo bar ,
- nargs = -1, the `pattern' list is null, and the expansion is just
- the replacement text. Nargs = 0 means a functionlike macro with no args,
- e.g.,
- #define getchar() getc (stdin) .
- When there are args, the expansion is the replacement text with the
- args squashed out, and the reflist is a list describing how to
- build the output from the input: e.g., "3 chars, then the 1st arg,
- then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
- The chars here come from the expansion. Whatever is left of the
- expansion after the last arg-occurrence is copied after that arg.
- Note that the reflist can be arbitrarily long---
- its length depends on the number of times the arguments appear in
- the replacement text, not how many args there are. Example:
- #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
- pattern list
- { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
- where (x, y) means (nchars, argno). */
-
-struct reflist
-{
- struct reflist *next;
- char stringify; /* nonzero if this arg was preceded by a
- # operator. */
- char raw_before; /* Nonzero if a ## operator before arg. */
- char raw_after; /* Nonzero if a ## operator after arg. */
- char rest_args; /* Nonzero if this arg. absorbs the rest */
- int nchars; /* Number of literal chars to copy before
- this arg occurrence. */
- int argno; /* Number of arg to substitute (origin-0) */
-};
-
-typedef struct definition DEFINITION;
-struct definition
-{
- int nargs;
- int length; /* length of expansion string */
- U_CHAR *expansion;
- char rest_args; /* Nonzero if last arg. absorbs the rest */
- struct reflist *pattern;
-
- /* Names of macro args, concatenated in order with \0 between
- them. The only use of this is that we warn on redefinition if
- this differs between the old and new definitions. */
- U_CHAR *argnames;
-};
-
/* The structure of a node in the hash table. The hash table
has entries for all tokens defined by #define commands (type T_MACRO),
plus some special tokens like __LINE__ (these each have their own
@@ -106,7 +57,7 @@ enum node_type
union hashval
{
const char *cpval; /* some predefined macros */
- DEFINITION *defn; /* #define */
+ struct definition *defn; /* #define */
struct hashnode *aschain; /* #assert */
};
@@ -276,7 +227,7 @@ extern HASHNODE **_cpp_lookup_slot PARAMS ((cpp_reader *,
const U_CHAR *, int,
enum insert_option,
unsigned long *));
-extern void _cpp_free_definition PARAMS ((DEFINITION *));
+extern void _cpp_free_definition PARAMS ((HASHNODE *));
extern int _cpp_create_definition PARAMS ((cpp_reader *,
cpp_toklist *, HASHNODE *));
extern void _cpp_dump_definition PARAMS ((cpp_reader *, HASHNODE *));