aboutsummaryrefslogtreecommitdiff
path: root/libcpp/lex.c
diff options
context:
space:
mode:
authorGeoffrey Keating <geoffk@apple.com>2004-06-09 20:10:13 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>2004-06-09 20:10:13 +0000
commitd8044160b7047642e312fb5f713fe0db46171dd8 (patch)
tree1238be7fc80d74d8323d5f6c4344a6bb2be0f854 /libcpp/lex.c
parent293155b099b94b81fa0147f2719f3da23c859f7e (diff)
downloadgcc-d8044160b7047642e312fb5f713fe0db46171dd8.zip
gcc-d8044160b7047642e312fb5f713fe0db46171dd8.tar.gz
gcc-d8044160b7047642e312fb5f713fe0db46171dd8.tar.bz2
Index: gcc/ChangeLog
2004-06-09 Geoffrey Keating <geoffk@apple.com> * Makefile.in (CPPLIB_H): Put files in order of inclusion. (CPP_ID_DATA_H): New. (gtype-desc.o): Update dependencies. (GTFILES): Use CPP_ID_DATA_H. Index: gcc/testsuite/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * gcc.dg/pch/macro-4.c: New. * gcc.dg/pch/macro-4.hs: New. Index: libcpp/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * traditional.c (push_replacement_text): Set macro->traditional. (save_replacement_text): Likewise. * pch.c (cpp_write_pch_state): Don't write list of defined macros. (struct save_macro_item): Delete. (struct save_macro_data): Use a character array not the previous structured format. (save_macros): Save macro as text not as internal structures. (cpp_prepare_state): Update for changes to save_macro_data. (cpp_read_state): Don't read macros defined in PCH. Restore -D macros as text. * macro.c (create_iso_definition): Honour alloc_subobject. Clear traditional flag. (_cpp_create_definition): Honour alloc_subobject. * lex.c (cpp_token_val_index): New. * internal.h: Include cpp-id-data.h. (uchar): Move definition to cpp-id-data.h. (U): Likewise. (cpp_macro): Likewise. * directives.c (struct answer): Move to cpp-id-data.h. (do_assert): Honour alloc_subobject. Index: libcpp/include/ChangeLog 2004-06-09 Geoffrey Keating <geoffk@apple.com> * symtab.h (struct ht): Add field 'alloc_subobject'. * cpplib.h (struct cpp_string): Add GTY marker. (enum cpp_token_fld_kind): New. (struct cpp_token): Add GTY markers. (cpp_token_val_index): Prototype. (CPP_HASHNODE_VALUE_IDX): New. (struct cpp_hashnode): Don't skip fields of 'value' when marking. * cpp-id-data.h: New file. From-SVN: r82851
Diffstat (limited to 'libcpp/lex.c')
-rw-r--r--libcpp/lex.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libcpp/lex.c b/libcpp/lex.c
index 37df6ef..7eafb13 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -1556,3 +1556,25 @@ _cpp_aligned_alloc (cpp_reader *pfile, size_t len)
buff->cur = result + len;
return result;
}
+
+/* Say which field of TOK is in use. */
+
+enum cpp_token_fld_kind
+cpp_token_val_index (cpp_token *tok)
+{
+ switch (TOKEN_SPELL (tok))
+ {
+ case SPELL_IDENT:
+ return CPP_TOKEN_FLD_NODE;
+ case SPELL_LITERAL:
+ return CPP_TOKEN_FLD_STR;
+ case SPELL_NONE:
+ if (tok->type == CPP_MACRO_ARG)
+ return CPP_TOKEN_FLD_ARG_NO;
+ else if (tok->type == CPP_PADDING)
+ return CPP_TOKEN_FLD_SOURCE;
+ /* else fall through */
+ default:
+ return CPP_TOKEN_FLD_NONE;
+ }
+}