summaryrefslogtreecommitdiff
path: root/gcc/c-lex.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/c-lex.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/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 98f60f639d4..77c2e4c8ace 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);