Changed types in core allocation routines, changed lint flags

This commit is contained in:
ceriel 1990-12-17 14:55:03 +00:00
parent e37c249248
commit 1139272435
8 changed files with 42 additions and 38 deletions

View file

@ -6,13 +6,14 @@ SHARE=../share
LDFLAGS=-i
CPPFLAGS=-DVERBOSE -DNOTCOMPACT
CFLAGS=$(CPPFLAGS) -O
LINTFLAGS=-hbac
LINTFLAGS=-hbu
CFILES=\
debug.c global.c files.c go.c map.c aux.c get.c put.c alloc.c lset.c\
cset.c parser.c stack_chg.c locals.c init_glob.c
SRC=\
types.h def.h debug.h debug.c global.h global.c files.h files.c go.h go.c\
map.h map.c aux.h aux.c get.h get.c put.h put.c alloc.h alloc.c lset.h lset.c\
cset.h cset.c parser.h parser.c stack_chg.h stack_chg.c locals.h locals.c\
init_glob.h init_glob.c
types.h def.h debug.h global.h files.h go.h map.h aux.h get.h put.h alloc.h\
lset.h cset.h parser.h stack_chg.h locals.h init_glob.h $(CFILES)
PRFILES=$(SRC)

View file

@ -16,14 +16,14 @@
#include "alloc.h"
short * myalloc();
short * malloc();
char * myalloc();
char * calloc();
#ifdef DEBUG
STATIC unsigned maxuse, curruse;
short *newcore(size)
char *newcore(size)
int size;
{
if ((curruse += (unsigned) (size+2)) > maxuse) maxuse = curruse;
@ -31,7 +31,7 @@ short *newcore(size)
}
oldcore(p,size)
short *p;
char *p;
int size;
{
curruse -= (size+2);
@ -129,7 +129,7 @@ oldline(lnp) register line_p lnp; {
if (kind == OPLIST)
oldargs(ARG(lnp));
oldcore((short *) lnp,lsizetab[kind]);
oldcore((char *) lnp,lsizetab[kind]);
}
arg_p newarg(kind) int kind; {
@ -155,7 +155,7 @@ oldargs(ap) register arg_p ap; {
oldargb(ap->a_a.a_con.ac_con.ab_next);
break;
}
oldcore((short *) ap,asizetab[ap->a_type]);
oldcore((char *) ap,asizetab[ap->a_type]);
ap = next;
}
}
@ -165,7 +165,7 @@ oldargb(abp) register argb_p abp; {
while (abp != (argb_p) 0) {
next = abp->ab_next;
oldcore((short *) abp,sizeof (argb_t));
oldcore((char *) abp,sizeof (argb_t));
abp = next;
}
}
@ -175,7 +175,7 @@ oldobjects(op) register obj_p op; {
while (op != (obj_p) 0) {
next = op->o_next;
oldcore((short *) op, sizeof(struct obj));
oldcore((char *) op, sizeof(struct obj));
op = next;
}
}
@ -183,7 +183,7 @@ oldobjects(op) register obj_p op; {
olddblock(dbl) dblock_p dbl; {
oldobjects(dbl->d_objlist);
oldargs(dbl->d_values);
oldcore((short *) dbl, sizeof(struct dblock));
oldcore((char *) dbl, sizeof(struct dblock));
}
@ -191,8 +191,9 @@ short **newmap(length) short length; {
return((short **) newcore((length+1) * sizeof(short *)));
}
/*ARGSUSED1*/
oldmap(mp,length) short **mp, length; {
oldcore((short *) mp, (length+1) * sizeof(short *));
oldcore((char *) mp, (length+1) * sizeof(short *));
}
@ -204,8 +205,9 @@ cset newbitvect(n) short n; {
*/
}
/*ARGSUSED1*/
oldbitvect(s,n) cset s; short n; {
oldcore((short *) s, (n-1)*sizeof(int) + sizeof(struct bitvector));
oldcore((char *) s, (n-1)*sizeof(int) + sizeof(struct bitvector));
}
@ -213,8 +215,9 @@ short *newtable(length) short length; {
return((short *) newcore((length+1) * sizeof(short)));
}
/*ARGSUSED1*/
oldtable(mp,length) short **mp, length; {
oldcore((short *) mp, (length+1) * sizeof(short));
oldcore((char *) mp, (length+1) * sizeof(short));
}
cond_p newcondtab(l) int l;
@ -226,17 +229,15 @@ oldcondtab(tab) cond_p tab;
{
int i;
for (i = 0; tab[i].mc_cond != DEFAULT; i++);
oldcore((short *) tab,((i+1) * sizeof (struct cond_tab)));
oldcore((char *) tab,((i+1) * sizeof (struct cond_tab)));
}
short *myalloc(size) register size; {
register short *p,*q;
char *myalloc(size) register size; {
register char *p;
p = malloc(size);
p = calloc((unsigned) size, 1);
if (p == 0)
error("out of memory");
for(q=p;size>0;size -= sizeof(short))
*q++ = 0;
return(p);
}

View file

@ -9,16 +9,16 @@
*/
#ifdef DEBUG
extern short *newcore();
extern char *newcore();
extern oldcore();
#else
extern short *myalloc();
extern char *myalloc();
#define newcore(size) myalloc(size)
#define oldcore(p,size) free(p)
#define oldcore(p,size) free((char *)p)
#endif
#define newstruct(t) (newcore (sizeof (struct t)))
#define oldstruct(t,p) oldcore((short *) p,sizeof (struct t))
#define newstruct(t) ((struct t *) newcore (sizeof (struct t)))
#define oldstruct(t,p) oldcore((char *) p,sizeof (struct t))
extern line_p newline(); /* (byte optype) */
extern arg_p newarg(); /* (byte argtype) */

View file

@ -441,7 +441,7 @@ message(lnp)
case ms_reg:
if (ARG(lnp)->a_next != (arg_p) 0) {
/* take only "mes 3" with further arguments */
Ladd(lnp,&mesregs);
Ladd((Lelem_t) lnp,&mesregs);
}
break;
case ms_err:
@ -546,7 +546,7 @@ bool getunit(gf,lf,kind_out,g_out,l_out,p_out,collect_mes)
lp->lp_level = getshort(); /* nesting level */
lp->lp_entry = getblock(getshort()); /* entry block of the loop */
lp->lp_end = getblock(getshort()); /* tail of back edge of loop */
Ladd(lp,&curproc->p_loops);
Ladd((Lelem_t)lp,&curproc->p_loops);
}
*g_out = head;
return TRUE;

View file

@ -118,6 +118,7 @@ Lindex Lfirst(s)
}
/*ARGSUSED1*/
Lindex Lnext(i,s)
Lindex i;
lset s;

View file

@ -110,7 +110,7 @@ STATIC outint(i)
outshort(i);
} else {
assert (sizeof(int) == sizeof(offset));
outoff(i);
outoff((offset) i);
}
}
@ -242,7 +242,7 @@ putdtable(head,df)
}
fclose(curoutp);
if (omap != (obj_p *) 0) {
oldmap(omap,olength); /* release memory for omap */
oldmap((short **) omap,olength); /* release memory for omap */
}
}
@ -315,7 +315,7 @@ putptable(head,pf,all)
}
fclose(curoutp);
if (pmap != (proc_p *) 0) {
oldmap(pmap,plength); /* release memory for pmap */
oldmap((short **) pmap,plength); /* release memory for pmap */
}
}
@ -434,9 +434,9 @@ putunit(kind,p,l,gf,lf)
oldbblock(b);
}
/* Release the memory for the lmap, lbmap, bmap, lpmap tables */
if (lmap != (line_p *) 0) oldmap(lmap,llength);
if (lbmap != (bblock_p *) 0) oldmap(lbmap,llength);
if (bmap != (bblock_p *) 0) oldmap(bmap,blength);
if (lpmap != (loop_p *) 0) oldmap(lpmap,lplength);
if (lmap != (line_p *) 0) oldmap((short **) lmap,llength);
if (lbmap != (bblock_p *) 0) oldmap((short **) lbmap,llength);
if (bmap != (bblock_p *) 0) oldmap((short **) bmap,blength);
if (lpmap != (loop_p *) 0) oldmap((short **) lpmap,lplength);
curoutp = lf;
}

View file

@ -86,7 +86,6 @@ error(s,a) char *s,*a; {
fprintf(stderr,": ");
fprintf(stderr,s,a);
fprintf(stderr,"\n");
abort();
exit(-1);
}

View file

@ -163,6 +163,7 @@ union pext_t {
#define IS_CALLED_IN_LOOP(p) (p->p_flags1 & PF_CALINLOOP)
#define IS_ENTERED_WITH_GTO(p) (p->p_flags1 & PF_GTO)
#define ENTERED_WITH_GTO(p) p->p_flags1 |= PF_GTO
#define BODY_KNOWN(p) (p->p_flags1 & (byte) PF_BODYSEEN)
/* LOOPS */
@ -212,6 +213,7 @@ struct use {
#define CF_INDIR 01
#define UF_INDIR 01
#define CHANGE_INDIR(p) (p->p_change->c_flags & CF_INDIR)
/* SETS */