• R/O
  • SSH

GCC: Commit

Continuation based C on GCC


Commit MetaInfo

Revision85b994e68631134a8e83ba1bcded9c3f9653ee8b (tree)
Zeit2011-09-24 03:01:41
AutorShinji KONO <kono@ie.u...>
CommiterShinji KONO

Log Message

fix comments

Ändern Zusammenfassung

Diff

diff -r 53359ec61e34 -r 85b994e68631 gcc/c-parser.c
--- a/gcc/c-parser.c Wed Sep 21 16:28:35 2011 +0900
+++ b/gcc/c-parser.c Sat Sep 24 03:01:41 2011 +0900
@@ -6179,7 +6179,7 @@
61796179 {
61806180
61816181 /* add statement below.
6182- * void __return_func(int _retval, void *_envp){
6182+ * void ___cbc_internal_return(int _retval, void *_envp){
61836183 * retval = _retval;
61846184 * goto exit0;
61856185 * }
@@ -6206,8 +6206,7 @@
62066206 DECL_ARTIFICIAL (_retval_decl) = 1;
62076207 DECL_ARG_TYPE (_retval_decl) = TREE_TYPE(retval_decl);
62086208 pushdecl (_retval_decl);
6209- finish_decl (_retval_decl, loc, NULL_TREE, NULL_TREE, NULL_TREE);
6210-
6209+ finish_decl (_retval_decl, loc, NULL_TREE, NULL_TREE, NULL_TREE);
62116210 _envp_decl = build_decl (loc, PARM_DECL, get_identifier ("_envp"), ptr_type_node);
62126211 DECL_SOURCE_LOCATION (_envp_decl) = loc;
62136212 DECL_ARTIFICIAL (_envp_decl) = 1;
@@ -6707,123 +6706,20 @@
67076706 case RID_CbC_RET:
67086707 case RID_RETURN:
67096708
6710-#if 0
6711- if (cbc_return_f==0)
6712- { tree retval;
6713-
6714- /*
6715- Generates something like...
6716-
6717- int retval = 1;
6718- void (*ret)(int retval_,void *fp) ;
6719-
6720- ret = ({
6721- __label__ exit0;
6722- volatile static flag = 0;
6723- void __return_func(int retval_,void *fp) {
6724- retval = retval_;
6725- goto exit0;
6726- }
6727- if (flag) {
6728- exit0:
6729- printf("f1: fp = 0x%x\n",__builtin_frame_address(0));
6730- return retval;
6731- }
6732- __return_func;
6733- });
6734-
6735- */
6736-
6737- tree stmt = c_begin_stmt_expr ();
6738- cbc_return_f = c_parser_peek_token (parser)->value;
6739- cbc_return = c_parser_peek_token (parser)->location;
6740- c_parser_consume_token (parser);
6741- location_t next = c_parser_peek_token (parser)->location;
6742-
6743- // dummy variable for hidden condition
6744- struct c_expr cexpr;
6745- tree cond;
6746- location_t loc;
6747- loc = next;
6748- tree decl_cond =
6749- build_decl (VAR_DECL, get_identifier ("__return"),
6750- intHI_type_node);
6751- TREE_STATIC (decl_cond) = 1;
6752- cexpr.value = lang_hooks.decls.pushdecl(decl_cond);
6753-
6754- cexpr.original_code = ERROR_MARK;
6755- cond = c_objc_common_truthvalue_conversion(loc, cexpr.value);
6756- if (EXPR_P (cond))
6757- SET_EXPR_LOCATION (cond, loc);
6758-
6759-
6760-
6761-
6762- tree fwlabel = create_artificial_label ();
6763- //TREE_USED(fwlabel) = 1;
6764-
6765- //add_stmt (build1 (GOTO_EXPR, void_type_node, fwlabel));
6766- tree block = c_begin_compound_stmt (flag_isoc99);
6767-
6768- tree tlab = lookup_label(cbc_return_f);
6769-
6770- tree decl= build_stmt (LABEL_EXPR, tlab);
6771- //TREE_USED(decl) = 1;
6772- add_stmt(decl);
6773-
6774- //tree hoge = build_int_cst(NULL_TREE,55);
6775- retval = build_component_ref (cbc_env, get_identifier("retval"));
6776- tree ret = c_finish_return (retval);
6777- TREE_USED(ret) = 1;
6778- tree first_body = c_end_compound_stmt (block, flag_isoc99);
6779-
6780- c_finish_if_stmt (loc, cond, first_body, NULL_TREE, false);
6781-
6782- // define_label(EXPR_LOCATION(decl) ,cbc_return_f);
6783- return_label1 =
6784- define_label(cbc_return ,cbc_return_f);
6785- tree fwdef= build_stmt (LABEL_EXPR, fwlabel);
6786-
6787- //TREE_USED(fwdef) = 1;
6788- add_stmt(fwdef);
6789- TREE_SIDE_EFFECTS (block) = 1;
6790-
6791- // tree label = lookup_label(c_parser_peek_token (parser)->value);
6792- //TREE_USED(label) = 1;
6793-
6794- tree value = build1(ADDR_EXPR, ptr_type_node, return_label1);
6795- SET_EXPR_LOCATION (value, next);
6796- TREE_SIDE_EFFECTS (value) = 1;
6797- add_stmt(value);
6798-
6799- TREE_SIDE_EFFECTS (stmt) = 1;
6800- expr.value = c_finish_stmt_expr (stmt);
6801- expr.original_code = ERROR_MARK;
6802-
6803-
6804- }
6805- else
6806- {
6807- //tree label = lookup_label(c_parser_peek_token (parser)->value);
6808- //TREE_USED(label) = 1;
6809- //expr.value = build1(ADDR_EXPR, ptr_type_node, label);
6810- expr.value = build1(ADDR_EXPR, ptr_type_node, return_label1);
6811- c_parser_consume_token (parser);
6812- }
6813-#else //by KENT.
68146709 {
68156710 /*
68166711 ({
68176712 __label__ _cbc_exit0;
6818- void __return_func(int retval_, void *_envp){
6819- retval = retval_;
6820- goto exit0;
6713+ int retval; // should be thread local
6714+ void _cbc_internal_return(int retval_, void *_envp){
6715+ retval = retval_;
6716+ goto _cbc_exit0;
68216717 }
68226718 if (0) {
68236719 _cbc_exit0:
6824- return retval;
6720+ return retval;
68256721 }
6826- __return_func;
6722+ _cbc_internal_return;
68276723 });
68286724 */
68296725 tree value, stmt, label, tlab, decl;
@@ -6858,16 +6754,12 @@
68586754 value = build_addr (decl , current_function_decl);
68596755 SET_EXPR_LOCATION (value, location);
68606756 add_stmt (value);
6861- /*value = build_external_ref (get_identifier("_cbc_internal_return"), false, location);*/
6862- /*value = build_unary_op (location, ADDR_EXPR, value, 0);*/
6863- /*add_stmt (value);*/
68646757
68656758 TREE_SIDE_EFFECTS (stmt) = 1;
68666759 expr.value = c_finish_stmt_expr (location, stmt);
68676760 expr.original_code = ERROR_MARK;
68686761 }
68696762
6870-#endif //0
68716763 break;
68726764 #endif //noCbC
68736765
Show on old repository browser