compute some expressions in "int" instead of "arith"
This commit is contained in:
parent
8dfafeb4e3
commit
a1b08c5ee3
1 changed files with 30 additions and 27 deletions
|
@ -113,9 +113,9 @@ align(pos, al)
|
||||||
arith pos;
|
arith pos;
|
||||||
int al;
|
int al;
|
||||||
{
|
{
|
||||||
arith i = pos % al;
|
int i = pos % al;
|
||||||
|
|
||||||
if (i) return pos + al - i;
|
if (i) return pos + (al - i);
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,19 +142,20 @@ InitTypes()
|
||||||
|
|
||||||
/* first, do some checking
|
/* first, do some checking
|
||||||
*/
|
*/
|
||||||
if (int_size != word_size) {
|
if ((int) int_size != (int) word_size) {
|
||||||
fatal("integer size not equal to word size");
|
fatal("integer size not equal to word size");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (int_size != pointer_size) {
|
if ((int) int_size != (int) pointer_size) {
|
||||||
fatal("cardinal size not equal to pointer size");
|
fatal("cardinal size not equal to pointer size");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (long_size < int_size || long_size % word_size != 0) {
|
if ((int) long_size < (int) int_size ||
|
||||||
|
(int) long_size % (int) word_size != 0) {
|
||||||
fatal("illegal long integer size");
|
fatal("illegal long integer size");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (double_size < float_size) {
|
if ((int) double_size < (int) float_size) {
|
||||||
fatal("long real size smaller than real size");
|
fatal("long real size smaller than real size");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +195,7 @@ InitTypes()
|
||||||
*/
|
*/
|
||||||
tp = construct_type(T_SUBRANGE, card_type);
|
tp = construct_type(T_SUBRANGE, card_type);
|
||||||
tp->sub_lb = 0;
|
tp->sub_lb = 0;
|
||||||
tp->sub_ub = word_size * 8 - 1;
|
tp->sub_ub = (int) word_size * 8 - 1;
|
||||||
bitset_type = set_type(tp);
|
bitset_type = set_type(tp);
|
||||||
|
|
||||||
/* a unique type for standard procedures and functions
|
/* a unique type for standard procedures and functions
|
||||||
|
@ -238,33 +239,35 @@ enum_type(EnumList)
|
||||||
|
|
||||||
struct type *
|
struct type *
|
||||||
qualified_type(nd)
|
qualified_type(nd)
|
||||||
struct node *nd;
|
register struct node *nd;
|
||||||
{
|
{
|
||||||
struct type *tp = error_type;
|
struct type *tp = error_type;
|
||||||
|
register struct def *df;
|
||||||
|
|
||||||
if (ChkDesignator(nd)) {
|
if (ChkDesignator(nd)) {
|
||||||
if (nd->nd_class != Def) node_error(nd, "type expected");
|
if (nd->nd_class != Def) {
|
||||||
else {
|
node_error(nd, "type expected");
|
||||||
register struct def *df = nd->nd_def;
|
FreeNode(nd);
|
||||||
|
return error_type;
|
||||||
if (df->df_kind&(D_ISTYPE|D_FORWARD|D_FORWTYPE|D_ERROR)) {
|
|
||||||
if (! df->df_type) {
|
|
||||||
node_error(nd,"type \"%s\" not (yet) declared", df->df_idf->id_text);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (df->df_kind == D_FORWTYPE) {
|
|
||||||
df->df_kind = D_FTYPE;
|
|
||||||
}
|
|
||||||
tp = df->df_type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
node_error(nd,"identifier \"%s\" is not a type", df->df_idf->id_text);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
df = nd->nd_def;
|
||||||
|
if (df->df_kind&(D_ISTYPE|D_FORWARD|D_FORWTYPE|D_ERROR)) {
|
||||||
|
if (! df->df_type) {
|
||||||
|
node_error(nd,"type \"%s\" not (yet) declared", df->df_idf->id_text);
|
||||||
|
FreeNode(nd);
|
||||||
|
return error_type;
|
||||||
|
}
|
||||||
|
FreeNode(nd);
|
||||||
|
if (df->df_kind == D_FORWTYPE) {
|
||||||
|
df->df_kind = D_FTYPE;
|
||||||
|
}
|
||||||
|
return df->df_type;
|
||||||
|
}
|
||||||
|
node_error(nd,"identifier \"%s\" is not a type", df->df_idf->id_text);
|
||||||
}
|
}
|
||||||
FreeNode(nd);
|
FreeNode(nd);
|
||||||
return tp;
|
return error_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
chk_basesubrange(tp, base)
|
chk_basesubrange(tp, base)
|
||||||
|
|
Loading…
Reference in a new issue