diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-10-08 21:25:42 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-10-08 21:25:42 +0100 |
commit | 6d84156b878215c40f1b934c8a24e3c39485a978 (patch) | |
tree | 31256910f3b10e27ff12fd3f87bb0f45c2c64979 /gcc/builtins.c | |
parent | 176f9629607f429d33d6461d0eed9263017da7ca (diff) | |
download | gcc-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/builtins.c')
-rw-r--r-- | gcc/builtins.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 76be4a7..255a47b 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -5825,8 +5825,15 @@ fold_builtin_inf (tree type, int warn) { REAL_VALUE_TYPE real; + /* __builtin_inff is intended to be usable to define INFINITY on all + targets. If an infinity is not available, INFINITY expands "to a + positive constant of type float that overflows at translation + time", footnote "In this case, using INFINITY will violate the + constraint in 6.4.4 and thus require a diagnostic." (C99 7.12#4). + Thus we pedwarn to ensure this constraint violation is + diagnosed. */ if (!MODE_HAS_INFINITIES (TYPE_MODE (type)) && warn) - warning ("target format does not support infinity"); + pedwarn ("target format does not support infinity"); real_inf (&real); return build_real (type, real); |