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 handling of 'long double' in c...



details:   https://anonhg.NetBSD.org/src/rev/14c73ea2ddf2
branches:  trunk
changeset: 377346:14c73ea2ddf2
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jul 08 10:59:38 2023 +0000

description:
lint: fix handling of 'long double' in cross-compiled mode

When lint is compiled on x86-64 (where 'long double' has a 64-bit
mantissa) and targets arm (where 'long double' has a 53-bit mantissa),
warn if a constant cannot fit in the 'long double' of the target
platform, not of the host platform.

diffstat:

 usr.bin/xlint/lint1/lex.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 2a97ec867835 -r 14c73ea2ddf2 usr.bin/xlint/lint1/lex.c
--- a/usr.bin/xlint/lint1/lex.c Sat Jul 08 10:01:17 2023 +0000
+++ b/usr.bin/xlint/lint1/lex.c Sat Jul 08 10:59:38 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.168 2023/07/03 07:19:57 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.169 2023/07/08 10:59:38 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.168 2023/07/03 07:19:57 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.169 2023/07/08 10:59:38 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -660,7 +660,8 @@ lex_floating_constant(const char *yytext
                        warning(248);
                        ld = ld > 0 ? FLT_MAX : -FLT_MAX;
                }
-       } else if (typ == DOUBLE) {
+       } else if (typ == DOUBLE
+           || /* CONSTCOND */LDOUBLE_SIZE == DOUBLE_SIZE) {
                ld = (double)ld;
                if (isfinite(ld) == 0) {
                        /* floating-point constant out of range */



Home | Main Index | Thread Index | Old Index