comparison gcc/c-parser.c @ 2:0b3575e68bac

c-parser.c fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 17 Jul 2009 18:01:20 +0900
parents caeb520cebed
children 983001f85155
comparison
equal deleted inserted replaced
1:caeb520cebed 2:0b3575e68bac
466 case RID_RESTRICT: 466 case RID_RESTRICT:
467 case RID_ATTRIBUTE: 467 case RID_ATTRIBUTE:
468 case RID_FRACT: 468 case RID_FRACT:
469 case RID_ACCUM: 469 case RID_ACCUM:
470 case RID_SAT: 470 case RID_SAT:
471 #ifndef noCbC
472 case RID_CbC_CODE:
473 #endif
474 #ifndef noCbC 471 #ifndef noCbC
475 case RID_CbC_CODE: 472 case RID_CbC_CODE:
476 #endif 473 #endif
477 return true; 474 return true;
478 default: 475 default:
3766 fields = nreverse(fields); 3763 fields = nreverse(fields);
3767 finish_struct (env_struct_type, fields, NULL_TREE); 3764 finish_struct (env_struct_type, fields, NULL_TREE);
3768 3765
3769 env_struct = build_c_cast (build_pointer_type(env_struct_type), env.value); 3766 env_struct = build_c_cast (build_pointer_type(env_struct_type), env.value);
3770 //build_component_ref (cbc_env, get_identifier("argsp")); 3767 //build_component_ref (cbc_env, get_identifier("argsp"));
3771 ebp = build_component_ref (build_indirect_ref (env_struct, "CbCenv->sp"), get_identifier("sp")); 3768 ebp = build_component_ref (build_indirect_ref (loc,env_struct, "CbCenv->sp"), get_identifier("sp"));
3772 argsp = build_component_ref (build_indirect_ref (env_struct, "CbCenv->sp"), get_identifier("argsp")); 3769 argsp = build_component_ref (build_indirect_ref (loc, env_struct, "CbCenv->sp"), get_identifier("argsp"));
3773 //ebp = chainon (ebp, argsp); 3770 //ebp = chainon (ebp, argsp);
3774 tmp = build_tree_list (ebp, argsp); 3771 tmp = build_tree_list (ebp, argsp);
3775 3772
3776 TREE_OPERAND (expr.value, 2) = tmp; 3773 TREE_OPERAND (expr.value, 2) = tmp;
3777 3774
5669 } 5666 }
5670 5667
5671 /* get value of %ebp. */ 5668 /* get value of %ebp. */
5672 ebp = build_external_ref ( 5669 ebp = build_external_ref (
5673 get_identifier ("__builtin_frame_address"), 0, 5670 get_identifier ("__builtin_frame_address"), 0,
5674 c_parser_peek_token (parser)->location); 5671 (loc = c_parser_peek_token (parser)->location));
5675 ebp = build_function_call(ebp, 5672 ebp = build_function_call(ebp,
5676 build_tree_list (NULL_TREE, build_int_cst (NULL_TREE,0))); 5673 build_tree_list (NULL_TREE, build_int_cst (NULL_TREE,0)));
5677 5674
5678 /* assignment void *sp = %ebp */ 5675 /* assignment void *sp = %ebp */
5679 comp = build_component_ref (cbc_env, get_identifier("sp")); 5676 comp = build_component_ref (cbc_env, get_identifier("sp"));
5680 add_stmt (build_modify_expr (comp, NOP_EXPR, ebp)); 5677 add_stmt (build_modify_expr (loc, comp, NOP_EXPR, ebp));
5681 5678
5682 /* void *argsp = &__environment.retval */ 5679 /* void *argsp = &__environment.retval */
5683 comp = build_component_ref (cbc_env, get_identifier("argsp")); 5680 comp = build_component_ref (cbc_env, get_identifier("argsp"));
5684 comp0 = build_component_ref (cbc_env, get_identifier("retval")); 5681 comp0 = build_component_ref (cbc_env, get_identifier("retval"));
5685 comp0 = build_unary_op (ADDR_EXPR, comp0, 0); 5682 comp0 = build_unary_op (loc, ADDR_EXPR, comp0, 0);
5686 add_stmt (build_modify_expr (comp, NOP_EXPR, comp0)); 5683 add_stmt (build_modify_expr (loc, comp, NOP_EXPR, comp0));
5687 5684
5688 5685
5689 /* &__environment for value of stmt_expr. */ 5686 /* &__environment for value of stmt_expr. */
5690 add_stmt (build_unary_op (ADDR_EXPR, cbc_env, 0)); 5687 add_stmt (build_unary_op (loc, ADDR_EXPR, cbc_env, 0));
5691 #endif 5688 #endif
5692 //expr.value = valuep_tree; 5689 //expr.value = valuep_tree;
5693 TREE_SIDE_EFFECTS (stmt) = 1; 5690 TREE_SIDE_EFFECTS (stmt) = 1;
5694 expr.value = c_finish_stmt_expr (stmt); 5691 expr.value = c_finish_stmt_expr (stmt);
5695 //expr.value = build_unary_op (ADDR_EXPR, env, 0); 5692 //expr.value = build_unary_op (ADDR_EXPR, env, 0);
5731 intHI_type_node); 5728 intHI_type_node);
5732 TREE_STATIC (decl_cond) = 1; 5729 TREE_STATIC (decl_cond) = 1;
5733 cexpr.value = lang_hooks.decls.pushdecl(decl_cond); 5730 cexpr.value = lang_hooks.decls.pushdecl(decl_cond);
5734 5731
5735 cexpr.original_code = ERROR_MARK; 5732 cexpr.original_code = ERROR_MARK;
5736 cond = c_objc_common_truthvalue_conversion(cexpr.value); 5733 cond = c_objc_common_truthvalue_conversion(loc, cexpr.value);
5737 if (EXPR_P (cond)) 5734 if (EXPR_P (cond))
5738 SET_EXPR_LOCATION (cond, loc); 5735 SET_EXPR_LOCATION (cond, loc);
5739 5736
5740 5737
5741 5738