c-lex.c (c_lex_with_flags): Expect cpp_hashnode in tok->val.node.node.
gcc: * c-lex.c (c_lex_with_flags): Expect cpp_hashnode in tok->val.node.node. libcpp: * include/cpplib.h (enum cpp_token_fld_kind): Add CPP_TOKEN_FLD_TOKEN_NO. (struct cpp_macro_arg, struct cpp_identifier): Define. (union cpp_token_u): Use struct cpp_identifier for identifiers. Use struct cpp_macro_arg for macro arguments. Add token_no for CPP_PASTE token numbers. * directives.c (_cpp_handle_directive, lex_macro_node, do_pragma, do_pragma_poison, parse_assertion): Use val.node.node in place of val.node. * expr.c (parse_defined, eval_token): Use val.node.node in place of val.node. * lex.c (cpp_ideq, _cpp_lex_direct, cpp_token_len, cpp_spell_token, cpp_output_token, _cpp_equiv_tokens, cpp_token_val_index): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. * macro.c (replace_args, cpp_get_token, parse_params, lex_expansion_token, create_iso_definition, cpp_macro_definition): Use val.macro_arg.arg_no or val.token_no in place of val.arg_no. Use val.node.node in place of val.node. From-SVN: r147341
This commit is contained in:
parent
fb0be16980
commit
9a0c618755
8 changed files with 104 additions and 60 deletions
|
@ -189,10 +189,27 @@ enum cpp_token_fld_kind {
|
|||
CPP_TOKEN_FLD_SOURCE,
|
||||
CPP_TOKEN_FLD_STR,
|
||||
CPP_TOKEN_FLD_ARG_NO,
|
||||
CPP_TOKEN_FLD_TOKEN_NO,
|
||||
CPP_TOKEN_FLD_PRAGMA,
|
||||
CPP_TOKEN_FLD_NONE
|
||||
};
|
||||
|
||||
/* A macro argument in the cpp_token union. */
|
||||
struct GTY(()) cpp_macro_arg {
|
||||
/* Argument number. */
|
||||
unsigned int arg_no;
|
||||
};
|
||||
|
||||
/* An identifier in the cpp_token union. */
|
||||
struct GTY(()) cpp_identifier {
|
||||
/* The canonical (UTF-8) spelling of the identifier. */
|
||||
cpp_hashnode *
|
||||
GTY ((nested_ptr (union tree_node,
|
||||
"%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
|
||||
"%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL")))
|
||||
node;
|
||||
};
|
||||
|
||||
/* A preprocessing token. This has been carefully packed and should
|
||||
occupy 16 bytes on 32-bit hosts and 24 bytes on 64-bit hosts. */
|
||||
struct GTY(()) cpp_token {
|
||||
|
@ -203,12 +220,7 @@ struct GTY(()) cpp_token {
|
|||
union cpp_token_u
|
||||
{
|
||||
/* An identifier. */
|
||||
cpp_hashnode *
|
||||
GTY ((nested_ptr (union tree_node,
|
||||
"%h ? CPP_HASHNODE (GCC_IDENT_TO_HT_IDENT (%h)) : NULL",
|
||||
"%h ? HT_IDENT_TO_GCC_IDENT (HT_NODE (%h)) : NULL"),
|
||||
tag ("CPP_TOKEN_FLD_NODE")))
|
||||
node;
|
||||
struct cpp_identifier GTY ((tag ("CPP_TOKEN_FLD_NODE"))) node;
|
||||
|
||||
/* Inherit padding from this token. */
|
||||
cpp_token * GTY ((tag ("CPP_TOKEN_FLD_SOURCE"))) source;
|
||||
|
@ -217,7 +229,11 @@ struct GTY(()) cpp_token {
|
|||
struct cpp_string GTY ((tag ("CPP_TOKEN_FLD_STR"))) str;
|
||||
|
||||
/* Argument no. for a CPP_MACRO_ARG. */
|
||||
unsigned int GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) arg_no;
|
||||
struct cpp_macro_arg GTY ((tag ("CPP_TOKEN_FLD_ARG_NO"))) macro_arg;
|
||||
|
||||
/* Original token no. for a CPP_PASTE (from a sequence of
|
||||
consecutive paste tokens in a macro expansion). */
|
||||
unsigned int GTY ((tag ("CPP_TOKEN_FLD_TOKEN_NO"))) token_no;
|
||||
|
||||
/* Caller-supplied identifier for a CPP_PRAGMA. */
|
||||
unsigned int GTY ((tag ("CPP_TOKEN_FLD_PRAGMA"))) pragma;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue