changeset 362:5cf12c7a3274

local label first try
author kono
date Mon, 05 Jul 2004 14:40:20 +0900
parents 93652cda75c7
children f3f2b7906d50
files Changes mc-codegen.c mc-parse.c mc.h stdio.h
diffstat 5 files changed, 21 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Changes	Mon Jul 05 13:55:46 2004 +0900
+++ b/Changes	Mon Jul 05 14:40:20 2004 +0900
@@ -5502,3 +5502,7 @@
 
 なんか、type と tag をglobalにするので通ったけど... scope
 に関しては、もう少しテストを書かないとだめだな。
+
+Mon Jul  5 14:11:07 JST 2004
+
+local label ね。まぁ、簡単なんだけど...
--- a/mc-codegen.c	Mon Jul 05 13:55:46 2004 +0900
+++ b/mc-codegen.c	Mon Jul 05 14:40:20 2004 +0900
@@ -2441,6 +2441,10 @@
     case LTDECL:
 	nsc = TYPE;
 	break;
+    case LLDECL:
+	nsc = BLABEL;
+	n->dsp = backdef();
+	break;
     case ADECL:
 	if(!integral(type)&&(car(type)==FUNCTION||car(type)==CODE)) {
 	    type=list2(POINTER,type); n->ty = type;
--- a/mc-parse.c	Mon Jul 05 13:55:46 2004 +0900
+++ b/mc-parse.c	Mon Jul 05 14:40:20 2004 +0900
@@ -398,6 +398,7 @@
     reserve("typeof",TYPEOF);
     reserve("__typeof__",TYPEOF);
     reserve("__builtin_alloca",ALLOCA);
+    reserve("__label__",LABEL);
 #if ASM_CODE
     reserve("asm",ASM);
     reserve("__asm__",ASM);
@@ -578,6 +579,11 @@
 	    stmode=EXTRN;
 	} else
 	    error(DCERR);
+    } else if(sym==LABEL) {
+	if(mode==LDECL) {
+	    getsym(0);
+	    mode = LLDECL;
+	} else error(DCERR);
     } else if(sym==TYPEDEF) {
 	if(mode==GDECL) {
 		getsym(0);
@@ -1440,7 +1446,7 @@
     /* local variable declaration */
     stmode=0;
     mode=STAT;
-    while (typeid(getsym(0)) || sym==STATIC || sym==EXTRN
+    while (typeid(getsym(0)) || sym==STATIC || sym==EXTRN || sym==LABEL
 		|| sym==REGISTER || sym==TYPEDEF) {
 	mode=LDECL;
 	stmode=0;
@@ -1696,8 +1702,7 @@
     getsym(0);
     checksym(LPAR);
     slfree=lfree;
-    if (typeid(sym) || sym==STATIC || sym==EXTRN
-		|| sym==REGISTER || sym==TYPEDEF) {
+    if (typeid(sym) || sym==REGISTER ) {
 	enter_scope(); dflag = 1;
 	mode=LDECL;
 	stmode=0;
--- a/mc.h	Mon Jul 05 13:55:46 2004 +0900
+++ b/mc.h	Mon Jul 05 14:40:20 2004 +0900
@@ -68,7 +68,8 @@
 #define ULONGLONG       (-56)
 #define VOLATILE        (-57)
 #define TYPEOF  (-58)
-#define ASM     (-59)
+#define LABEL   (-59)
+#define ASM     (-60)
 
 /* reserved word end */
 
@@ -91,7 +92,8 @@
 #define MDECL   13
 #define GEDECL  14
 #define LEDECL  15
-#define SFDINIT 16
+#define LLDECL  16
+#define SFDINIT 17
 /* mode end */
 
 #define US      1
--- a/stdio.h	Mon Jul 05 13:55:46 2004 +0900
+++ b/stdio.h	Mon Jul 05 14:40:20 2004 +0900
@@ -1,4 +1,4 @@
-#ifndef __micro_c__aaa
+#ifndef __micro_c__
 #include "/usr/include/stdio.h"
 long long strtoll(const char *, char **, int);
 char *malloc(int);