\f
/* Return the common type of two types.
We assume that comptypes has already been done and returned 1;
- if that isn't so, this may crash.
+ if that isn't so, this may crash. In particular, we assume that qualifiers
+ match.
This is the type for the result of most arithmetic operations
- if the operands have the given two types.
-
- We do not deal with enumeral types here because they have already been
- converted to integer types. */
+ if the operands have the given two types. */
tree
common_type (t1, t2)
if (TREE_CHAIN (t) == 0 && type != void_type_node)
return 0;
- if (type == float_type_node)
+ if (TYPE_MAIN_VARIANT (type) == float_type_node)
return 0;
if (type
self_promoting_type_p (type)
tree type;
{
- if (type == float_type_node)
+ if (TYPE_MAIN_VARIANT (type) == float_type_node)
return 0;
if (TREE_CODE (type) == INTEGER_TYPE
unsigned_type (type)
tree type;
{
- if (type == signed_char_type_node || type == char_type_node)
+ tree type1 = TYPE_MAIN_VARIANT (type);
+ if (type1 == signed_char_type_node || type1 == char_type_node)
return unsigned_char_type_node;
- if (type == integer_type_node)
+ if (type1 == integer_type_node)
return unsigned_type_node;
- if (type == short_integer_type_node)
+ if (type1 == short_integer_type_node)
return short_unsigned_type_node;
- if (type == long_integer_type_node)
+ if (type1 == long_integer_type_node)
return long_unsigned_type_node;
- if (type == long_long_integer_type_node)
+ if (type1 == long_long_integer_type_node)
return long_long_unsigned_type_node;
return type;
}
signed_type (type)
tree type;
{
- if (type == unsigned_char_type_node || type == char_type_node)
+ tree type1 = TYPE_MAIN_VARIANT (type);
+ if (type1 == unsigned_char_type_node || type1 == char_type_node)
return signed_char_type_node;
- if (type == unsigned_type_node)
+ if (type1 == unsigned_type_node)
return integer_type_node;
- if (type == short_unsigned_type_node)
+ if (type1 == short_unsigned_type_node)
return short_integer_type_node;
- if (type == long_unsigned_type_node)
+ if (type1 == long_unsigned_type_node)
return long_integer_type_node;
- if (type == long_long_unsigned_type_node)
+ if (type1 == long_long_unsigned_type_node)
return long_long_integer_type_node;
return type;
}
return convert (unsigned_type_node, exp);
return convert (integer_type_node, exp);
}
- if (flag_traditional && type == float_type_node)
+ if (flag_traditional && TYPE_MAIN_VARIANT (type) == float_type_node)
return convert (double_type_node, exp);
if (code == VOID_TYPE)
{
It will work on most machines, because size_t and int
have the same mode. But might as well warn anyway,
since it will fail on other machines. */
- if (TREE_TYPE (cur_param) != integer_type_node)
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+ != integer_type_node)
{
sprintf (message,
"field width is not type int (arg %d)",
cur_param = TREE_VALUE (params);
params = TREE_CHAIN (params);
++arg_num;
- if (TREE_TYPE (cur_param) != integer_type_node)
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (cur_param))
+ != integer_type_node)
{
sprintf (message,
"field width is not type int (arg %d)",
/* Check the type of the "real" argument, if there's a type we want. */
if (i == fci->pointer_count && wanted_type != 0
- && wanted_type != cur_type
+ && wanted_type != TYPE_MAIN_VARIANT (cur_type)
/* If we want `void *', allow any pointer type.
(Anything else would already have got a warning.) */
&& ! (wanted_type == void_type_node
regardless of size of value being shifted. */
if (! flag_traditional)
{
- if (TREE_TYPE (op1) != integer_type_node)
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
op1 = convert (integer_type_node, op1);
/* Avoid converting op1 to result_type later. */
converted = 1;
regardless of size of value being shifted. */
if (! flag_traditional)
{
- if (TREE_TYPE (op1) != integer_type_node)
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
op1 = convert (integer_type_node, op1);
/* Avoid converting op1 to result_type later. */
converted = 1;
regardless of size of value being shifted. */
if (! flag_traditional)
{
- if (TREE_TYPE (op1) != integer_type_node)
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (op1)) != integer_type_node)
op1 = convert (integer_type_node, op1);
/* Avoid converting op1 to result_type later. */
converted = 1;
else
{
tree index;
+ type = TYPE_MAIN_VARIANT (TREE_TYPE (exp));
if (warn_traditional
- && (TREE_TYPE (exp) == long_integer_type_node
- || TREE_TYPE (exp) == long_unsigned_type_node))
+ && (type == long_integer_type_node
+ || type == long_unsigned_type_node))
pedwarn ("`long' switch expression not converted to `int' in ANSI C");
exp = default_conversion (exp);