summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2023-07-08 10:59:38 +0000
committerrillig <rillig@NetBSD.org>2023-07-08 10:59:38 +0000
commit65eff3ec00caab9dd533bc374ee510503ba2f320 (patch)
tree7c915b9416c305a76fccc6e99a2b333cd8e9b92f
parenta9f17a43da0092b6d63ec84550b87ef67c7ecef3 (diff)
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.
-rw-r--r--usr.bin/xlint/lint1/lex.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/xlint/lint1/lex.c b/usr.bin/xlint/lint1/lex.c
index 53f1735ea3c..1f800772a85 100644
--- a/usr.bin/xlint/lint1/lex.c
+++ b/usr.bin/xlint/lint1/lex.c
@@ -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, size_t yyleng)
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 */