aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorNeil Booth <neilb@earthling.net>2000-04-24 22:07:36 +0000
committerNeil Booth <neil@gcc.gnu.org>2000-04-24 22:07:36 +0000
commit9c603af2ac5c36e9fe18453b096492b95ceeec24 (patch)
tree78d00b64242d62d8f1d39589de74e11555f571d6 /gcc/cpplib.c
parent91029a29533bcffecafb8991eb0d033403cce3d8 (diff)
downloadgcc-9c603af2ac5c36e9fe18453b096492b95ceeec24.zip
gcc-9c603af2ac5c36e9fe18453b096492b95ceeec24.tar.gz
gcc-9c603af2ac5c36e9fe18453b096492b95ceeec24.tar.bz2
cpphash.c: replace HSPACE_BEFORE with PREV_WHITESPACE.
* cpphash.c: replace HSPACE_BEFORE with PREV_WHITESPACE. * cpphash.h (_cpp_check_directive): new. * cpplex.c (handle_newline, cpp_free_token_list, init_trigraph_map, trigraph_ok, trigraph_replace, backslash_start, skip_block_comment, skip_line_comment, skip_whitespace, parse_name, parse_number, parse_string, copy_comment, _cpp_lex_line, spell_char, spell_string, spell_comment, spell_name, spell_other, _cpp_lex_file, _cpp_output_list): new. (expand_name_space): take length argument. (init_token_list): add comment list initialisation. (cpp_scan_line): use auto_expand_name_space. PREV_WHITESPACE instead of HSPACE_BEFORE. * cpplib.c (_cpp_check_directive): new * cpplib.h (cpp_name, PREV_WHITESPACE, PREV_COMMENT, DIGRAPH, UNSIGNED_INT, TOK_NAME): new. (HSPACE_BEFORE): delete. (TTYPE_TABLE): rearrange. (struct cpp_toklist): update. From-SVN: r33390
Diffstat (limited to 'gcc/cpplib.c')
-rw-r--r--gcc/cpplib.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cpplib.c b/gcc/cpplib.c
index 5bb5162..2d466ff 100644
--- a/gcc/cpplib.c
+++ b/gcc/cpplib.c
@@ -150,6 +150,29 @@ DIRECTIVE_TABLE
#undef D
#undef DIRECTIVE_TABLE
+/* Check if a token's name matches that of a known directive. Put in
+ this file to save exporting dtable and other unneeded information. */
+void
+_cpp_check_directive (list, token)
+ cpp_toklist *list;
+ cpp_token *token;
+{
+ const char *name = list->namebuf + token->val.name.offset;
+ size_t len = token->val.name.len;
+ unsigned int i;
+
+ list->dir_handler = 0;
+ list->dir_flags = 0;
+
+ for (i = 0; i < N_DIRECTIVES; i++)
+ if (dtable[i].length == len && !strncmp (dtable[i].name, name, len))
+ {
+ list->dir_handler = dtable[i].func;
+ list->dir_flags = dtable[i].flags;
+ break;
+ }
+}
+
/* Handle a possible # directive.
'#' has already been read. */