# HG changeset patch # User kono # Date 1137569735 -32400 # Node ID 82718dc9f758cf359ad4b9b1e46800a18381f48b # Parent c991b82e6849c2b4cc50092e9e91ca82192446c0 declaration anyware diff -r c991b82e6849 -r 82718dc9f758 mc-code-mips.c --- a/mc-code-mips.c Wed Jan 18 15:40:44 2006 +0900 +++ b/mc-code-mips.c Wed Jan 18 16:35:35 2006 +0900 @@ -182,7 +182,7 @@ static int max_reg_var, max_freg_var; static char *reg_name[] = { - "$0","$1","$2","$3","$4","$5","$6","$7","$8","$9", + "$0","$fp","$2","$3","$4","$5","$6","$7","$8","$9", "$10","$11","$12","$13","$14","$15","$16","$17","$18","$19", "$20","$21","$22","$23","$24","$25","$26","$27","$28","$29", "$30","$31", diff -r c991b82e6849 -r 82718dc9f758 mc-parse.c --- a/mc-parse.c Wed Jan 18 15:40:44 2006 +0900 +++ b/mc-parse.c Wed Jan 18 16:35:35 2006 +0900 @@ -1427,6 +1427,9 @@ decl_data_1(int type,NMTBL *n,int offset) { int t; + + // casted initializer (sturct hoge){.a=3,.b=c,...} + getsym(0); if (sym==LPAR) { offset = decl_data_1(type,n,offset); @@ -1871,11 +1874,12 @@ /* local decl can be used, after {} */ /* but it's lexical scope remains after {} */ /* my be in for(int i=....) not yet (fixed already?) */ +/* After this call, emit_init_vars() is required */ static void -local_decl() +local_decl(int scope) { - enter_scope(); + if (scope) enter_scope(); init_vars=0; /* local variable declaration */ stmode=0; @@ -1944,7 +1948,7 @@ init_vars=0; /* local variable declaration */ - local_decl(); + local_decl(1); control=1; cslabel = -1; if (!inmode && !chk) gen_enter1(); @@ -2069,6 +2073,16 @@ if(sym==SM) { conv->sm_(); getsym(0); return; + } else if (typeid(sym) || sym==REGISTER ) { + // anytime local declaration... + mode=LDECL; + stmode=0; + lfree_type_limit = lfree; + decl(); + mode=STAT; + checkret(); + emit_init_vars(); + goto loop; } switch(sym) { case IF: @@ -2426,7 +2440,7 @@ int slimit = lfree_type_limit ; int sinit_vars = init_vars; conv->lc_(); - local_decl(); + local_decl(1); emit_init_vars(); lfree_type_limit = lfree; while(sym!=RC) statement(use);