# HG changeset patch # User kent # Date 1252489626 -32400 # Node ID 8f2e43f937f3627723373fc798e4e2e93af10e1f # Parent 26e357f6275f55c82b5d0cdf2c1f927c9519968e add cbc_make_lebeled_return function. diff -r 26e357f6275f -r 8f2e43f937f3 gcc/c-parser.c --- a/gcc/c-parser.c Tue Sep 08 21:04:27 2009 +0900 +++ b/gcc/c-parser.c Wed Sep 09 18:47:06 2009 +0900 @@ -60,6 +60,7 @@ #ifndef noCbC #include "cbc-tree.h" static tree cbc_make_nested_function (location_t); +static void cbc_make_labeled_goto (location_t loc); #endif @@ -5722,6 +5723,8 @@ tree nested_func = cbc_make_nested_function (location); add_stmt (build_stmt (DECL_EXPR, nested_func)); + cbc_make_labeled_goto (location); + tree value = build_addr (nested_func , current_function_decl); SET_EXPR_LOCATION (value, location); add_stmt (value); @@ -5765,6 +5768,34 @@ return c_parser_postfix_expression_after_primary (parser, expr); } +static void +cbc_make_labeled_goto (location_t loc) +{ + tree name; + tree tlab; + tree cond; + tree retval; + //tree fwlabel = create_artificial_label (); + + tree cstmt = c_begin_compound_stmt (true); + name = get_identifier("_cbc_exit0"); + + tlab = define_label (loc, name); + gcc_assert (tlab); + decl_attributes (&tlab, NULL_TREE, 0); + add_stmt (build_stmt (LABEL_EXPR, tlab)); + //TREE_USED(decl) = 1; + + retval = build_external_ref (get_identifier("retval"), false, loc); + tree ret = c_finish_return (retval); + TREE_USED(ret) = 1; + + cond = integer_zero_node; + tree if_body = c_end_compound_stmt (cstmt, true); + TREE_SIDE_EFFECTS (cstmt) = 1; + c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); +} + static tree cbc_make_nested_function (location_t loc) {