changeset 321:80beb03e5b73

ULL,ull, 0x0ull etc.
author kono
date Sat, 19 Jun 2004 07:11:12 +0900
parents 183726ccd83d
children 46ac55e8b14c
files .gdbinit Changes mc-parse.c
diffstat 3 files changed, 79 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/.gdbinit	Sat Jun 19 00:13:36 2004 +0900
+++ b/.gdbinit	Sat Jun 19 07:11:12 2004 +0900
@@ -1,7 +1,7 @@
 tb main
 # run  -s test/arg.c
 # run  -s -ob00.s mc-parse.c
-run  -s asm-powerpc.c
+run  -s l.c
 # run -s test/code-gen-all.c
 define regs 
 printf "pc =%08x lr =%08x r0 =%08x r1 =%08x r3= %08x r4= %08x\n",$pc,$lr,$r0,$r1,$r3,$r4
--- a/Changes	Sat Jun 19 00:13:36 2004 +0900
+++ b/Changes	Sat Jun 19 07:11:12 2004 +0900
@@ -4993,3 +4993,22 @@
 
 なんか、間違えた。%0...%8 は、パラメターの順序を
 さしているのね。そうだよな。
+
+Sat Jun 19 00:17:33 JST 2004
+
+asm は終りました。まぁ、ia32とかMIPSとかは、独自な問題が
+あるんだろうけど。
+
+Sat Jun 19 06:40:30 JST 2004
+
+label がfunction localになってないみたい。
+
+builtin_expect かぁ。
+
+bit filed が少しある見たい。
+
+結局、全部、実装しないとだめか。
+     q = (struct spin_lock) { };
+
+とか。
+
--- a/mc-parse.c	Sat Jun 19 00:13:36 2004 +0900
+++ b/mc-parse.c	Sat Jun 19 07:11:12 2004 +0900
@@ -524,6 +524,7 @@
 	return;
     }
     if(sym==LC || ( sym!=SM && sym!=COMMA && sym!=ASS )) {
+	if (mode!=GDECL) error(DCERR);
         stypedecl=sd;
 	if (car(type)==CODE) {
 	    code_decl(n); return;
@@ -2190,6 +2191,7 @@
 	nptr0 = (NMTBL *)cadr(e1);
 	t = nptr0->sc;
 	if (t==EMPTY||t==EXTRN1||t==EXTRN) {
+	    nptr0=lsearch(nptr0->nm,0);
 	    nptr0->sc = FLABEL;
 	    jmp(nptr0->dsp = fwdlabel());
 	} else if (t==FLABEL||t==BLABEL) {
@@ -2233,14 +2235,16 @@
 static void
 dolabel(void)
 {
+    NMTBL *nptr1;
     control=1;
     checkret();
     if(nptr->sc == FLABEL)
 	fwddef(nptr->dsp);
     else if(nptr->sc != EMPTY && nptr->sc != EXTRN1)
 	error(TYERR);
-    nptr->sc = BLABEL;
-    nptr->dsp = backdef();
+    nptr1=lsearch(nptr->nm,0);
+    nptr1->sc = BLABEL;
+    nptr1->dsp = backdef();
     conv->label_();
     getsym(0);
     checksym(COLON);
@@ -3995,6 +3999,21 @@
 }
 
 static int
+is_ll()
+{
+    if (ch=='U' || ch=='u') {
+	getch();
+    }
+    if (ch=='L'||ch=='l') {
+	if (getch()=='L'||ch=='l') {
+	    getch();
+	    return 1;
+	}
+    }
+    return 0;
+}
+
+static int
 get_numerical()
 {
     int d;
@@ -4021,7 +4040,8 @@
 	if (getch() == 'x' || ch == 'X') {
 	    /* hexadicimal */
 	    while(1) {
-		if(digit(getch()))
+		getch(); *cheapp++ = ch;
+		if(digit(ch))
 		    symval=symval*16+ch-'0';
 		else if('a'<=ch&&ch<='f')
 		    symval=symval*16+ch-'a'+10;
@@ -4029,63 +4049,65 @@
 		    symval=symval*16+ch-'A'+10;
 		else break;
 	    }
+	    if (is_ll()) {
+#if LONGLONG_CODE
+		*cheapp++ = 0;
+		lsymval = strtoll(scheapp,0,0);
+		cheapp=scheapp;
+		return sym=LCONST;
+#endif
+	    }
 	    return sym=CONST;
-	} else if (ch!='.'&&ch!='L'&&ch!='U') {
+	} else if (digit(ch)) {
 	    /* octal */
-	    while (digit(ch)) {
-		symval=symval*8+ch-'0';getch();
+	    while(1) {
+		getch(); *cheapp++ = ch;
+		if(digit(ch))
+		    symval=symval*8+ch-'0';
+		else break;
 	    }
+	    if (is_ll()) {
+#if LONGLONG_CODE
+		*cheapp++ = 0;
+		lsymval = strtoll(scheapp,0,0);
+		cheapp=scheapp;
+		return sym=LCONST;
+#endif
+	    }
+	    cheapp=scheapp;
 	    return sym=CONST;
 	} else if (ch=='L'||ch=='U') {  /* 0L or 0LL case */
-	    if (getch()=='L') {
+	    if (is_ll()) {
 #if LONGLONG_CODE
-		getch();
 		lsymval = 0;
 		return sym=LCONST;
-#else
-		symval = 0;
-		return sym=CONST;
 #endif
-	    } else {
-		symval = 0;
-		return sym=CONST;
 	    }
+	} else if (ch=='.'||ch=='e') {
+	    d=1;
+	    *cheapp++ = '0'; /* 0. case */
+	} else {
+	    cheapp=scheapp;
+	    symval = 0;
+	    return sym=CONST;
 	}
-	d=1;
-	*cheapp++ = '0'; /* 0. case */
     } else {
 	while(digit(ch)) {
 	    *cheapp++ = ch;
 	    symval=symval*10+ch-'0';getch();
 	}
-	if (!(ch=='.'||ch=='e'||ch=='L'||ch=='U')) {
-	    cheapp=scheapp;
-	    return sym=CONST;
-	}
+	if (ch=='.'||ch=='e') d=1;
     }
-    if (!d && ch=='U') {
-	getch();
-	if (ch=='L')  {
-	    getch();
-	    return sym=CONST; // unsigned constant
-	} else
-	    error(CHERR);
-    }
-    if (!d && ch=='L') {
-	getch();
-	if (ch=='L') {
+    if (!d) {
+	if (is_ll()) {
 #if LONGLONG_CODE
-	    getch(); /*LONGLONG*/
 	    *cheapp++ = 0;
-	    lsymval = strtoll(scheapp,0,0);  // unsigned should be considered
+	    lsymval = strtoll(scheapp,0,0);
 	    cheapp=scheapp;
 	    return sym=LCONST;
-#else
-	    error(CHERR);
-	    symval = 0;
-	    return sym=CONST;
 #endif
 	}
+	cheapp=scheapp;
 	return sym=CONST;
     }
 #if FLOAT_CODE