Module Name: src
Committed By: rillig
Date: Sat Jul 8 10:59:38 UTC 2023
Modified Files:
src/usr.bin/xlint/lint1: lex.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/usr.bin/xlint/lint1/lex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.168 src/usr.bin/xlint/lint1/lex.c:1.169
--- src/usr.bin/xlint/lint1/lex.c:1.168 Mon Jul 3 07:19:57 2023
+++ src/usr.bin/xlint/lint1/lex.c Sat Jul 8 10:59:38 2023
@@ -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 */