aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm@polyomino.org.uk>2004-10-08 21:25:42 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2004-10-08 21:25:42 +0100
commit6d84156b878215c40f1b934c8a24e3c39485a978 (patch)
tree31256910f3b10e27ff12fd3f87bb0f45c2c64979 /gcc/c-lex.c
parent176f9629607f429d33d6461d0eed9263017da7ca (diff)
downloadgcc-6d84156b878215c40f1b934c8a24e3c39485a978.zip
gcc-6d84156b878215c40f1b934c8a24e3c39485a978.tar.gz
gcc-6d84156b878215c40f1b934c8a24e3c39485a978.tar.bz2
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
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c12
1 files changed, 6 insertions, 6 deletions
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);