* c-decl.c (widest_integer_literal_type_node,
widest_unsigned_literal_type) : New.
(init_decl_processing): Handle/use the two new types.
* c-common.c (type_for_size,type_for_mode) : Same.
* c-lex.c (yylex) : Same.
* c-typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
Same.
* c-tree.h (widest_integer_literal_type_node,
widest_unsigned_literal_type) : New.
For gcc/cp:
* cp-tree.h (widest_integer_literal_type_node,
widest_unsigned_literal_type) : New.
* decl.c (widest_integer_literal_type_node,
widest_unsigned_literal_type) : New.
(init_decl_processing): Handle/use the two new types.
* lex.c (real_yylex): Same.
* typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
Same.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27923
138bc75d-0d04-0410-961f-
82ee72b054a4
+Fri Jul 2 13:23:39 1999 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * c-decl.c (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+ (init_decl_processing): Handle/use the two new types.
+ * c-common.c (type_for_size,type_for_mode) : Same.
+ * c-lex.c (yylex) : Same.
+ * c-typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
+ Same.
+ * c-tree.h (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+
Fri Jul 2 03:05:44 1999 Jeffrey A Law (law@cygnus.com)
* dwarfout.c (field_byte_offset): Correctly compute the object's
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (bits == TYPE_PRECISION (widest_integer_literal_type_node))
+ return (unsignedp ? widest_unsigned_literal_type_node
+ : widest_integer_literal_type_node);
+
if (bits <= TYPE_PRECISION (intQI_type_node))
return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
if (mode == TYPE_MODE (long_long_integer_type_node))
return unsignedp ? long_long_unsigned_type_node : long_long_integer_type_node;
+ if (mode == TYPE_MODE (widest_integer_literal_type_node))
+ return unsignedp ? widest_unsigned_literal_type_node
+ : widest_integer_literal_type_node;
+
if (mode == TYPE_MODE (intQI_type_node))
return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
tree long_unsigned_type_node;
tree long_long_unsigned_type_node;
+/* These are used for integer literals that are larger than
+ a long long. The largest integer literals we can handle
+ are the width of two HOST_WIDE_INTs. If two HOST_WIDE_INTs
+ are not larger than the target's long long, then these
+ will never be used. */
+tree widest_integer_literal_type_node;
+tree widest_unsigned_literal_type_node;
+
tree boolean_type_node;
tree boolean_false_node;
tree boolean_true_node;
pushdecl (build_decl (TYPE_DECL, get_identifier ("unsigned char"),
unsigned_char_type_node));
+ /* Create the widest literal types. */
+ widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ widest_integer_literal_type_node));
+
+ widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ widest_unsigned_literal_type_node));
+
+ /* Now all the integer mode types. */
intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
else if (! spec_long_long)
traditional_type = (spec_unsigned ? long_unsigned_type_node
: long_integer_type_node);
- else
+ else if (int_fits_type_p (yylval.ttype,
+ spec_unsigned
+ ? long_long_unsigned_type_node
+ : long_long_integer_type_node))
traditional_type = (spec_unsigned
? long_long_unsigned_type_node
: long_long_integer_type_node);
+ else
+ traditional_type = (spec_unsigned
+ ? widest_unsigned_literal_type_node
+ : widest_integer_literal_type_node);
}
if (warn_traditional || ! flag_traditional)
{
&& int_fits_type_p (yylval.ttype,
long_long_integer_type_node))
ansi_type = long_long_integer_type_node;
- else
+ else if (int_fits_type_p (yylval.ttype,
+ long_long_unsigned_type_node))
ansi_type = long_long_unsigned_type_node;
+ else if (! spec_unsigned
+ && int_fits_type_p (yylval.ttype,
+ widest_integer_literal_type_node))
+ ansi_type = widest_integer_literal_type_node;
+ else
+ ansi_type = widest_unsigned_literal_type_node;
}
type = flag_traditional ? traditional_type : ansi_type;
extern tree long_double_type_node;
extern tree long_ftype_long;
extern tree long_integer_type_node;
+extern tree long_unsigned_type_node;
extern tree long_long_integer_type_node;
extern tree long_long_unsigned_type_node;
-extern tree long_unsigned_type_node;
+extern tree widest_integer_literal_type_node;
+extern tree widest_unsigned_literal_type_node;
extern tree complex_integer_type_node;
extern tree complex_float_type_node;
extern tree complex_double_type_node;
return long_unsigned_type_node;
if (type1 == long_long_integer_type_node)
return long_long_unsigned_type_node;
+ if (type1 == widest_integer_literal_type_node)
+ return widest_unsigned_literal_type_node;
if (type1 == intDI_type_node)
return unsigned_intDI_type_node;
if (type1 == intSI_type_node)
return long_integer_type_node;
if (type1 == long_long_unsigned_type_node)
return long_long_integer_type_node;
+ if (type1 == widest_unsigned_literal_type_node)
+ return widest_integer_literal_type_node;
if (type1 == unsigned_intDI_type_node)
return intDI_type_node;
if (type1 == unsigned_intSI_type_node)
if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node))
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (TYPE_PRECISION (type) == TYPE_PRECISION (widest_integer_literal_type_node))
+ return (unsignedp ? widest_unsigned_literal_type_node
+ : widest_integer_literal_type_node);
return type;
}
+1999-07-02 Gavin Romig-Koch <gavin@cygnus.com>
+
+ * cp-tree.h (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+ * decl.c (widest_integer_literal_type_node,
+ widest_unsigned_literal_type) : New.
+ (init_decl_processing): Handle/use the two new types.
+ * lex.c (real_yylex): Same.
+ * typeck.c (unsigned_type,signed_type,signed_or_unsigned_type) :
+ Same.
+
1999-07-01 Mark Mitchell <mark@codesourcery.com>
* decl.c (grokdeclarator): Don't give names "for linkage purposes"
extern tree short_integer_type_node, short_unsigned_type_node;
extern tree long_integer_type_node, long_unsigned_type_node;
extern tree long_long_integer_type_node, long_long_unsigned_type_node;
+extern tree widest_integer_literal_type_node, widest_unsigned_literal_type_node;
extern tree unsigned_type_node;
extern tree string_type_node, char_array_type_node, int_array_type_node;
extern tree wchar_array_type_node;
tree long_unsigned_type_node;
tree long_long_unsigned_type_node;
+/* These are used for integer literals that are larger than
+ a long long. The largest integer literals we can handle
+ are the width of two HOST_WIDE_INTs. If two HOST_WIDE_INTs
+ are not larger than the target's long long, then these
+ will never be used. */
+tree widest_integer_literal_type_node;
+tree widest_unsigned_literal_type_node;
+
tree ptrdiff_type_node;
tree unsigned_char_type_node;
unsigned_char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
record_builtin_type (RID_MAX, "unsigned char", unsigned_char_type_node);
+ /* Create the widest literal types. */
+ widest_integer_literal_type_node = make_signed_type (HOST_BITS_PER_WIDE_INT * 2);
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ widest_integer_literal_type_node));
+
+ widest_unsigned_literal_type_node = make_unsigned_type (HOST_BITS_PER_WIDE_INT * 2);
+ pushdecl (build_decl (TYPE_DECL, NULL_TREE,
+ widest_unsigned_literal_type_node));
+
/* These are types that type_for_size and type_for_mode use. */
intQI_type_node = make_signed_type (GET_MODE_BITSIZE (QImode));
pushdecl (build_decl (TYPE_DECL, NULL_TREE, intQI_type_node));
&& int_fits_type_p (yylval.ttype,
long_long_integer_type_node))
type = long_long_integer_type_node;
- else
+ else if (int_fits_type_p (yylval.ttype,
+ long_long_unsigned_type_node))
type = long_long_unsigned_type_node;
+ else if (! spec_unsigned
+ && int_fits_type_p (yylval.ttype,
+ widest_integer_literal_type_node))
+ type = widest_integer_literal_type_node;
+ else
+ type = widest_unsigned_literal_type_node;
if (!int_fits_type_p (yylval.ttype, type) && !warn)
pedwarn ("integer constant is larger than the maximum value for its type");
return long_unsigned_type_node;
if (type1 == long_long_integer_type_node)
return long_long_unsigned_type_node;
+ if (type1 == widest_integer_literal_type_node)
+ return widest_unsigned_literal_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
if (type1 == intTI_type_node)
return unsigned_intTI_type_node;
return long_integer_type_node;
if (type1 == long_long_unsigned_type_node)
return long_long_integer_type_node;
+ if (type1 == widest_unsigned_literal_type_node)
+ return widest_integer_literal_type_node;
#if HOST_BITS_PER_WIDE_INT >= 64
if (type1 == unsigned_intTI_type_node)
return intTI_type_node;
if (TYPE_PRECISION (type) == TYPE_PRECISION (long_long_integer_type_node))
return (unsignedp ? long_long_unsigned_type_node
: long_long_integer_type_node);
+ if (TYPE_PRECISION (type) == TYPE_PRECISION (widest_integer_literal_type_node))
+ return (unsignedp ? widest_unsigned_literal_type_node
+ : widest_integer_literal_type_node);
return type;
}