summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-08 20:25:42 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-08 20:25:42 +0000
commit40f4dbd544658572dd5e4693476ddbbe29d9917b (patch)
tree31256910f3b10e27ff12fd3f87bb0f45c2c64979 /gcc/builtins.c
parent33d22d7839d8bd9387be23980405622f06715fab (diff)
downloadgcc-40f4dbd544658572dd5e4693476ddbbe29d9917b.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@88793 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 76be4a7f619..255a47ba19c 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);