diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-10 14:27:32 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-05-10 14:27:32 +0000 |
commit | 2ee04baa68b1550bd7c06cee36b87adf3176a6c6 (patch) | |
tree | c5f8e2e7ce183b106614d41e5e99dcd5c47f5581 /libcpp/macro.c | |
parent | 5eaad62c471572a312c7e3f6f08c2a25ba891c80 (diff) | |
download | gcc-2ee04baa68b1550bd7c06cee36b87adf3176a6c6.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147341 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libcpp/macro.c')
-rw-r--r-- | libcpp/macro.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/libcpp/macro.c b/libcpp/macro.c index 36853971780..e051fbc7757 100644 --- a/libcpp/macro.c +++ b/libcpp/macro.c @@ -946,7 +946,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg /* We have an argument. If it is not being stringified or pasted it is macro-replaced before insertion. */ - arg = &args[src->val.arg_no - 1]; + arg = &args[src->val.macro_arg.arg_no - 1]; if (src->flags & STRINGIFY_ARG) { @@ -982,7 +982,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg } paste_flag = 0; - arg = &args[src->val.arg_no - 1]; + arg = &args[src->val.macro_arg.arg_no - 1]; if (src->flags & STRINGIFY_ARG) count = 1, from = &arg->stringified; else if (src->flags & PASTE_LEFT) @@ -994,7 +994,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg { if (dest[-1]->type == CPP_COMMA && macro->variadic - && src->val.arg_no == macro->paramc) + && src->val.macro_arg.arg_no == macro->paramc) { /* Swallow a pasted comma if from == NULL, otherwise drop the paste flag. */ @@ -1035,7 +1035,7 @@ replace_args (cpp_reader *pfile, cpp_hashnode *node, cpp_macro *macro, macro_arg "empty macro arguments are undefined" " in ISO C90 and ISO C++98", NODE_NAME (node), - src->val.arg_no); + src->val.macro_arg.arg_no); } /* Avoid paste on RHS (even case count == 0). */ @@ -1261,7 +1261,7 @@ cpp_get_token (cpp_reader *pfile) if (result->type != CPP_NAME) break; - node = result->val.node; + node = result->val.node.node; if (node->type != NT_MACRO || (result->flags & NO_EXPAND)) break; @@ -1553,7 +1553,7 @@ parse_params (cpp_reader *pfile, cpp_macro *macro) } prev_ident = 1; - if (_cpp_save_parameter (pfile, macro, token->val.node)) + if (_cpp_save_parameter (pfile, macro, token->val.node.node)) return false; continue; @@ -1626,10 +1626,10 @@ lex_expansion_token (cpp_reader *pfile, cpp_macro *macro) /* Is this a parameter? */ if (token->type == CPP_NAME - && (token->val.node->flags & NODE_MACRO_ARG) != 0) + && (token->val.node.node->flags & NODE_MACRO_ARG) != 0) { token->type = CPP_MACRO_ARG; - token->val.arg_no = token->val.node->value.arg_index; + token->val.macro_arg.arg_no = token->val.node.node->value.arg_index; } else if (CPP_WTRADITIONAL (pfile) && macro->paramc > 0 && (token->type == CPP_STRING || token->type == CPP_CHAR)) @@ -1771,7 +1771,7 @@ create_iso_definition (cpp_reader *pfile, cpp_macro *macro) { macro->extra_tokens = 1; num_extra_tokens++; - token->val.arg_no = macro->count - 1; + token->val.token_no = macro->count - 1; } else { @@ -2007,7 +2007,7 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) cpp_token *token = ¯o->exp.tokens[i]; if (token->type == CPP_MACRO_ARG) - len += NODE_LEN (macro->params[token->val.arg_no - 1]); + len += NODE_LEN (macro->params[token->val.macro_arg.arg_no - 1]); else len += cpp_token_len (token); @@ -2079,9 +2079,9 @@ cpp_macro_definition (cpp_reader *pfile, const cpp_hashnode *node) if (token->type == CPP_MACRO_ARG) { memcpy (buffer, - NODE_NAME (macro->params[token->val.arg_no - 1]), - NODE_LEN (macro->params[token->val.arg_no - 1])); - buffer += NODE_LEN (macro->params[token->val.arg_no - 1]); + NODE_NAME (macro->params[token->val.macro_arg.arg_no - 1]), + NODE_LEN (macro->params[token->val.macro_arg.arg_no - 1])); + buffer += NODE_LEN (macro->params[token->val.macro_arg.arg_no - 1]); } else buffer = cpp_spell_token (pfile, token, buffer, false); |