Mercurial > hg > CbC > CbC_gcc
diff gcc/c-parser.c @ 76:6381ea127240
call argument iterator fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 20 Sep 2011 16:58:47 +0900 |
parents | f26ecf70364b |
children | d8bf5c8fdea8 |
line wrap: on
line diff
--- a/gcc/c-parser.c Mon Aug 22 04:01:01 2011 +0900 +++ b/gcc/c-parser.c Tue Sep 20 16:58:47 2011 +0900 @@ -4356,16 +4356,16 @@ fields = chainon (field, fields); field = build_decl (FIELD_DECL, get_identifier("argsp"), ptr_type_node); fields = chainon (field, fields); - //field = build_decl (FIELD_DECL, get_identifier("retval"), intSI_type_node); - //fields = chainon (field, fields); + /* field = build_decl (FIELD_DECL, get_identifier("retval"), intSI_type_node); */ + /* fields = chainon (field, fields); */ fields = nreverse(fields); finish_struct (env_struct_type, fields, NULL_TREE); env_struct = build_c_cast (build_pointer_type(env_struct_type), env.value); - //build_component_ref (cbc_env, get_identifier("argsp")); + /* build_component_ref (cbc_env, get_identifier("argsp")); */ ebp = build_component_ref (build_indirect_ref (loc,env_struct, "CbCenv->sp"), get_identifier("sp")); argsp = build_component_ref (build_indirect_ref (loc, env_struct, "CbCenv->sp"), get_identifier("argsp")); - //ebp = chainon (ebp, argsp); + /* ebp = chainon (ebp, argsp); */ tmp = build_tree_list (ebp, argsp); return tmp; @@ -4375,10 +4375,11 @@ static tree cbc_replace_arguments (location_t loc, tree call) { - tree args; + tree arg; tree fn; tree tmp_decl; int i=0; + call_expr_arg_iterator iter; fn = CALL_EXPR_FN (call); if ( TREE_CODE (fn)==PARM_DECL || !TREE_CONSTANT (fn) ) @@ -4390,20 +4391,18 @@ CALL_EXPR_FN (call) = tmp_decl; } - args = CALL_EXPR_ARGS (call); - for ( ;args; args = TREE_CHAIN (args), i++) - { - tree arg = TREE_VALUE (args); - - //if ( !CONSTANT_CLASS_P (arg) && !VAR_OR_FUNCTION_DECL_P (arg) ) + FOR_EACH_CALL_EXPR_ARG (arg, iter, call) + { + /* if ( !CONSTANT_CLASS_P (arg) && !VAR_OR_FUNCTION_DECL_P (arg) ) */ if ( TREE_CODE (arg)==PARM_DECL || !TREE_CONSTANT (arg) ) - { - tmp_decl = build_decl (loc, VAR_DECL, NULL_TREE, TREE_TYPE(arg)); - pushdecl (tmp_decl); - - add_stmt (build_modify_expr (loc, tmp_decl, NULL_TREE, NOP_EXPR, loc, arg, NULL_TREE)); - CALL_EXPR_ARG (call, i) = tmp_decl; - } + { + tmp_decl = build_decl (loc, VAR_DECL, NULL_TREE, TREE_TYPE(arg)); + pushdecl (tmp_decl); + + add_stmt (build_modify_expr (loc, tmp_decl, NULL_TREE, NOP_EXPR, loc, arg, NULL_TREE)); + CALL_EXPR_ARG (call, i) = tmp_decl; + } + i++; } return call;