aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-28 05:56:38 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-28 05:56:38 +0000
commitf8f769ea4e694c516b9631ae8f2215cc6d5fb96f (patch)
tree2f5db92bd0f352a3b3a9f86ac6b719d86650e290 /gcc/cpphash.h
parente79f71f73dd44748c28d7f94b29d293722345e26 (diff)
downloadgcc-f8f769ea4e694c516b9631ae8f2215cc6d5fb96f.zip
gcc-f8f769ea4e694c516b9631ae8f2215cc6d5fb96f.tar.gz
gcc-f8f769ea4e694c516b9631ae8f2215cc6d5fb96f.tar.bz2
cppfiles.c: Read files in, using mmap if possible, then prescan them separately.
* cppfiles.c: Read files in, using mmap if possible, then prescan them separately. (read_file, read_with_read): New functions. * cpplex.c: Don't define UCHAR_MAX. (_cpp_read_and_prescan): Rename to _cpp_prescan. Don't read the file here. * cppinit.c (handle_option): Automatically define __cplusplus, __OBJC__, __ASEEMBLER__, _LANGUAGE_FORTRAN here when we see the respective -lang switch. * cpphash.h (enum node_type, struct hashnode, _cpp_lookup prototype): Move to... * cpplib.h: ... here. Rename struct hashnode to struct cpp_hashnode and give it a typedef. Rename _cpp_lookup to cpp_lookup. Add 'fe_value' slot, a union tree_node *. From-SVN: r34228
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h67
1 files changed, 9 insertions, 58 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index afa5d92..c590de6 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -25,52 +25,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
typedef unsigned char U_CHAR;
#define U (const U_CHAR *) /* Intended use: U"string" */
-/* 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
- type, and the appropriate code is run when that type of node is seen.
- It does not contain control words like "#define", which are recognized
- by a separate piece of code. */
-
-/* different flavors of hash nodes */
-enum node_type
-{
- T_VOID = 0, /* no definition yet */
- T_SPECLINE, /* `__LINE__' */
- T_DATE, /* `__DATE__' */
- T_FILE, /* `__FILE__' */
- T_BASE_FILE, /* `__BASE_FILE__' */
- T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
- T_TIME, /* `__TIME__' */
- T_STDC, /* `__STDC__' */
- T_CONST, /* Constant string, used by `__SIZE_TYPE__' etc */
- T_XCONST, /* Ditto, but the string is malloced memory */
- T_POISON, /* poisoned identifier */
- T_MACRO, /* object-like macro */
- T_FMACRO, /* function-like macro */
- T_IDENTITY, /* macro defined to itself */
- T_EMPTY, /* macro defined to nothing */
- T_ASSERTION /* predicate for #assert */
-};
-
-typedef struct hashnode HASHNODE;
-struct hashnode
-{
- unsigned int hash; /* cached hash value */
- unsigned short length; /* length of name */
- ENUM_BITFIELD(node_type) type : 8; /* node type */
- char disabled; /* macro turned off for rescan? */
-
- union {
- const U_CHAR *cpval; /* some predefined macros */
- const struct object_defn *odefn; /* #define foo bar */
- const struct funct_defn *fdefn; /* #define foo(x) bar(x) */
- struct predicate *pred; /* #assert */
- } value;
-
- const U_CHAR name[1]; /* name[length] */
-};
-
/* Structure used for assertion predicates. */
struct predicate
{
@@ -109,14 +63,13 @@ struct ihash
struct ihash *next_this_file;
/* Location of the file in the include search path.
- Used for include_next */
+ Used for include_next and to detect redundant includes. */
struct file_name_list *foundhere;
unsigned int hash; /* save hash value for future reference */
const char *nshort; /* name of file as referenced in #include;
points into name[] */
- const U_CHAR *control_macro; /* macro, if any, preventing reinclusion -
- see redundant_include_p */
+ const U_CHAR *control_macro; /* macro, if any, preventing reinclusion. */
const char name[1]; /* (partial) pathname of file */
};
typedef struct ihash IHASH;
@@ -224,14 +177,12 @@ extern unsigned char _cpp_IStable[256];
/* In cpphash.c */
extern unsigned int _cpp_calc_hash PARAMS ((const U_CHAR *, size_t));
-extern HASHNODE *_cpp_lookup PARAMS ((cpp_reader *,
- const U_CHAR *, int));
-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 *));
+extern void _cpp_free_definition PARAMS ((cpp_hashnode *));
+extern int _cpp_create_definition PARAMS ((cpp_reader *, cpp_toklist *,
+ cpp_hashnode *));
+extern void _cpp_dump_definition PARAMS ((cpp_reader *, cpp_hashnode *));
extern void _cpp_quote_string PARAMS ((cpp_reader *, const U_CHAR *));
-extern void _cpp_macroexpand PARAMS ((cpp_reader *, HASHNODE *));
+extern void _cpp_macroexpand PARAMS ((cpp_reader *, cpp_hashnode *));
extern void _cpp_init_macro_hash PARAMS ((cpp_reader *));
extern void _cpp_dump_macro_hash PARAMS ((cpp_reader *));
@@ -254,8 +205,8 @@ extern void _cpp_expand_to_buffer PARAMS ((cpp_reader *,
const unsigned char *, int));
extern int _cpp_parse_assertion PARAMS ((cpp_reader *));
extern enum cpp_ttype _cpp_lex_token PARAMS ((cpp_reader *));
-extern long _cpp_read_and_prescan PARAMS ((cpp_reader *, cpp_buffer *,
- int, size_t));
+extern ssize_t _cpp_prescan PARAMS ((cpp_reader *, cpp_buffer *,
+ ssize_t));
extern void _cpp_init_input_buffer PARAMS ((cpp_reader *));
extern void _cpp_grow_token_buffer PARAMS ((cpp_reader *, long));
extern enum cpp_ttype _cpp_get_directive_token