# HG changeset patch # User Shinji KONO # Date 1316799662 -32400 # Node ID d8bf5c8fdea8fa30b8ffb6ceba944b342f29c74c # Parent b0f061ae1da07fc05503db86ee37bd28e9a662ea fix comments diff -r b0f061ae1da0 -r d8bf5c8fdea8 gcc/c-parser.c --- a/gcc/c-parser.c Tue Sep 20 18:07:11 2011 +0900 +++ b/gcc/c-parser.c Sat Sep 24 02:41:02 2011 +0900 @@ -6179,7 +6179,7 @@ { /* add statement below. - * void __return_func(int _retval, void *_envp){ + * void ___cbc_internal_return(int _retval, void *_envp){ * retval = _retval; * goto exit0; * } @@ -6206,8 +6206,7 @@ DECL_ARTIFICIAL (_retval_decl) = 1; DECL_ARG_TYPE (_retval_decl) = TREE_TYPE(retval_decl); pushdecl (_retval_decl); - finish_decl (_retval_decl, loc, NULL_TREE, NULL_TREE, NULL_TREE); - + finish_decl (_retval_decl, loc, NULL_TREE, NULL_TREE, NULL_TREE); _envp_decl = build_decl (loc, PARM_DECL, get_identifier ("_envp"), ptr_type_node); DECL_SOURCE_LOCATION (_envp_decl) = loc; DECL_ARTIFICIAL (_envp_decl) = 1; @@ -6707,121 +6706,18 @@ case RID_CbC_RET: case RID_RETURN: -#if 0 - if (cbc_return_f==0) - { tree retval; - - /* - Generates something like... - - int retval = 1; - void (*ret)(int retval_,void *fp) ; - - ret = ({ - __label__ exit0; - volatile static flag = 0; - void __return_func(int retval_,void *fp) { - retval = retval_; - goto exit0; - } - if (flag) { - exit0: - printf("f1: fp = 0x%x\n",__builtin_frame_address(0)); - return retval; - } - __return_func; - }); - - */ - - tree stmt = c_begin_stmt_expr (); - cbc_return_f = c_parser_peek_token (parser)->value; - cbc_return = c_parser_peek_token (parser)->location; - c_parser_consume_token (parser); - location_t next = c_parser_peek_token (parser)->location; - - // dummy variable for hidden condition - struct c_expr cexpr; - tree cond; - location_t loc; - loc = next; - tree decl_cond = - build_decl (VAR_DECL, get_identifier ("__return"), - intHI_type_node); - TREE_STATIC (decl_cond) = 1; - cexpr.value = lang_hooks.decls.pushdecl(decl_cond); - - cexpr.original_code = ERROR_MARK; - cond = c_objc_common_truthvalue_conversion(loc, cexpr.value); - if (EXPR_P (cond)) - SET_EXPR_LOCATION (cond, loc); - - - - - tree fwlabel = create_artificial_label (); - //TREE_USED(fwlabel) = 1; - - //add_stmt (build1 (GOTO_EXPR, void_type_node, fwlabel)); - tree block = c_begin_compound_stmt (flag_isoc99); - - tree tlab = lookup_label(cbc_return_f); - - tree decl= build_stmt (LABEL_EXPR, tlab); - //TREE_USED(decl) = 1; - add_stmt(decl); - - //tree hoge = build_int_cst(NULL_TREE,55); - retval = build_component_ref (cbc_env, get_identifier("retval")); - tree ret = c_finish_return (retval); - TREE_USED(ret) = 1; - tree first_body = c_end_compound_stmt (block, flag_isoc99); - - c_finish_if_stmt (loc, cond, first_body, NULL_TREE, false); - - // define_label(EXPR_LOCATION(decl) ,cbc_return_f); - return_label1 = - define_label(cbc_return ,cbc_return_f); - tree fwdef= build_stmt (LABEL_EXPR, fwlabel); - - //TREE_USED(fwdef) = 1; - add_stmt(fwdef); - TREE_SIDE_EFFECTS (block) = 1; - - // tree label = lookup_label(c_parser_peek_token (parser)->value); - //TREE_USED(label) = 1; - - tree value = build1(ADDR_EXPR, ptr_type_node, return_label1); - SET_EXPR_LOCATION (value, next); - TREE_SIDE_EFFECTS (value) = 1; - add_stmt(value); - - TREE_SIDE_EFFECTS (stmt) = 1; - expr.value = c_finish_stmt_expr (stmt); - expr.original_code = ERROR_MARK; - - - } - else - { - //tree label = lookup_label(c_parser_peek_token (parser)->value); - //TREE_USED(label) = 1; - //expr.value = build1(ADDR_EXPR, ptr_type_node, label); - expr.value = build1(ADDR_EXPR, ptr_type_node, return_label1); - c_parser_consume_token (parser); - } -#else //by KENT. { /* ({ __label__ _cbc_exit0; - void __return_func(int retval_, void *_envp){ - retval = retval_; - goto exit0; + int retval; // should be thread local + void _cbc_internal_return(int retval_, void *_envp){ + retval = retval_; + goto _cbc_exit0; } if (0) { _cbc_exit0: - return retval; + return retval; } __return_func; }); @@ -6858,16 +6754,12 @@ value = build_addr (decl , current_function_decl); SET_EXPR_LOCATION (value, location); add_stmt (value); - /*value = build_external_ref (get_identifier("_cbc_internal_return"), false, location);*/ - /*value = build_unary_op (location, ADDR_EXPR, value, 0);*/ - /*add_stmt (value);*/ TREE_SIDE_EFFECTS (stmt) = 1; expr.value = c_finish_stmt_expr (location, stmt); expr.original_code = ERROR_MARK; } -#endif //0 break; #endif //noCbC