Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/lint1 lint: fix duplicate warning when parsing...



details:   https://anonhg.NetBSD.org/src/rev/217ee84e1c00
branches:  trunk
changeset: 374164:217ee84e1c00
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Apr 05 20:17:30 2023 +0000

description:
lint: fix duplicate warning when parsing big float constants

diffstat:

 tests/usr.bin/xlint/lint1/platform_ldbl128.c |  4 +---
 tests/usr.bin/xlint/lint1/platform_ldbl96.c  |  4 +---
 usr.bin/xlint/lint1/lex.c                    |  9 ++++-----
 3 files changed, 6 insertions(+), 11 deletions(-)

diffs (68 lines):

diff -r 25490455b5eb -r 217ee84e1c00 tests/usr.bin/xlint/lint1/platform_ldbl128.c
--- a/tests/usr.bin/xlint/lint1/platform_ldbl128.c      Wed Apr 05 20:13:01 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/platform_ldbl128.c      Wed Apr 05 20:17:30 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: platform_ldbl128.c,v 1.4 2023/04/05 20:13:01 rillig Exp $      */
+/*     $NetBSD: platform_ldbl128.c,v 1.5 2023/04/05 20:17:30 rillig Exp $      */
 # 3 "platform_ldbl128.c"
 
 /*
@@ -19,8 +19,6 @@ typedef int bytes_per_long_double[sizeof
  * 1.189e4932. This is in the same range as for 96-bit 'long double', as the
  * exponent range is the same.
  */
-/* FIXME: remove the duplicate warning. */
-/* expect+2: warning: floating-point constant out of range [248] */
 /* expect+1: warning: floating-point constant out of range [248] */
 double larger_than_ldbl = 1e4933;
 /* expect+1: warning: floating-point constant out of range [248] */
diff -r 25490455b5eb -r 217ee84e1c00 tests/usr.bin/xlint/lint1/platform_ldbl96.c
--- a/tests/usr.bin/xlint/lint1/platform_ldbl96.c       Wed Apr 05 20:13:01 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/platform_ldbl96.c       Wed Apr 05 20:17:30 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: platform_ldbl96.c,v 1.4 2023/04/05 20:13:01 rillig Exp $       */
+/*     $NetBSD: platform_ldbl96.c,v 1.5 2023/04/05 20:17:30 rillig Exp $       */
 # 3 "platform_ldbl96.c"
 
 /*
@@ -18,8 +18,6 @@ typedef int bytes_per_long_double[sizeof
  * This means the maximum representable value is 1.1111111(bin) * 2^16383,
  * which is about 1.189e4932.
  */
-/* FIXME: Remove the duplicate warning. */
-/* expect+2: warning: floating-point constant out of range [248] */
 /* expect+1: warning: floating-point constant out of range [248] */
 double larger_than_ldbl = 1e4933;
 /* expect+1: warning: floating-point constant out of range [248] */
diff -r 25490455b5eb -r 217ee84e1c00 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Wed Apr 05 20:13:01 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Wed Apr 05 20:17:30 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.155 2023/03/31 13:03:05 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.156 2023/04/05 20:17:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.155 2023/03/31 13:03:05 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.156 2023/04/05 20:17:30 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -649,11 +649,10 @@ lex_floating_constant(const char *yytext
        char *eptr;
        long double ld = strtold(cp, &eptr);
        lint_assert(eptr == cp + len);
-       if (errno != 0)
+       if (errno != 0) {
                /* floating-point constant out of range */
                warning(248);
-
-       if (typ == FLOAT) {
+       } else if (typ == FLOAT) {
                ld = (float)ld;
                if (isfinite(ld) == 0) {
                        /* floating-point constant out of range */



Home | Main Index | Thread Index | Old Index