more modifications due to lint

This commit is contained in:
dick 1988-08-23 12:45:11 +00:00
parent cc52343fbf
commit 61b8c3e9ec
15 changed files with 60 additions and 67 deletions

View file

@ -27,7 +27,6 @@ struct token dot, ahead, aside;
#ifndef NOPP
int ReplaceMacros = 1; /* replacing macros */
int PreProcKeys = 0; /* return preprocessor key */
int AccDefined = 0; /* accept "defined(...)" */
int UnknownIdIsZero = 0; /* interpret unknown id as integer 0 */
int Unstacked = 0; /* an unstack is done */

View file

@ -51,7 +51,6 @@ extern struct token dot, ahead, aside;
#ifndef NOPP
extern int ReplaceMacros; /* "LLlex.c" */
extern int PreProcKeys; /* "LLlex.c" */
extern int AccDefined; /* "LLlex.c" */
extern int Unstacked; /* "LLlex.c" */
extern int UnknownIdIsZero; /* "LLlex.c" */

View file

@ -3,4 +3,6 @@
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
* See the copyright notice in the ACK home directory, in the file "Copyright".
*/
#ifndef lint
static char Version[] = "ACK CEM compiler Version 3.1";
#endif lint

View file

@ -28,7 +28,6 @@
extern char *symbol2str();
extern char options[];
int
arithbalance(e1p, oper, e2p) /* RM 6.6 */
register struct expr **e1p, **e2p;
int oper;
@ -43,14 +42,16 @@ arithbalance(e1p, oper, e2p) /* RM 6.6 */
/* Now t1 and t2 are either INT or LONG or DOUBLE */
#ifndef NOFLOAT
if (t1 == DOUBLE && t2 != DOUBLE)
t2 = int2float(e2p, double_type);
else
if (t2 == DOUBLE && t1 != DOUBLE)
t1 = int2float(e1p, double_type);
else
if (t1 == DOUBLE)
return DOUBLE;
if (t1 == DOUBLE) {
if (t2 != DOUBLE)
int2float(e2p, double_type);
return;
}
if (t2 == DOUBLE) {
if (t1 != DOUBLE)
int2float(e1p, double_type);
return;
}
#endif NOFLOAT
/* Now they are INT or LONG */
@ -70,8 +71,6 @@ arithbalance(e1p, oper, e2p) /* RM 6.6 */
else
if (!u1 && u2)
t1 = int2int(e1p, (t2 == LONG) ? ulong_type : uint_type);
return t1;
}
relbalance(e1p, oper, e2p)
@ -262,7 +261,6 @@ int2int(expp, tp)
}
#ifndef NOFLOAT
int
int2float(expp, tp)
register struct expr **expp;
struct type *tp;
@ -273,7 +271,6 @@ int2float(expp, tp)
fp_used = 1;
*expp = arith2arith(tp, INT2FLOAT, *expp);
return (*expp)->ex_type->tp_fund;
}
float2int(expp, tp)

View file

@ -460,14 +460,16 @@ loc_init(expr, id)
}
}
else { /* not embraced */
struct value vl;
ch7cast(&expr, '=', tp); /* may modify expr */
EVAL(expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
vl.vl_class = Name;
vl.vl_data.vl_idf = id;
vl.vl_value = (arith)0;
store_val(&vl, tp);
{
struct value vl;
EVAL(expr, RVAL, TRUE, NO_LABEL, NO_LABEL);
vl.vl_class = Name;
vl.vl_data.vl_idf = id;
vl.vl_value = (arith)0;
store_val(&vl, tp);
}
free_expression(expr);
}
}

View file

@ -20,28 +20,29 @@
/* conversion() generates the EM code for a conversion between
the types char, short, int, long, float, double and pointer.
In case of integral type, the notion signed / unsigned is
taken into account.
There are three conversion types: signed, unsigned and floating.
The EM code to obtain this conversion looks like:
LOC sizeof(from_type)
LOC sizeof(to_type)
C??
*/
static int convtype();
conversion(from_type, to_type)
register struct type *from_type, *to_type;
{
register arith from_size = from_type->tp_size;
register arith to_size = to_type->tp_size;
int from_fund = fundamental(from_type);
int to_fund = fundamental(to_type);
int from_cnvtype = convtype(from_type);
int to_cnvtype = convtype(to_type);
if ((int)to_size < (int)word_size) to_size = word_size;
if ((int)from_size == (int)to_size && from_fund == to_fund)
if ((int)from_size == (int)to_size && from_cnvtype == to_cnvtype)
return;
switch (from_fund) {
switch (from_cnvtype) {
case T_SIGNED:
switch (to_fund) {
switch (to_cnvtype) {
case T_SIGNED:
C_loc(from_size);
C_loc(to_size);
@ -59,7 +60,7 @@ conversion(from_type, to_type)
}
C_loc(from_size);
C_loc(to_size);
if (to_fund == T_UNSIGNED) C_ciu();
if (to_cnvtype == T_UNSIGNED) C_ciu();
else C_cif();
break;
}
@ -68,7 +69,7 @@ conversion(from_type, to_type)
if ((int)from_size < (int)word_size) from_size = word_size;
C_loc(from_size);
C_loc(to_size);
switch (to_fund) {
switch (to_cnvtype) {
case T_SIGNED:
C_cui();
break;
@ -86,7 +87,7 @@ conversion(from_type, to_type)
case T_FLOATING:
C_loc(from_size);
C_loc(to_size);
switch (to_fund) {
switch (to_cnvtype) {
case T_SIGNED:
C_cfi();
break;
@ -104,12 +105,12 @@ conversion(from_type, to_type)
}
if ((int)(to_type->tp_size) < (int)word_size
#ifndef NOFLOAT
&& to_fund != T_FLOATING
&& to_cnvtype != T_FLOATING
#endif NOFLOAT
) {
extern long full_mask[];
if (to_fund == T_SIGNED) {
if (to_cnvtype == T_SIGNED) {
C_loc(to_type->tp_size);
C_loc(word_size);
C_cii();
@ -121,11 +122,11 @@ conversion(from_type, to_type)
}
}
/* fundamental() returns in which category a given type falls:
/* convtype() returns in which category a given type falls:
signed, unsigned or floating
*/
int
fundamental(tp)/* bad name ???*/
static int
convtype(tp)/* bad name ???*/
register struct type *tp;
{
switch (tp->tp_fund) {
@ -141,8 +142,8 @@ fundamental(tp)/* bad name ???*/
case DOUBLE:
return T_FLOATING;
#endif NOFLOAT
case POINTER: /* pointer : signed / unsigned ??? */
return T_SIGNED;
case POINTER:
return T_UNSIGNED;
}
return 0;
}

View file

@ -17,9 +17,6 @@ struct declarator {
struct formal *dc_formal; /* params for function */
};
/* ALLOCDEF "declarator" 50 */
struct formal { /* list of formals */
struct formal *next;
struct idf *fm_idf;

View file

@ -42,7 +42,6 @@ do_decspecs(ds)
if (level == L_FORMAL2) {
if (ds->ds_sc_given &&
ds->ds_sc != REGISTER){
extern char *symbol2str();
error("%s formal illegal", symbol2str(ds->ds_sc));
ds->ds_sc = FORMAL;
}

View file

@ -14,6 +14,4 @@ struct decspecs {
int ds_unsigned; /* 0 or 1 */
};
/* ALLOCDEF "decspecs" 50 */
extern struct decspecs null_decspecs;

View file

@ -319,8 +319,6 @@ print_expr(msg, expr)
p1_expr(lvl, expr)
register struct expr *expr;
{
extern char *type2str(), *symbol2str();
p1_indent(lvl);
if (!expr) {
print("NILEXPR\n");

View file

@ -63,13 +63,13 @@ initial_value(register struct type **tpp; register struct expr **expp;) :
;
initial_value_pack(struct type **tpp; struct expr **expp;)
{ static int level; }
{ static int pack_level; }
:
'{'
{ if (level == 0) gen_error = 0; level++; }
{ if (pack_level == 0) gen_error = 0; pack_level++; }
initial_value_list(tpp, expp)
{ level--;
if (! level) {
{ pack_level--;
if (!pack_level) {
while (p_stack) {
struct e_stack *p = p_stack->next;

View file

@ -371,12 +371,13 @@ preprocess()
#endif NOPP
#endif DEBUG
No_Mem()
No_Mem() /* called by alloc package */
{
fatal("out of memory");
}
C_failed()
C_failed() /* called by EM_code module */
{
fatal("write failed");
}

View file

@ -168,7 +168,7 @@ non_function(register struct decspecs *ds; register struct declarator *dc;)
/* 10.1 */
function(struct declarator *dc;)
{
arith fbytes, nbytes;
arith fbytes;
}
:
{ register struct idf *idf = dc->dc_idf;

View file

@ -80,9 +80,9 @@ getactuals(idef)
}
PRIVATE
copyact(ch1, ch2, level)
copyact(ch1, ch2, lvl)
char ch1, ch2;
int level;
int lvl;
{
/* copyact() is taken from Ceriel Jacobs' LLgen, with
permission. Its task is to build a list of actuals
@ -90,16 +90,16 @@ copyact(ch1, ch2, level)
which the parameters are separated by ',' if there are
more than 1. The balancing of '(',')' and '[',']' and
'{','}' is taken care of by calling this function
recursively. At each level, copyact() reads the input,
recursively. At each level lvl, copyact() reads the input,
upto the corresponding closing bracket.
Opening bracket is ch1, closing bracket is ch2. If
level != 0, copy opening and closing parameters too.
lvl != 0, copy opening and closing parameters too.
*/
register int ch; /* Current char */
register int match; /* used to read strings */
if (level) {
if (lvl) {
copy(ch1);
}
@ -107,7 +107,7 @@ copyact(ch1, ch2, level)
LoadChar(ch);
if (ch == ch2) {
if (level) {
if (lvl) {
copy(ch);
}
return;
@ -124,7 +124,7 @@ copyact(ch1, ch2, level)
#endif __MATCHING_PAR__
case '(':
copyact('(', ')', level+1);
copyact('(', ')', lvl+1);
break;
#ifdef __MATCHING_PAR__
@ -133,11 +133,11 @@ copyact(ch1, ch2, level)
#define declare(v, t) t v
declare(v, union{int i, j; float r;});
*/
copyact('{', '}', level+1);
copyact('{', '}', lvl+1);
break;
case '[':
copyact('[', ']', level+1);
copyact('[', ']', lvl+1);
break;
#endif __MATCHING_PAR__
@ -176,7 +176,7 @@ copyact(ch1, ch2, level)
break;
case ',':
if (!level) {
if (!lvl) {
/* next parameter encountered */
copy(EOS);

View file

@ -212,13 +212,13 @@ align(pos, al)
}
struct type *
standard_type(fund, sign, align, size)
int align; arith size;
standard_type(fund, sign, algn, size)
int algn; arith size;
{
register struct type *tp = create_type(fund);
tp->tp_unsigned = sign;
tp->tp_align = align;
tp->tp_align = algn;
tp->tp_size = size;
return tp;