cast ptrdiff_t to int for ANSI
authorceriel <none@none>
Wed, 25 Apr 1990 14:23:05 +0000 (14:23 +0000)
committerceriel <none@none>
Wed, 25 Apr 1990 14:23:05 +0000 (14:23 +0000)
mach/proto/cg/codegen.c
mach/proto/cg/move.c
mach/proto/cg/reg.c
mach/proto/cg/subr.c
modules/src/em_code/C_out.c
modules/src/em_code/em.c
modules/src/em_code/em_code.3X
util/led/main.c

index 4da1fe0..8923db3 100644 (file)
@@ -462,7 +462,7 @@ if (Debug > 1) fprintf(stderr, "cost after coercions: %u\n", t);
                do {
                        npos=exactmatch=0;
                        for(rpp=reglist[propno];rp= *rpp; rpp++)
-                               if (getrefcount(rp-machregs, FALSE)==0) {
+                               if (getrefcount((int)(rp-machregs), FALSE)==0) {
                                        pos[npos++] = rp-machregs;
                                        if (eqtoken(&rp->r_contents,&token))
                                                exactmatch++;
index 8d8cb70..e67069e 100644 (file)
@@ -57,7 +57,7 @@ move(tp1,tp2,ply,toplevel,maxcost) token_p tp1,tp2; unsigned maxcost; {
                        for (i=0;i<TOKENSIZE;i++)
                                if (tdp->t_type[i] == EV_REG &&
                                    clash(rp->r_contents.t_att[i].ar,tp2->t_att[0].ar)) {
-                                       erasereg(rp-machregs);
+                                       erasereg((int)(rp-machregs));
                                        break;
                                }
                }
index a0443c7..f93ddd1 100644 (file)
@@ -78,7 +78,7 @@ erasereg(regno) {
                        rp->r_contents.t_token = 0;
                        for (i=0;i<TOKENSIZE;i++)
                                rp->r_contents.t_att[i].aw = 0;
-                       awayreg(rp-machregs);
+                       awayreg((int)(rp-machregs));
                }
 #endif
 }
@@ -94,13 +94,13 @@ awayreg(regno) {
        for (rp=machregs;rp<machregs+NREGS;rp++) {
                if (rp->r_contents.t_token == -1) {
                        if (rp->r_contents.t_att[0].ar == regno)
-                               erasereg(rp-machregs);
+                               erasereg((int)(rp-machregs));
                } else if (rp->r_contents.t_token > 0) {
                        tdp= & tokens[rp->r_contents.t_token];
                        for (i=0;i<TOKENSIZE;i++)
                                if (tdp->t_type[i] == EV_REG && 
                                    rp->r_contents.t_att[i].ar == regno) {
-                                       erasereg(rp-machregs);
+                                       erasereg((int)(rp-machregs));
                                        break;
                                }
                }
index 27b10dc..f86ae82 100644 (file)
@@ -432,7 +432,7 @@ unsigned stackupto(limit,ply,toplevel) token_p limit; {
                                if (cp->c1_prop>=0) {
                                        for (rpp=reglist[cp->c1_prop];
                                               (rp = *rpp)!=0 &&
-                                              getrefcount(rp-machregs, TRUE)!=0;
+                                              getrefcount((int)(rp-machregs), TRUE)!=0;
                                                  rpp++)
                                                ;
                                        if (rp==0)
index 976d9c0..e2f692d 100644 (file)
@@ -12,6 +12,7 @@ static arg();
 static pseudo();
 
 extern char em_flag[];
+char C_error;
 
 #define flags(pp)      (em_flag[(pp)->em_opcode - sp_fmnem] & EM_PAR)
 
@@ -26,6 +27,7 @@ C_alloc()
 arith C_holsize, C_bsssize;
 int C_holinit, C_bssinit;
 
+int
 C_out(p)
        register struct e_instr *p;
 {
@@ -75,8 +77,11 @@ C_out(p)
                DFDNAM(p->em_dnam);
                NL();
                break;
-
+       default:
+               C_error = "Illegal EM line";
+               return 0;
        }
+       return 1;
 }
 
 static
index cad00d1..8f33038 100644 (file)
@@ -70,7 +70,7 @@ C_flush() {
                return;
        }
 #endif
-       if (C_opp != obuf && sys_write(C_ofp, obuf, C_opp - obuf) == 0) {
+       if (C_opp != obuf && sys_write(C_ofp, obuf, (int)(C_opp - obuf)) == 0) {
                C_ofp = 0;
                C_failed();
        }
index 2ab2ddd..71f76c4 100644 (file)
@@ -66,6 +66,13 @@ emcode \- EM code interface for compilers
 .B int C_getid()
 .PP
 .B char *C_tmpdir;
+.PP
+.B #include <em.h>
+.PP
+.B int C_out(p)
+.B struct e_instr *p;
+.PP
+.B char *C_error;
 .fi
 .SH DESCRIPTION
 This package provides a procedural EM code interface to be used in
@@ -437,6 +444,14 @@ The user can change this by just changing
 .I C_tmpdir
 before calling
 .IR C_open.
+.PP
+.I C_out
+accepts a structure as delivered by the
+.I read_em
+module, and produces code for it. It returns 1 if it succeeds, 0 if it fails
+for some reason. The reason can then be found in \fIC_error\fP. The
+.I C_out
+routine replaces the EM_mkcalls routine.
 .SH FILES
 .nf
 ~em/modules/h/em.h
index 684c44e..d64dad7 100644 (file)
@@ -70,7 +70,7 @@ do_statistics()
 
        while (m <= &mems[NMEMS-1]) {
                fprintf(stderr, "mem %d: full %lx, free %lx\n",
-                               m - mems,
+                               (int)(m - mems),
                                (long) m->mem_full,
                                (long) m->mem_left);
                m++;