aboutsummaryrefslogtreecommitdiff
path: root/gcc/cpplib.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2000-04-25 19:32:36 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-04-25 19:32:36 +0000
commitc5a047348d810987513ce54c6533c1314ad19593 (patch)
tree5a047961b22821bc1f9f0aa156612fd5c002d95c /gcc/cpplib.c
parente0075d846d4a4bbcb3a5114bdc8f4f130bf819b1 (diff)
downloadgcc-c5a047348d810987513ce54c6533c1314ad19593.zip
gcc-c5a047348d810987513ce54c6533c1314ad19593.tar.gz
gcc-c5a047348d810987513ce54c6533c1314ad19593.tar.bz2
[multiple changes]
2000-04-25 Zack Weinberg <zack@wolery.cumb.org> * cpplib.h (struct cpp_buffer): Add 'mapped' flag; fix commentary. 2000-04-25 Neil Booth <NeilB@earthling.net> Restore previous patch, plus the following fixes: * cpphash.c (_cpp_create_definition): Test PREV_WHITESPACE in flags, not CPP_OPEN_PAREN. * cpplex.c (expand_token_space, init_token_list, cpp_free_token_list): Put the dummy token at list->tokens[-1]. (_cpp_lex_line, _cpp_lex_file): token list is 0-based. From-SVN: r33419
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. */