aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-10-08 22:20:45 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2000-10-08 22:20:45 +0100
commitb15ad712574a975b0ba2a333bff74db3f19c17d4 (patch)
tree15af4058397b150088ce3bdbb721fc90ed1842f9 /gcc/c-common.c
parent2588e44e0019aac9b55c974efd69885eea663f54 (diff)
downloadgcc-b15ad712574a975b0ba2a333bff74db3f19c17d4.zip
gcc-b15ad712574a975b0ba2a333bff74db3f19c17d4.tar.gz
gcc-b15ad712574a975b0ba2a333bff74db3f19c17d4.tar.bz2
tm.texi (INTMAX_TYPE, [...]): Define.
* tm.texi (INTMAX_TYPE, UINTMAX_TYPE): Define. * c-common.h (enum c_tree_index): Add CTI_INTMAX_TYPE and CTI_UINTMAX_TYPE. (intmax_type_node, uintmax_type_node): Define. * c-common.c (decl_attributes): If pedantic, warn if `mode' attributes create a type wider than intmax_t. (T_IM, T_UIM): Define properly. * c-decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already defined. (init_decl_processing): Initialize intmax_type_node and uintmax_type_node. * c-lex.c (lex_number): When pedantic and warning for integer constants that are too large, in C99 mode warn for those that have a type wider than long long. cp: * decl.c (INTMAX_TYPE, UINTMAX_TYPE): Define if not already defined. (init_decl_processing): Initialize intmax_type_node and uintmax_type_node. testsuite: * gcc.dg/c99-printf-1.c, gcc.dg/c99-scanf-1.c, gcc.dg/c90-printf-2.c, gcc.dg/c90-scanf-2.c: Define intmax_t and uintmax_t using <limits.h> to emulate the compiler's internal logic. No longer XFAIL %j tests. From-SVN: r36791
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 6ad83f7..7ae71c9 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -761,6 +761,12 @@ decl_attributes (node, attributes, prefix_attributes)
error ("no data type for mode `%s'", p);
else
{
+ if (TYPE_PRECISION (typefm) > (TREE_UNSIGNED (type)
+ ? TYPE_PRECISION(uintmax_type_node)
+ : TYPE_PRECISION(intmax_type_node))
+ && pedantic)
+ pedwarn ("type with more precision than %s",
+ TREE_UNSIGNED (type) ? "uintmax_t" : "intmax_t");
TREE_TYPE (decl) = type = typefm;
DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
layout_decl (decl, 0);
@@ -1589,9 +1595,9 @@ static const format_flag_pair strftime_flag_pairs[] =
#define T99_PD { STD_C99, "ptrdiff_t", T_PD }
#define T_UPD &unsigned_ptrdiff_type_node
#define T99_UPD { STD_C99, "unsigned ptrdiff_t", T_UPD }
-#define T_IM NULL /* intmax_t not yet implemented. */
+#define T_IM &intmax_type_node
#define T99_IM { STD_C99, "intmax_t", T_IM }
-#define T_UIM NULL /* uintmax_t not yet implemented. */
+#define T_UIM &uintmax_type_node
#define T99_UIM { STD_C99, "uintmax_t", T_UIM }
static const format_char_info print_char_table[] =