summaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-08 21:20:45 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2000-10-08 21:20:45 +0000
commite3fff6f226714d15ecd144e99828cbdd25bc2bb5 (patch)
tree15af4058397b150088ce3bdbb721fc90ed1842f9 /gcc/c-lex.c
parent8f4541cff38281b781a0171db819386cc3406e45 (diff)
downloadgcc-e3fff6f226714d15ecd144e99828cbdd25bc2bb5.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36791 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 693615361fc..343c9ccc659 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -2287,11 +2287,19 @@ lex_number (str, len)
warning ("width of integer constant may change on other systems with -traditional");
}
- if (pedantic && !flag_traditional && !spec_long_long && !warn
- && (TYPE_PRECISION (long_integer_type_node) < TYPE_PRECISION (type)))
+ if (pedantic && !flag_traditional && (flag_isoc99 || !spec_long_long)
+ && !warn
+ && ((flag_isoc99
+ ? TYPE_PRECISION (long_long_integer_type_node)
+ : TYPE_PRECISION (long_integer_type_node)) < TYPE_PRECISION (type)))
{
warn = 1;
- pedwarn ("integer constant larger than the maximum value of an unsigned long int");
+ pedwarn ("integer constant larger than the maximum value of %s",
+ (flag_isoc99
+ ? (TREE_UNSIGNED (type)
+ ? "an unsigned long long int"
+ : "a long long int")
+ : "an unsigned long int"));
}
if (base == 10 && ! spec_unsigned && TREE_UNSIGNED (type))