Mercurial > hg > CbC > CbC_gcc
changeset 88:f214c1d5b862
merge 89
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 20 Dec 2011 18:53:46 +0900 |
parents | 4a89a0a804df (diff) 12b3180c7d07 (current diff) |
children | 3356a4c26abc |
files | gcc/c-parser.c gcc/calls.c~ |
diffstat | 2 files changed, 50 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/gcc/c-parser.c Thu Dec 15 02:37:13 2011 +0900 +++ b/gcc/c-parser.c Tue Dec 20 18:53:46 2011 +0900 @@ -6160,8 +6160,8 @@ tree tlab; tree cond; + /* tree cstmt = c_begin_compound_stmt (true); - tlab = define_label (loc, label); gcc_assert (tlab); decl_attributes (&tlab, NULL_TREE, 0); @@ -6170,10 +6170,44 @@ tree ret = c_finish_return (loc, retval, retval); /*tree ret = c_finish_return (retval);*/ TREE_USED(ret) = 1; - cond = integer_zero_node; + tree if_body = c_end_compound_stmt (loc, cstmt, true); TREE_SIDE_EFFECTS (cstmt) = 1; c_finish_if_stmt (loc, cond, if_body, NULL_TREE, false); + */ + + cond = integer_zero_node; + tree block_outside = c_begin_compound_stmt (false); + tree block_inside = c_begin_compound_stmt (false); + + tree stmt = c_begin_compound_stmt (true); + tlab = define_label (loc, label); + gcc_assert (tlab); + decl_attributes (&tlab, NULL_TREE, 0); + TREE_USED (tlab) = 1; + /* add_stmt (LABEL_EXPR) */ + add_stmt (build_stmt (loc, LABEL_EXPR, tlab)); + + /* add_stmt (RETURN_EXPR) */ + tree ret = c_finish_return (loc, retval, retval); + // TREE_USED(ret) = 1; + tree stmt_body = c_end_compound_stmt (loc, stmt, true); + + /* add_stmt (STATEMENT_LIST) : STATEMENT_LIST -> LABEL_EXPR -> RETURN_EXPR */ + add_stmt (stmt_body); + + tree body = c_end_compound_stmt (loc, block_inside, false); + + /* add_stmt (COND_EXPR) */ + c_finish_if_stmt (loc, cond, body, NULL_TREE, false); + + /* add_stmt (BIND_EXPR) : BIND_EXPR -> COND_EXPR -> STATEMENT_LIST */ + tree bind = c_end_compound_stmt (loc, block_outside, false); + TREE_SIDE_EFFECTS (bind) = 1; + add_stmt (bind); + + TREE_USED (retval) = 1; + } static tree @@ -6740,13 +6774,18 @@ /* declare retval. (int retval;) */ tree decl_cond = build_decl (location, VAR_DECL, get_identifier ("retval"), - TREE_TYPE (TREE_TYPE (current_function_decl))); - /* use thread-local */ - // DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); - TREE_STATIC (decl_cond) = 1; - - DECL_ARTIFICIAL (decl_cond) = 1; - pushdecl (decl_cond); + TREE_TYPE (TREE_TYPE (current_function_decl))); + TREE_STATIC (decl_cond) = 1; + + /* use thread-local */ + //DECL_TLS_MODEL (decl_cond) = decl_default_tls_model (decl_cond); + // DECL_TLS_MODEL (decl_cond) = TLS_MODEL_REAL; + + /* Linux: TLS_MODEL_LOCAL_EXEC OS X: TlS_MODE_REAL */ + DECL_TLS_MODEL (decl_cond) = TLS_MODEL_LOCAL_EXEC; + //DECL_ARTIFICIAL (decl_cond) = 1; + // pushdecl (decl_cond); + add_stmt (build_stmt(location, DECL_EXPR, pushdecl (decl_cond))); /* define nested function. */ decl = @@ -6757,6 +6796,7 @@ /* get pointer to nested function. */ value = build_addr (decl , current_function_decl); + TREE_USED (current_function_decl) = 1; SET_EXPR_LOCATION (value, location); add_stmt (value);
--- a/gcc/c-typeck.c Thu Dec 15 02:37:13 2011 +0900 +++ b/gcc/c-typeck.c Tue Dec 20 18:53:46 2011 +0900 @@ -9325,6 +9325,7 @@ return stmt; } + /* Queue a cleanup. CLEANUP is an expression/statement to be executed when the current scope is exited. EH_ONLY is true when this is not meant to apply to normal control flow transfer. */