changeset 688:10c8eaf0f73b scope-fix

scope fix done.
author kono
date Sat, 06 Oct 2007 15:49:04 +0900
parents 1ed8cb78cf9b
children baa67e2e54d2
files .gdbinit Changes mc-codegen.c mc-parse.c test/call.c test/tmp6.code-out
diffstat 6 files changed, 64 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Fri Oct 05 17:49:11 2007 +0900
+++ b/.gdbinit	Sat Oct 06 15:49:04 2007 +0900
@@ -14,7 +14,8 @@
 end
 b errmsg
 # r -s test/tmp7.c
-r -s test/tmp6.c
+# r -s test/tmp6.c
+r -s test/call.c
 # r -s test/code-gen-all.c
 # r -s mc-code-powerpc.c
 # r -s test/strinit.c
--- a/Changes	Fri Oct 05 17:49:11 2007 +0900
+++ b/Changes	Sat Oct 06 15:49:04 2007 +0900
@@ -9496,7 +9496,22 @@
 
 Intelのnested function call order は直しました。
 
-
-
-
-
+CAST を pexpr で展開しないと、contains_p でCONVがひっかからない。
+
+あとは、
+    fact-a の print のnptr の扱いが変。
+ここだけ。
+
+    void print(  void (*print)() ) {
+    }
+
+とした時にまずい?
+
+Sat Oct  6 15:47:41 JST 2007
+
+ようやっと出来たよ...
+
+COMPの構文を保存してない。
+
+fdecl を pfdecl を呼び出すようにする。(直接生成はoptionで残す?)
+
--- a/mc-codegen.c	Fri Oct 05 17:49:11 2007 +0900
+++ b/mc-codegen.c	Sat Oct 06 15:49:04 2007 +0900
@@ -4895,8 +4895,10 @@
 			    compatible(cadr(cadr(t)),cadr(n->ty));
 			}
 			// arguments
-			if (targ0)
-			    compatible(targ0,targ1);
+			for (;targ0;targ0=cadr(targ0),targ1=cadr(targ1)) {
+			    if (car(targ0)==DOTS) break;
+			    compatible(car(targ0),car(targ1));
+			}
 		    }
 		    break;
 		default:
--- a/mc-parse.c	Fri Oct 05 17:49:11 2007 +0900
+++ b/mc-parse.c	Sat Oct 06 15:49:04 2007 +0900
@@ -2056,7 +2056,7 @@
     /* local variable declaration */
     control=1;
     cslabel = -1;
-    local_decl(1);
+    local_decl(0);
     if(!inmode && !chk) gen_code_enter1(args);
     emit_init_vars();
     // lfree_type_limit = lfree;
@@ -2131,7 +2131,7 @@
     control=1;
     cslabel = -1;
     /* local variable declaration */
-    local_decl(1);
+    local_decl(0);
     if (!inmode && !chk) gen_enter1();
     emit_init_vars();
     lfree_type_limit  = lfree;
--- a/test/call.c	Fri Oct 05 17:49:11 2007 +0900
+++ b/test/call.c	Sat Oct 06 15:49:04 2007 +0900
@@ -62,6 +62,33 @@
 };
 
 
+
+void print( int i, void (*print)(int i,void (*)()) );
+
+void print0( int i, void (*print1)(int i,void (*)()) )
+{
+    printf("print0 %d %d\n",print1 == print,i);
+}
+
+void print( int i, void (*print)(int i,void (*)()) )
+{
+    print0(i,print);
+    (*print)(i,print);
+}
+
+void pppp( void (*pppp)(void (*)()) );
+
+void pppp0( void (*pppp1)(void (*)()) )
+{
+    printf("pppp0 %d\n",pppp1 == pppp);
+}
+
+void pppp( void (*pppp)(void (*)()) )
+{
+    pppp0(pppp);
+    (*pppp)(pppp);
+}
+
 int
 main(int ac,char *av[]) {
     int j,k;
@@ -84,5 +111,9 @@
     printf("#0083: 1 = %d\n",a5 == faddrs[1]);
     printf("#0084: 1 = %d\n",&a2 == faddrs[2]);
     printf("#0085: 1 = %d\n",&a5 == faddrs[3]);
+
+    print(55,print0);
+    pppp(pppp0);
+
     return 0;
 }
--- a/test/tmp6.code-out	Fri Oct 05 17:49:11 2007 +0900
+++ b/test/tmp6.code-out	Sat Oct 06 15:49:04 2007 +0900
@@ -1,6 +1,6 @@
-a used.
-2: av=1 av[0]=1 test1
-code0
-4: test1
-5: test1
-5: i=123 j=456 k=2 av=1
+#0012:a used.
+#0033:2: av=1 av[0]=1 test1
+#0047:code0
+#0059:4: test1
+#0071:5: test1
+#0072:5: i=123 j=456 k=2 av=1