aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-04-23 17:03:31 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-04-23 17:03:31 +0000
commitd9e0bd53b2da36f66fcd18b168b354612ef7f4df (patch)
treedce0dfebe9bc09562c88a4bc2be4eecd8f6147d6 /gcc/cpphash.h
parent3c8c10b8c691cd1f8111f4eaf50ff22beadc0088 (diff)
downloadgcc-d9e0bd53b2da36f66fcd18b168b354612ef7f4df.zip
gcc-d9e0bd53b2da36f66fcd18b168b354612ef7f4df.tar.gz
gcc-d9e0bd53b2da36f66fcd18b168b354612ef7f4df.tar.bz2
cpphash.h (struct definition): Move file, line, col members...
* cpphash.h (struct definition): Move file, line, col members... (struct hashnode): ... here. Also add 'disabled' flag. (enum node_type): Add T_VOID, T_XCONST, T_FMACRO, and T_IDENTITY. Remove T_DISABLED. Update prototypes. * cpphash.c (_cpp_dump_definition): Split out dump_DEFINITION. (collect_expansion): Split into collect_objlike_expansion and collect_funlike_expansion. (_cpp_macroexpand): Split out scan_arguments, stringify, and funlike_macroexpand. (_cpp_compare_defs): Rename compare_defs, make static. (_cpp_make_hashnode): Initialize hp->disabled. (macro_cleanup): Adjust for new token types. Clear m->disabled. (_cpp_create_definition): Move code here to determine what sort of macro it is, and code to check for redefinitions, from do_define. Implement a few simple cases without creating a full DEFINITION. (_cpp_macroexpand, special_symbol, _cpp_dump_definition): Handle the simple cases. (push_macro_expansion): Set buf->has_escapes and hp->disabled here. * cppinit.c (builtin_array): Change MCONST to XCONST everywhere. * cpplex.c (maybe_macroexpand): Handle IDENTITY macros here; fix check for disabled and function-like macros. * cpplib.c (do_define): Move most logic to _cpp_create_definition. (do_undef): Handle new special token types. From-SVN: r33355
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h28
1 files changed, 15 insertions, 13 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 2b8a5d1..78185f2 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -64,9 +64,6 @@ struct definition
int nargs;
int length; /* length of expansion string */
U_CHAR *expansion;
- int line; /* Line number of definition */
- int col;
- const char *file; /* File of definition */
char rest_args; /* Nonzero if last arg. absorbs the rest */
struct reflist *pattern;
@@ -86,6 +83,7 @@ struct definition
/* different flavors of hash nodes */
enum node_type
{
+ T_VOID = 0, /* no definition yet */
T_SPECLINE, /* `__LINE__' */
T_DATE, /* `__DATE__' */
T_FILE, /* `__FILE__' */
@@ -94,10 +92,12 @@ enum node_type
T_TIME, /* `__TIME__' */
T_STDC, /* `__STDC__' */
T_CONST, /* Constant string, used by `__SIZE_TYPE__' etc */
- T_MCONST, /* Ditto, but the string is malloced memory */
- T_MACRO, /* macro defined by `#define' */
- T_DISABLED, /* macro temporarily turned off for rescan */
- T_POISON, /* macro defined with `#pragma poison' */
+ T_XCONST, /* Ditto, but the string is malloced memory */
+ T_POISON, /* poisoned identifier */
+ T_MCONST, /* object-like macro defined to a single identifier */
+ T_MACRO, /* general object-like macro */
+ T_FMACRO, /* general function-like macro */
+ T_IDENTITY, /* macro defined to itself */
T_EMPTY /* macro defined to nothing */
};
@@ -118,6 +118,11 @@ struct hashnode
unsigned long hash; /* cached hash value */
union hashval value; /* pointer to expansion, or whatever */
enum node_type type; /* type of special token */
+ int disabled; /* macro turned off for rescan? */
+
+ const char *file; /* File, line, column of definition; */
+ int line;
+ int col;
};
/* List of directories to look for include files in. */
@@ -272,12 +277,9 @@ extern HASHNODE **_cpp_lookup_slot PARAMS ((cpp_reader *,
enum insert_option,
unsigned long *));
extern void _cpp_free_definition PARAMS ((DEFINITION *));
-extern DEFINITION *_cpp_create_definition PARAMS ((cpp_reader *,
- cpp_toklist *, int));
-extern void _cpp_dump_definition PARAMS ((cpp_reader *, const U_CHAR *,
- long, DEFINITION *));
-extern int _cpp_compare_defs PARAMS ((cpp_reader *, DEFINITION *,
- DEFINITION *));
+extern int _cpp_create_definition PARAMS ((cpp_reader *,
+ cpp_toklist *, HASHNODE *));
+extern void _cpp_dump_definition PARAMS ((cpp_reader *, HASHNODE *));
extern void _cpp_quote_string PARAMS ((cpp_reader *, const char *));
extern void _cpp_macroexpand PARAMS ((cpp_reader *, HASHNODE *));
extern void _cpp_init_macro_hash PARAMS ((cpp_reader *));