shithub: scc

Download patch

ref: f0bc983dc4f68b4e51fdb813deb2f780c4ef4a34
parent: bc832080da4af31728bd6e30ae1c13d3704e55ef
author: Quentin Rameau <quinq@fifth.space>
date: Thu May 19 09:50:01 EDT 2016

[cc2] Remove TSIZE type

As done for cc1

--- a/cc2/arch/amd64-sysv/arch.h
+++ b/cc2/arch/amd64-sysv/arch.h
@@ -2,4 +2,3 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
-#define TSIZE   unsigned long
--- a/cc2/arch/amd64-sysv/code.c
+++ b/cc2/arch/amd64-sysv/code.c
@@ -120,11 +120,11 @@
 			s = "\t.quad\t";
 			break;
 		default:
-			s = "\t.space\t%llu,";
+			s = "\t.space\t%lu,";
 			break;
 		}
 	}
-	printf(s, (unsigned long long) tp->size);
+	printf(s, tp->size);
 }
 
 
@@ -158,15 +158,12 @@
 		return;
 	case SGLOB:
 		printf("\t.global\t%s\n", name);
-		if (seg == BSSSEG) {
-			printf("\t.comm\t%s,%llu\n",
-			       name,
-			       (unsigned long long) tp->size);
-		}
+		if (seg == BSSSEG)
+			printf("\t.comm\t%s,%lu\n", name, tp->size);
 		break;
 	}
 	if (sym->type.align != 1)
-		printf("\t.align\t%lld\n", (long long) sym->type.align );
+		printf("\t.align\t%lu\n", sym->type.align );
 	printf("%s:\n", name);
 }
 
--- a/cc2/arch/i386-sysv/arch.h
+++ b/cc2/arch/i386-sysv/arch.h
@@ -2,4 +2,3 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
-#define TSIZE   unsigned long
--- a/cc2/arch/i386-sysv/code.c
+++ b/cc2/arch/i386-sysv/code.c
@@ -120,11 +120,11 @@
 			s = "\t.quad\t";
 			break;
 		default:
-			s = "\t.space\t%llu,";
+			s = "\t.space\t%lu,";
 			break;
 		}
 	}
-	printf(s, (unsigned long long) tp->size);
+	printf(s, tp->size);
 }
 
 void
@@ -157,15 +157,12 @@
 		return;
 	case SGLOB:
 		printf("\t.global\t%s\n", name);
-		if (seg == BSSSEG) {
-			printf("\t.comm\t%s,%llu\n",
-			       name,
-			       (unsigned long long) tp->size);
-		}
+		if (seg == BSSSEG)
+			printf("\t.comm\t%s,%lu\n", name, tp->size);
 		break;
 	}
 	if (sym->type.align != 1)
-		printf("\t.align\t%lld\n", (long long) sym->type.align );
+		printf("\t.align\t%lud\n", sym->type.align );
 	printf("%s:\n", name);
 }
 
--- a/cc2/arch/qbe/arch.h
+++ b/cc2/arch/qbe/arch.h
@@ -2,7 +2,6 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
-#define TSIZE   unsigned long
 
 enum asmop {
 	ASNOP = 0,
--- a/cc2/arch/qbe/code.c
+++ b/cc2/arch/qbe/code.c
@@ -261,7 +261,7 @@
 	printf("data %s = {\n", symname(sym));
 	if (sym->type.flags & INITF)
 		return;
-	printf("\tz\t%llu\n}\n", (unsigned long long) sym->type.size);
+	printf("\tz\t%lu\n}\n", sym->type.size);
 }
 
 void
@@ -289,9 +289,8 @@
 {
 	Type *tp = &sym->type;
 
-	printf("\t%s %s=\talloc%lld\t%lld\n",
-	       symname(sym), size2asm(tp),
-	       (long long) tp->size, (long long) tp->align);
+	printf("\t%s %s=\talloc%lu\t%lu\n",
+	       symname(sym), size2asm(tp), tp->size, tp->align);
 }
 
 void
--- a/cc2/arch/z80/arch.h
+++ b/cc2/arch/z80/arch.h
@@ -2,4 +2,3 @@
 #define TINT    long long
 #define TUINT   unsigned long long
 #define TFLOAT  double
-#define TSIZE   unsigned short
--- a/cc2/arch/z80/code.c
+++ b/cc2/arch/z80/code.c
@@ -14,7 +14,7 @@
 };
 
 static int curseg = NOSEG;
-static TSIZE offpar, offvar;
+static unsigned long offpar, offvar;
 
 static void
 segment(int seg)
@@ -147,11 +147,11 @@
 			s = "\tDD\t";
 			break;
 		default:
-			s = "\tDS\t%llu,";
+			s = "\tDS\t%lu,";
 			break;
 		}
 	}
-	printf(s, (unsigned long long) tp->size);
+	printf(s, tp->size);
 }
 
 void
@@ -163,7 +163,7 @@
 void
 defpar(Symbol *sym)
 {
-	TSIZE align, size;
+	unsigned long align, size;
 
 	if (sym->kind != SREG && sym->kind != SAUTO)
 		return;
@@ -179,7 +179,7 @@
 void
 defvar(Symbol *sym)
 {
-	TSIZE align, size;
+	unsigned long align, size;
 
 	if (sym->kind != SREG && sym->kind != SAUTO)
 		return;
--- a/cc2/cc2.h
+++ b/cc2/cc2.h
@@ -126,8 +126,8 @@
 typedef struct inst Inst;
 
 struct type {
-	TSIZE size;
-	TSIZE align;
+	unsigned long size;
+	unsigned long align;
 	char flags;
 };
 
@@ -139,7 +139,7 @@
 	char *name;
 	char kind;
 	union {
-		TSIZE off;
+		unsigned long off;
 		Node *stmt;
 		Inst *inst;
 	} u;