aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpphash.h
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-05-18 15:55:46 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-05-18 15:55:46 +0000
commit15dad1d9085624c3bce83e0fa0d9b2764f65bccb (patch)
treeeae8b6ec3c589f4957c72e8c82be5c3cc2ea4bbf /gcc/cpphash.h
parent7021bb50d4366bf1630d5a685704d0118b06621a (diff)
downloadgcc-15dad1d9085624c3bce83e0fa0d9b2764f65bccb.zip
gcc-15dad1d9085624c3bce83e0fa0d9b2764f65bccb.tar.gz
gcc-15dad1d9085624c3bce83e0fa0d9b2764f65bccb.tar.bz2
cppexp.c (parse_assertion): New.
* cppexp.c (parse_assertion): New. (lex): Call it for CPP_HASH. Remove CPP_ASSERTION case. (_cpp_parse_expr): Remove case '#'. Don't set parsing_if_directive. * cpphash.c (collect_objlike_expansion, collect_funlike_expansion, collect_params, _cpp_create_definition): The list no longer has a trailing VSPACE token. * cpphash.h (enum node_type): Add T_ASSERTION. (struct hashnode): Remove aschain, add pred. (struct predicate): New. Update prototypes. * cpplex.c (expand_token_space): Handle both offset and nonoffset lists. (init_token_list, _cpp_free_token_list, _cpp_parse_assertion): Delete. (_cpp_init_toklist, _cpp_clear_toklist, _cpp_free_toklist, _cpp_slice_toklist, _cpp_squeeze_toklist, _cpp_equiv_tokens, _cpp_equiv_toklists): New. (_cpp_scan_line): Rename to _cpp_scan_until; add ability to stop at any single-character token, not just newline. (_cpp_lex_token): Remove special cases for #define and #if. (cpp_get_token): Expect # as a separate token type. Remove DIRECTIVE case. (_cpp_get_directive_token): Remove DIRECTIVE case. (_cpp_lex_line, _cpp_lex_file, _cpp_init_input_buffer): Update. * cpplib.c (_cpp_check_directive): Set dirno and SYNTAX_INCLUDE bit of flags, not dir_handler and dir_flags. (_cpp_handle_directive): Run # <number> through the same logic as normal directives. (do_define): Don't set parsing_define_directive. Use _cpp_scan_until. The list does not have a VSPACE at the end. (do_if): Save, clear, and restore only_seen_white around _cpp_parse_expr. (skip_if_group): s/CPP_DIRECTIVE/CPP_HASH/ (do_assert, do_unassert): Rewrite. * cpplib.h (TTYPE_TABLE): Remove CPP_ASSERTION. (LIST_OFFSET): New flag. (struct cpp_toklist): Replace dir_handler and dir_flags with dirno and flags. (struct cpp_reader): Remove parsing_if_directive and parsing_define_directive. From-SVN: r33984
Diffstat (limited to 'gcc/cpphash.h')
-rw-r--r--gcc/cpphash.h27
1 files changed, 24 insertions, 3 deletions
diff --git a/gcc/cpphash.h b/gcc/cpphash.h
index 4b8c50e..927927c 100644
--- a/gcc/cpphash.h
+++ b/gcc/cpphash.h
@@ -49,7 +49,8 @@ enum node_type
T_MACRO, /* object-like macro */
T_FMACRO, /* function-like macro */
T_IDENTITY, /* macro defined to itself */
- T_EMPTY /* macro defined to nothing */
+ T_EMPTY, /* macro defined to nothing */
+ T_ASSERTION /* predicate for #assert */
};
typedef struct hashnode HASHNODE;
@@ -64,12 +65,19 @@ struct hashnode
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 hashnode *aschain; /* #assert */
+ struct predicate *pred; /* #assert */
} value;
const U_CHAR name[1]; /* name[length] */
};
+/* Structure used for assertion predicates. */
+struct predicate
+{
+ struct predicate *next;
+ struct cpp_toklist answer;
+};
+
/* List of directories to look for include files in. */
struct file_name_list
{
@@ -250,7 +258,20 @@ extern enum cpp_ttype _cpp_get_directive_token
PARAMS ((cpp_reader *));
extern enum cpp_ttype _cpp_get_define_token
PARAMS ((cpp_reader *));
-extern void _cpp_scan_line PARAMS ((cpp_reader *, cpp_toklist *));
+extern enum cpp_ttype _cpp_scan_until PARAMS ((cpp_reader *, cpp_toklist *,
+ enum cpp_ttype));
+extern void _cpp_init_toklist PARAMS ((cpp_toklist *));
+extern void _cpp_clear_toklist PARAMS ((cpp_toklist *));
+extern void _cpp_free_toklist PARAMS ((cpp_toklist *));
+extern void _cpp_slice_toklist PARAMS ((cpp_toklist *,
+ const cpp_token *,
+ const cpp_token *));
+extern void _cpp_squeeze_toklist PARAMS ((cpp_toklist *));
+extern int _cpp_equiv_tokens PARAMS ((const cpp_token *,
+ const cpp_token *));
+extern int _cpp_equiv_toklists PARAMS ((const cpp_toklist *,
+ const cpp_toklist *));
+
/* In cpplib.c */
extern int _cpp_handle_directive PARAMS ((cpp_reader *));