decl.c (init_decl_processing): Use set_sizetype.

* decl.c (init_decl_processing): Use set_sizetype.
        * decl2.c (sizetype): Don't declare.
        * typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
        (c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
        (build_component_addr, unary_complex_lvalue): Likewise.
        * rtti.c (expand_class_desc): Likewise.
        * class.c (get_vfield_offset): Likewise.

From-SVN: r17576
This commit is contained in:
J"orn Rennecke 1998-02-01 11:45:10 +00:00 committed by Jeff Law
parent c8bec8c8be
commit f5426d1e9b
7 changed files with 31 additions and 26 deletions

View file

@ -1,3 +1,13 @@
Sun Feb 1 12:45:34 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* decl.c (init_decl_processing): Use set_sizetype.
* decl2.c (sizetype): Don't declare.
* typeck.c (c_sizeof): Convert result of *_DIV_EXPR to sizetype.
(c_sizeof_nowarn, build_binary_op_nodefault): Likewise.
(build_component_addr, unary_complex_lvalue): Likewise.
* rtti.c (expand_class_desc): Likewise.
* class.c (get_vfield_offset): Likewise.
Thu Jan 29 10:39:30 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (convert_nontype_argument): Move check for is_overloaded_fn

View file

@ -606,11 +606,12 @@ tree
get_vfield_offset (binfo)
tree binfo;
{
return size_binop (PLUS_EXPR,
size_binop (FLOOR_DIV_EXPR,
DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
size_int (BITS_PER_UNIT)),
BINFO_OFFSET (binfo));
tree tmp
= size_binop (FLOOR_DIV_EXPR,
DECL_FIELD_BITPOS (CLASSTYPE_VFIELD (BINFO_TYPE (binfo))),
size_int (BITS_PER_UNIT));
tmp = convert (sizetype, tmp);
return size_binop (PLUS_EXPR, tmp, BINFO_OFFSET (binfo));
}
/* Get the offset to the start of the original binfo that we derived

View file

@ -4998,23 +4998,13 @@ init_decl_processing ()
/* `unsigned long' is the standard type for sizeof.
Note that stddef.h uses `unsigned long',
and this must agree, even of long and int are the same size. */
sizetype
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE)));
and this must agree, even if long and int are the same size. */
set_sizetype
(TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (SIZE_TYPE))));
ptrdiff_type_node
= TREE_TYPE (IDENTIFIER_GLOBAL_VALUE (get_identifier (PTRDIFF_TYPE)));
TREE_TYPE (TYPE_SIZE (integer_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (char_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (unsigned_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (long_unsigned_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (long_integer_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (long_long_integer_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (long_long_unsigned_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (short_integer_type_node)) = sizetype;
TREE_TYPE (TYPE_SIZE (short_unsigned_type_node)) = sizetype;
/* Define both `signed char' and `unsigned char'. */
signed_char_type_node = make_signed_type (CHAR_TYPE_SIZE);
record_builtin_type (RID_MAX, "signed char", signed_char_type_node);

View file

@ -2370,8 +2370,6 @@ finish_builtin_type (type, name, fields, len, align_type)
`operator new' and `operator delete' correspond to
what compiler will be expecting. */
extern tree sizetype;
tree
coerce_new_type (type)
tree type;

View file

@ -3502,7 +3502,7 @@ static const short yycheck[] = { 4,
76, 77, 78, 79, 80, 81, 82, 83, 84, 85
};
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
#line 3 "/usr/lib/bison.simple"
#line 3 "/usr/share/bison.simple"
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
@ -3695,7 +3695,7 @@ __yy_memcpy (char *to, char *from, int count)
#endif
#endif
#line 196 "/usr/lib/bison.simple"
#line 196 "/usr/share/bison.simple"
/* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *.
@ -8456,7 +8456,7 @@ case 842:
break;}
}
/* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/lib/bison.simple"
#line 498 "/usr/share/bison.simple"
yyvsp -= yylen;
yyssp -= yylen;

View file

@ -785,6 +785,7 @@ expand_class_desc (tdecl, type)
field = lookup_field (type, get_identifier (name), 0, 0);
offset = size_binop (FLOOR_DIV_EXPR,
DECL_FIELD_BITPOS (field), size_int (BITS_PER_UNIT));
offset = convert (sizetype, offset);
}
else
offset = BINFO_OFFSET (binfo);

View file

@ -1403,6 +1403,7 @@ c_sizeof (type)
/* Convert in case a char is more than one unit. */
t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
size_int (TYPE_PRECISION (char_type_node)));
t = convert (sizetype, t);
/* size_binop does not put the constant in range, so do it now. */
if (TREE_CODE (t) == INTEGER_CST && force_fit_type (t, 0))
TREE_CONSTANT_OVERFLOW (t) = TREE_OVERFLOW (t) = 1;
@ -1460,6 +1461,7 @@ c_sizeof_nowarn (type)
/* Convert in case a char is more than one unit. */
t = size_binop (CEIL_DIV_EXPR, TYPE_SIZE (type),
size_int (TYPE_PRECISION (char_type_node)));
t = convert (sizetype, t);
force_fit_type (t, 0);
return t;
}
@ -3537,6 +3539,7 @@ build_binary_op_nodefault (code, orig_op0, orig_op1, error_code)
delta21 = CLASSTYPE_VFIELD (TYPE_METHOD_BASETYPE (TREE_TYPE (type1)));
delta21 = DECL_FIELD_BITPOS (delta21);
delta21 = size_binop (FLOOR_DIV_EXPR, delta21, size_int (BITS_PER_UNIT));
delta21 = convert (sizetype, delta21);
}
else
index1 = integer_neg_one_node;
@ -4092,6 +4095,7 @@ build_component_addr (arg, argtype, msg)
tree offset = size_binop (EASY_DIV_EXPR, DECL_FIELD_BITPOS (field),
size_int (BITS_PER_UNIT));
int flag = TREE_CONSTANT (rval);
offset = convert (sizetype, offset);
rval = fold (build (PLUS_EXPR, argtype,
rval, cp_convert (argtype, offset)));
TREE_CONSTANT (rval) = flag;
@ -4746,9 +4750,10 @@ unary_complex_lvalue (code, arg)
/* Add in the offset to the field. */
offset = size_binop (PLUS_EXPR, offset,
size_binop (EASY_DIV_EXPR,
DECL_FIELD_BITPOS (t),
size_int (BITS_PER_UNIT)));
convert (sizetype,
size_binop (EASY_DIV_EXPR,
DECL_FIELD_BITPOS (t),
size_int (BITS_PER_UNIT))));
/* We offset all pointer to data members by 1 so that we can
distinguish between a null pointer to data member and the first