From 6d84156b878215c40f1b934c8a24e3c39485a978 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 8 Oct 2004 21:25:42 +0100 Subject: c-lex.c (interpret_float): Give a pedwarn rather than a warning for an out-of-range floating point constant. * c-lex.c (interpret_float): Give a pedwarn rather than a warning for an out-of-range floating point constant. * builtins.c (fold_builtin_inf): Give a pedwarn rather than a warning if the target format does not support infinities. testsuite: * gcc.dg/float-range-1.c, gcc.dg/float-range-2.c: New tests. From-SVN: r88793 --- gcc/c-lex.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/c-lex.c') diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 98f60f6..77c2e4c 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -653,13 +653,13 @@ interpret_float (const cpp_token *token, unsigned int flags) real_from_string (&real, copy); real_convert (&real, TYPE_MODE (type), &real); - /* A diagnostic is required for "soft" overflow by some ISO C - testsuites. This is not pedwarn, because some people don't want - an error for this. - ??? That's a dubious reason... is this a mandatory diagnostic or - isn't it? -- zw, 2001-08-21. */ + /* Both C and C++ require a diagnostic for a floating constant + outside the range of representable values of its type. Since we + have __builtin_inf* to produce an infinity, it might now be + appropriate for this to be a mandatory pedwarn rather than + conditioned on -pedantic. */ if (REAL_VALUE_ISINF (real) && pedantic) - warning ("floating constant exceeds range of %<%s%>", type_name); + pedwarn ("floating constant exceeds range of %<%s%>", type_name); /* Create a node with determined type and value. */ value = build_real (type, real); -- cgit v1.1